fbb-7.04j/0042755000175100017510000000000007726666177010437 5ustar abaabafbb-7.04j/include/0042755000175100017510000000000007726653454012054 5ustar abaabafbb-7.04j/include/fbb_serv.h0100644000175100017510000011313507726652173014011 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * SERV.H */ #ifndef _fbb_serv #define _fbb_serv /* #define FORTIFY */ #ifdef __LINUX__ #include #include #ifdef OLD_AX25 #include #include #include #include #else #include #include #include #include #endif /* Bug dans libc ????? <================== */ #define __NO_CTYPE #define FAR #define __a2__ __attribute__ ((packed, aligned(2))) #else #define __a2__ #endif /* Numero du canal pactor HST */ #define PACTOR_CH 31 /* Minimum place disque (KB) */ #define MIN_DISK 1000 /* #define FBB_DEBUG 1 */ #define NO_EMS_CHN /* Genere une exception .... */ /* #define dump_core() {char *coreptr = NULL ; *coreptr = 0x55 ; } */ /* Index des couleurs */ #define W_SNDT 0 /* Envoie data */ #define W_RCVT 1 /* Recoit data */ #define W_CHNI 2 /* Canal Information */ #define W_MONH 3 /* Monitoring header */ #define W_MOND 4 /* Monitoring data */ #define W_CNST 5 /* Console text */ #define W_BACK 6 /* Background */ #define W_STAT 7 /* Fenetre de status */ #define W_DEFL 8 /* Couleur Fenetre haute */ #define W_VOIE 9 /* Couleur voie */ #define W_NCOL 10 /* Nombre de couleurs definies */ #define ENCODE 0 #define DECODE 1 #define NO_REPORT_MODE 0 #define REPORT_MODE 1 /* Programmation du port */ #define XON 1 #define CTS 2 #define DSR 4 /* Constantes specifiques aux I/O */ #define COMMAND 11 #define DATA 12 #define UNPROTO 13 #define DISPLAY 14 #define TOR 15 #define STATS 16 #define NBBUF 17 #define NBCHR 18 /* Protocoles de forwarding */ #define FWD_MBL 1 #define FWD_FBB 2 #define FWD_BIN 4 #define FWD_BIN1 8 #define FWD_XPRO 16 /* Constantes de status des TNC */ #define INVCMD 0xff #define NOCMD 0 #define TNCSTAT 1 #define PACLEN 2 #define CMDE 3 #define SETFLG 4 #define SNDCMD 5 #define ECHOCMD 6 #define PORTCMD 7 #define ERRCMD 8 #define BINCMD 9 #define BSCMD 10 #define SUSPCMD 11 #define SETBUSY 12 /* Nb d'unites virtuelles ds FBBDOS */ #define NB_PATH 8 #define NEWIDNT #define LINT_ARGS #define uchar unsigned char #define lcall unsigned long #define ISGRAPH(c) (!iscntrl(c) && !isspace(c)) #define ISPRINT(c) (!iscntrl(c)) #define PRIVATE(type) ((type == 'P') || (type == 'A') || (type == 'T')) #include "version.h" #if defined(__FBBDOS__) || defined(__WINDOWS__) #include #include #include #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include #define ERR_OPEN 0 #define ERR_CREATE 1 #define ERR_CLOSE 2 #define ERR_SYNCHRO 3 #define ERR_MEMORY 4 #define ERR_CANAL 5 #define ERR_NIVEAU 6 #define ERR_WRITE 7 #define ERR_SYNTAX 8 #define ERR_TNC 9 #define ERR_PTR 10 #define ERR_EXMS 11 #define ERR_DIV0 12 #define ERR_EXCEPTION 13 #ifndef FBB_IO #define USR_CALL 0 #define BBS_CALL 1 #define read fbb_read #define write fbb_write #define open fbb_open #define close fbb_close #define unlink fbb_unlink #define fread fbb_fread #define fwrite fbb_fwrite #define fopen fbb_fopen #define fclose fbb_fclose #define fgetc fbb_fgetc #define fputc fbb_fputc #define fgets fbb_fgets #define fputs fbb_fputs #define mkdir fbb_mkdir #define rmdir fbb_rmdir #define statfs(file, buf) fbb_statfs(file, buf) #define stat(file, buf) fbb_stat(file, buf) #define access(file, mode) fbb_access(file, mode) #define findfirst fbb_findfirst #define findnext fbb_findnext #define filelength fbb_filelength #define textattr fbb_textattr #define clrscr fbb_clrscr #endif /* FBB_IO */ #define RCV_BUFFER_SIZE 1600 #define NO_MS 0 #define EMS 1 #define XMS 2 #define ECART 1000L /* Chiffre minimum pour extension N message */ #define M_LIG 4 /* Separation fenetre haut / bas */ #define MAXMEM 5000 /* Buffer plein */ #define BIDLEN 12 /* Taille du BID */ #define BIDCOMP 9 /* Taille du BID compresse */ #define MAX_FB 5 /* Nb de lignes ds fwd FBB */ #define MAX_BCL 3 /* Nb de lignes ds broadcast */ #define MAX_ERR 20 /* Nombre max d'erreurs autorisees */ #define I_COM1 0x04 /* COM1 = IRQ4 */ #define I_COM2 0x03 /* COM2 = IRQ3 */ #define F_EXC 0x0001 #define F_LOC 0x0002 #define F_EXP 0x0004 #define F_SYS 0x0008 #define F_BBS 0x0010 #define F_PAG 0x0020 #define F_GST 0x0040 #define F_MOD 0x0080 #define F_PRV 0x0100 #define F_UNP 0x0200 #define F_NEW 0x0400 #define F_PMS 0x0800 /* #define F_PWD 0x1000 */ #define F_FOR 0x00100 #define F_FBB 0x00200 #define F_HIE 0x00400 #define F_BID 0x00800 #define F_NFW 0x01000 #define F_MID 0x02000 #define F_BIN 0x04000 #define F_ACQ 0x08000 #define W_DISK 0x0001 #define W_FILE 0x0002 #define W_SERVER 0x0004 #define W_PINGPONG 0x0008 #define W_NO_ROUTE 0x0010 #define W_NO_NTS 0x0020 #define W_MESSAGE 0x0040 #define W_ERROR 0x0080 #define W_REJECT 0x0100 #define W_HOLD 0x0200 #define TYP_DED 0 #define TYP_PK 1 #define TYP_MOD 2 #define TYP_KAM 3 #define TYP_BPQ 4 #define TYP_TCP 5 #define TYP_SCK 6 #define TYP_AGW 7 #define TYP_ETH 8 #define TYP_HST 9 #define TYP_FLX 10 #define TYP_POP 11 #define NB_TYP 12 #define W_PPG 0x01 /* Ping-Pong */ #define W_ROU 0x02 /* Unknown route */ #define W_NTS 0x04 /* Unknown nts */ #define W_ASC 0x08 /* Ascii file not found */ #define W_BIN 0x10 /* Binary file not found */ #define FWD_PRIV 0x01 /* Forward only privates */ #define FWD_SMALL 0x02 /* Forward smallest first */ #define FWD_DUPES 0x04 /* Forward allowing dupes */ #define EXC(flag) (flag & F_EXC) #define LOC(flag) (flag & F_LOC) #define EXP(flag) (flag & F_EXP) #define SYS(flag) (flag & F_SYS) #define BBS(flag) (flag & F_BBS) #define PAG(flag) (flag & F_PAG) #define GST(flag) (flag & F_GST) #define MOD(flag) (flag & F_MOD) #define PRV(flag) (flag & F_PRV) #define UNP(flag) (flag & F_UNP) #define NEW(flag) (flag & F_NEW) #define PMS(flag) (flag & F_PMS) #define FBB(flag) (flag & F_FBB) #define FOR(flag) (flag & F_FOR) #define HIE(flag) (flag & F_HIE) #define BID(flag) (flag & F_BID) #define NFW(flag) (flag & F_NFW) #define MID(flag) (flag & F_MID) #define BIN(flag) (flag & F_BIN) #define ACQ(flag) (flag & F_ACQ) #define PWD(flag) (flag & F_PWD) #define P_GUEST(voie) ((voie > 0) ? ((p_port[no_port(voie)].moport & 0x01) || (svoie[voie]->localmode & 0x01)) : 0) #define P_BBS(voie) ((voie > 0) ? ((p_port[no_port(voie)].moport & 0x02) || (svoie[voie]->localmode & 0x02)) : 0) #define P_YAPP(voie) ((voie > 0) ? ((p_port[no_port(voie)].moport & 0x04) || (svoie[voie]->localmode & 0x04)) : 0) #define P_MODM(voie) ((voie > 0) ? ((p_port[no_port(voie)].moport & 0x08) || (svoie[voie]->localmode & 0x08)) : 0) #define P_GATE(voie) ((voie > 0) ? ((p_port[no_port(voie)].moport & 0x10) || (svoie[voie]->localmode & 0x10)) : 0) #define P_LIST(voie) ((voie > 0) ? ((p_port[no_port(voie)].moport & 0x20) || (svoie[voie]->localmode & 0x20)) : 0) #define P_READ(voie) ((voie > 0) ? ((p_port[no_port(voie)].moport & 0x40) || (svoie[voie]->localmode & 0x40)) : 0) #define P_TOR(voie) ((voie > 0) ? ((p_port[no_port(voie)].moport & 0x80) || (svoie[voie]->localmode & 0x80)) : 0) #define P_DIRECT 0 #define P_MODEM 3 #define P_COMBIOS 1 #define P_BPQ 2 #define P_MODEM 3 #define P_DRSI 4 #define P_TFPC 5 #define P_WINDOWS 6 #define P_ETHER 7 #define P_TFWIN 8 #define P_LINUX 9 #define BIOS(port) (p_com[(int)p_port[port].ccom].combios) #define COMBIOS(port) (p_com[(int)p_port[port].ccom].combios == P_COMBIOS) #define BPQ(port) (p_com[(int)p_port[port].ccom].combios == P_BPQ) #define DRSI(port) ((p_com[(int)p_port[port].ccom].combios == P_DRSI) || (p_com[(int)p_port[port].ccom].combios == P_TFWIN)) #define TFPC(port) (p_com[(int)p_port[port].ccom].combios == P_TFPC) #define WINDOWS(port) ((p_com[(int)p_port[port].ccom].combios == P_WINDOWS) #define ETHER(port) (p_com[(int)p_port[port].ccom].combios == P_ETHER) #define LINUX(port) (p_com[(int)p_port[port].ccom].combios == P_LINUX) #define AGW(port) ((p_com[(int)p_port[port].ccom].combios == P_WINDOWS) && (p_port[port].typort == TYP_AGW)) #define S_LINUX(port) ((LINUX(port)) && (p_port[port].typort == TYP_SCK)) #define HST(port) (p_port[port].typort == TYP_HST) #define FLX(port) (p_port[port].typort == TYP_FLX) #define POP(port) (p_port[port].typort == TYP_POP) /* Pactor */ #define IS_PACTOR(p) ((p_port[p].typort == TYP_HST) && (p_port[p].ccanal == 0)) #define ISS(p) ((p_com[(int)p_port[p].ccom].pactor_st & 0x08) ? 1 : 0) #define BUSY(p) ((p_com[(int)p_port[p].ccom].pactor_st == 247) ? 1 : 0) #define ONLINE(p) (((p_com[(int)p_port[p].ccom].pactor_st & 0x07) != 0x07) ? 1 : 0) #define PACTOR_ONLINE 1 #define PACTOR_SCAN 2 #define PACTOR_ISS 4 #define EMS_BLOC 16384 /* File number de l'EMS */ #define DIRMES 0 #define WBID 1 #define HROUTE 2 #define FORWARD 3 #define REJET 4 #define WPG 5 #define SCREEN 6 #define NB_EMS 7 /* Nombre de flags EMS */ #define EMS_NUL 0x0000 #define EMS_MSG 0x0001 #define EMS_BID 0x0002 #define EMS_HRT 0x0004 #define EMS_FWD 0x0008 #define EMS_REJ 0x0010 #define EMS_WPG 0x0040 #define EMS_SCR 0x0020 #define EMS_MSG_OK() (in_exms & EMS_MSG) #define EMS_BID_OK() (in_exms & EMS_BID) #define EMS_HRT_OK() (in_exms & EMS_HRT) #define EMS_FWD_OK() (in_exms & EMS_FWD) #define EMS_REJ_OK() (in_exms & EMS_REJ) #define EMS_SCR_OK() (in_exms & EMS_SCR) #define EMS_WPG_OK() (in_exms & EMS_WPG) #define EMS_OVR_OK() (in_exms & EMS_OVR) #define EMS_CHN_OK() (in_exms & EMS_CHN) /* Structure d'int en mode reel a travers DPMI Fonction int86real() */ typedef struct { unsigned long DI; unsigned long SI; unsigned long BP; unsigned long rs; unsigned long BX; unsigned long DX; unsigned long CX; unsigned long AX; unsigned int FL; unsigned int ES; unsigned int DS; unsigned int FS; unsigned int GS; unsigned int IP; unsigned int CS; unsigned int SP; unsigned int SS; } RSEGS; typedef struct { char ctype[4]; unsigned flag; } tp_ems; typedef struct /* Informations pour appel XMS */ { unsigned AX, /* Seuls les registres AX, BX, DX et */ BX, /* SI sont requis selon la fonction */ DX, /* appele, il faut donc une autre */ SI, /* adresse de segment */ DS; } XMSRegs; #define TRUE 1 #define FALSE 0 #define DEGRAD 57.2957795 #define LG_LANG 10 /* Taille du nom fichier langue */ #define MAXLIGNES 20 #define MAXTRAIT 180 /* Temps maximal de traitement (# 3 mn) */ #define MAXTASK 3 /* Temps maximum dans une tache longue */ #define N_MENU 0 #define N_MESS 1 #define N_QRA 2 #define N_STAT 3 #define N_INFO 4 #define N_NOMC 5 #define N_TRAJ 6 #define N_ECH 7 #define N_RBIN 8 #define N_DOS 9 #define N_GATE 10 #define N_MOD 11 #define N_BIN 12 #define N_XFWD 13 #define N_MBL 14 #define N_FORW 15 #define N_TELL 16 #define N_YAPP 17 #define N_CONF 18 #define N_MINI_EDIT 19 #define N_THEMES 20 #define NBRUB 21 /* Nb de niv1 maximum */ #define OUI 3 /* Offset du 'OUI' */ #define NON 4 /* Offset du 'NON' */ #define JOUR 5 /* Offset du jour */ #define MOIS 6 /* Offset du mois */ #define T_DEB 1 #define T_MES (T_DEB+10) /* Offset des textes dans le fichier */ #define T_QST (T_MES+14) /* Questions et messages standards */ #define T_ERR (T_QST+7) /* Messages d'erreur */ #define T_MBL (T_ERR+32) /* Rubrique emulation MBL */ #define T_TRT (T_MBL+60) /* Traitement des donnees */ #define T_MEN (T_TRT+14) /* Rubrique menu serveur */ #define T_STA (T_MEN+3) /* Rubrique statistiques */ #define T_NOM (T_STA+24) /* Rubrique Nomenclature */ #define T_TRJ (T_NOM+15) /* Rubrique Trajectographie */ #define T_QRA (T_TRJ+41) /* Rubrique Qra-Locator */ #define T_DOS (T_QRA+19) /* Rubrique FBBDOS */ #define T_INF (T_DOS+12) /* Rubrique Informations */ #define T_GAT (T_INF+4) /* Gateway */ #define T_YAP (T_GAT+13) /* Yapp transfert */ #define T_CNF (T_YAP+5) /* Conference */ #define T_THE (T_CNF+11) /* Themes */ #define NBTEXT (T_THE+2) /* Nombre de lignes de texte */ #define TNCVOIES 9 #define NBLIG 10 #define CONSOLE 0 /* #define MAXVOIES 50 / Nb de voies maximum */ #define MAXVOIES 96 /* Nb de voies maximum */ #define INEXPORT 1 /* Voie reservee a l'import/export */ #define MMONITOR (MAXVOIES) /* Affiche le monitoring */ #define ALLCHAN (MAXVOIES+1) /* Affiche tous les canaux */ #define TOTVOIES (MAXVOIES+3) /* Nb de voies total */ #define NBCOM 20 /* Nb de COMs maximum en interne */ #define NBPORT (16+1) /* Nb de ports maximum (+ console) */ #define SECONDE 19 /* Nb de ticks par seconde */ #define MAXSTAT 5000L /* echantillonnage pour les stats */ #define max_ack 4 #define PASS 0x1E #define STREAMSW 0x1D #define SENDPAC 0x1F #define TEXTE 0xFF #define CTRLZ 0x1A /* Droits sysop */ #define CONSMES 1 /* Consultation de tous les messages */ #define SUPMES 2 /* Suppression de tous les messages */ #define CMDSYS 4 /* Acces a la commande SYS */ #define COSYSOP 8 /* Fonctions cosysop : edit, forward */ #define MODLABEL 16 /* Edition des labels DOS, YAP, DOC */ #define SUPFIC 32 /* Suppression de fichiers FBBDOS, YAPP */ #define ACCGATE 64 /* Acces a tous les gateways, sauf modem */ #define EXEDOS 128 /* Execute des programmes DOS */ #define ACCESDOS 256 /* Acces a tout le repertoire du disque */ #define CMDRESET 512 /* Acces aux commandes '/R' et '/A' */ #define DOS (YELLOW + (BLACK << 4)) typedef struct FbbTimerStruct { void *userdata; void FAR (*fct) (int, void *); int port; time_t temps; struct FbbTimerStruct *next; } FbbTimer; /* #define AIDE 1 */ #define ABREG 0 #define NBMEN 10 /* nb. de rubriques par menu infos */ typedef struct THroute { char route[42]; struct THroute *suiv; } Hroute; typedef struct TWp { /* char callsign[7]; char home[7]; */ lcall callsign; lcall home; } Wp; typedef struct { int port; char from[12]; char to[12]; char via[100]; char ctl[12]; char txt[12]; int pid; int ui; } ui_header; #define MAX_BROUTE 2000 typedef struct TBloc_route { char b_route[MAX_BROUTE]; struct TBloc_route *suiv; } Broute; typedef struct { int numlang; char *plang[NBTEXT]; } tlang; typedef struct tport { char port; char canal; } sport; /* Structure de EMS/XMS */ typedef struct { long size; /* Taille du fichier memoire */ long pos; /* Position du pointeur dans le fichier */ unsigned nb_records; /* Nombre de records */ int nb; /* Nb de caracteres restants dans la page */ unsigned max_bloc; /* Nb de blocs maximum */ unsigned tot_bloc; /* Nb de blocs alloues */ unsigned num_bloc; /* Numero du bloc courant */ char *ptr; /* Pointeur de caractere */ char **alloc; /* Blocs alloues */ } Desc; /* Structure de REJET/HOLD */ typedef struct { char mode; char type; char exped[7]; char via[7]; char desti[7]; char bid[13]; int size; } Rej_rec; /* Structures fichiers WP */ typedef struct { /* 108 bytes */ long last; short local; char source; char callsign[7]; char homebbs[41]; char zip[9]; char name[13]; char qth[31]; } Wpr; typedef struct { /* 194 bytes */ char callsign[7]; char name[13]; uchar free; uchar changed; ushort seen; long last_modif __a2__; long last_seen __a2__; char first_homebbs[41]; char secnd_homebbs[41]; char first_zip[9]; char secnd_zip[9]; char first_qth[31]; char secnd_qth[31]; } Wps; /* * Structures et blocs de messages */ typedef struct { long nmess; unsigned noenr; unsigned no_indic; } mess_noeud; #define T_BLOC_MESS 100 typedef struct st_bloc_mess { mess_noeud st_mess[T_BLOC_MESS]; struct st_bloc_mess *suiv; } bloc_mess; typedef struct typ_serlist { int num_serv; char nom_serveur[7]; char com_serveur[80]; char nom_pg[80]; struct typ_serlist *suiv; } serlist; typedef struct typ_pglist { char nom_pg[10]; struct typ_pglist *suiv; } pglist; /* * Structures et blocs d'indicatifs */ typedef struct { char indic[7]; /* char lettre; */ uchar val; short nbmess; short nbnew; unsigned coord; } ind_noeud; #define T_BLOC_INFO 50 typedef struct st_bloc_indic { ind_noeud st_ind[T_BLOC_INFO]; struct st_bloc_indic *suiv; } bloc_indic; typedef struct typstat { char indcnx[6]; uchar port; uchar voie; long datcnx __a2__; short tpscnx; } statis; typedef struct typMsysop { char call[22]; struct typMsysop *next; } Msysop; typedef struct typindic { char call[7]; char num; } indicat; typedef struct typenrg { char indic[7]; char exped[7]; long date; long suite; char texte[81]; } enrg; typedef struct { indicat indic; /* 8 Callsign */ indicat relai[8]; /* 64 Digis path */ long lastmes __a2__; /* 4 Last L number */ long nbcon __a2__; /* 4 Number of connexions */ long hcon __a2__; /* 4 Last connexion date */ long lastyap __a2__; /* 4 Last YN date */ ushort flags; /* 2 Flags */ ushort on_base; /* 2 ON Base number */ uchar nbl; /* 1 Lines paging */ uchar lang; /* 1 Language */ long newbanner __a2__; /* 4 Last Banner date */ ushort download; /* 2 download size (KB) = 100 */ char free[20]; /* 20 Reserved */ char theme; /* 1 Current topic */ char nom[18]; /* 18 1st Name */ char prenom[13]; /* 13 Christian name */ char adres[61]; /* 61 Address */ char ville[31]; /* 31 City */ char teld[13]; /* 13 home phone */ char telp[13]; /* 13 modem phone */ char home[41]; /* 41 home BBS */ char qra[7]; /* 7 Qth Locator */ char priv[13]; /* 13 PRIV directory */ char filtre[7]; /* 7 LC choice filter */ char pass[13]; /* 13 Password */ char zip[9]; /* 9 Zipcode */ } info; /* Total : 360 bytes */ typedef struct { char mode; char fbid[13]; long numero __a2__; } bidfwd; typedef struct CmdList { char cmd[10]; char *action; struct CmdList *next; } cmdlist; typedef struct { indicat indic; long first __a2__; long last __a2__; ushort nb; } Heard; typedef struct typlist { bloc_mess *ptemp; unsigned offset; int l; long last; long debut; long fin; long avant; long apres; char type; char status; char route; char exp[7]; char dest[7]; char bbs[7]; char find[20]; } tlist; #define NBBBS 80 #define NBMASK NBBBS/8 typedef struct { /* Longueur = 194 octets */ char type; char status; long numero __a2__; long taille __a2__; long date __a2__; char bbsf[7]; char bbsv[41]; char exped[7]; char desti[7]; char bid[13]; char titre[61]; char bin; char free[5]; long grpnum __a2__; ushort nblu; long theme __a2__; long datesd __a2__; long datech __a2__; char fbbs[NBMASK]; char forw[NBMASK]; } bullist; typedef struct { int nbpriv, nbbul, nbkb; } atfwd; typedef struct { char type; char bin; uchar kb; char free; long nomess; long date; char fbbs[NBMASK]; char bbsv[6]; } recfwd; #define NBFWD 100 typedef struct typ_lfwd { recfwd fwd[NBFWD]; struct typ_lfwd *suite; } lfwd; typedef struct typrd_list { long nmess; int verb; bullist *pmess; struct typrd_list *suite; } rd_list; typedef struct typ_satel { char dd[18]; short y3; double d3 __a2__; short n3, h3, m3, s3; double i0 __a2__; double o0 __a2__; double e0 __a2__; double w0 __a2__; double m0 __a2__; double a0 __a2__; double n0 __a2__; double q3 __a2__; long k0 __a2__; double f1 __a2__; double v1 __a2__; short pas; long maj __a2__; long cat __a2__; /* Catalog Number - anciennement vide */ short libre[4]; } satel; typedef struct typ_date_t { double jour; int mois, annee; int heure, mn, sec; } date_t; #define DIM_IBUF 90 typedef struct typ_buflig { struct typ_buflig *suite; /* pointeur du buffer suivant */ int lgbuf; /* longueur du buffer */ char *buffer; /* buffer de caracteres */ } lbuf; typedef struct { int nblig; /* nb de lignes en buffer */ int nbcar; /* nb de caracteres en buffer */ int nocar; /* nb de caracteres deja lus dans la ligne */ char *ptr; /* pointeur du dernier caractere */ lbuf *tete; /* pointeur du premier buffer */ lbuf *curr; /* pointeur du buffer courrant */ } ibuf; #define TAILBUF 300 #define DIMBUF 300 #define DATABUF 300 typedef struct typ_cbuf { int ptr_r; /* Pointeur caracteres recus */ int ptr_l; /* Pointeur caracteres lus */ int ptr_a; /* Pointeur des caracteres affiches */ int nblig; /* nb de lignes dans le buffer */ int nbcar; /* nb de caracteres dans buffer */ int buf_vide; /* Buffer de reception vide */ int flush; /* Demande d'envoi du buffer */ char buf[DIMBUF]; /* Buffer de reception */ } cbuf; #define NB_MARQUES 10 typedef struct typ_obuf { int nb_car; int no_car; int marque[NB_MARQUES]; struct typ_obuf *suiv; char buffer[TAILBUF]; } obuf; typedef struct typ_iliste { char indic[8]; struct typ_iliste *suiv; } iliste; typedef struct { char ind[7]; unsigned pos; } tri; typedef struct typ_Forward { char reverse; /* Demande de reverse */ unsigned fwdpos; /* Index dans le fichier de forward */ unsigned lastpos; /* Index precedent dans le fichier de forward */ int fwdlig; /* Numero de ligne dans le fichier de forward */ int cptif; /* Nombre des imbrications de IF */ int forward; /* Indicateur de forward en cours et voie de forward */ int no_con; /* Numero de la connexion forward */ int no_bbs; /* No de BBS en cours de forward */ int fin_fwd; /* Fin de forward sur le canal */ char con_lig[8][80]; /* Liste des commandes de connexion */ char mesnode[4][3][20]; /* Identificateurs de connexion */ char txt_con[40]; /* Texte envoye a la connexion */ char fwdbbs[8]; /* Nom de la BBS a forwarder */ struct typ_Forward *suite; /* Voie forward suivante */ } Forward; typedef struct beacon { indicat desti; indicat digi[8]; int nb_digi; struct beacon *next; } Beacon; typedef struct list_freq { int val; double freq; char cmde[41]; struct list_freq *next; } ListFreq; #define NBHEARD 20 typedef struct port_data { char canal; char compteur; char buf[257]; int len; int cmd; struct port_data *next; } PortData; typedef struct { int pk_t; /* Taille du paquet */ int min_fwd; /* Minute de forward du port */ int per_fwd; /* Periode de forward du port */ int maxbloc; /* Taille maximum du bloc forward */ int mem; /* Taille de memoire dispo dans le TNC */ int beacon_paclen; /* Paclen de la balise du port */ int synchro; /* Mode resync */ int fd; /* Descripteur du port */ int type; /* Type de connexion AX25/NR/ROSE */ int wait[MAXVOIES]; /* Packets a lire */ long cur; /* Nb d'octets envoyes sur le port */ int nbc; /* Vitesse du port */ char stop; /* Delai d'interruption du port */ char polling; /* Polling en cours */ char idem; /* Ne change pas de canal */ char frame; /* Nombre de frames */ char ccom; /* Numero du COM (0 a 7) */ char ccanal; /* Numero du canal dans le COM (1 a 4) */ char cur_can; /* Numero du canal en cours de polling */ char last_cmde; /* Derniere commande envoyee */ char pr_voie; /* No de la 1ere voie du port */ char nb_voies; /* Nombre de voies affectees dans le port */ char tt_can; /* Dernier canal TNC du port (DRSI/BPQ) */ char pvalid; /* validation du port */ char typort; /* Type de TNC sur le port 0=DED 1=PK232 */ char moport; /* mode d'acces du port */ char transmit; /* Port en emission (TOR) */ char echo; /* Echo sur le port (Modem) */ char portbuf[300]; /* Buffer des caracteres en cours de reception */ int portind; /* Index dans le buffer */ FbbTimer *t_delay; /* Id du timer delay */ FbbTimer *t_wait; /* Id du timer wait (Pactor) */ FbbTimer *t_busy; /* If du timer busy (Pactor) */ FbbTimer *t_iss; /* If du timer iss (Pactor) */ PortData *cmd; /* Commandes/Datas a envoyer au TNC */ PortData *last; /* Derniere Commandes/Datas envoyee au TNC */ Forward *listfwd; /* liste des voies forward du port */ char freq[10]; /* frequence du port */ char name[20]; /* Name of the logical port LINUX */ char fwd[NBMASK]; /* Liste des BBS forwardees sur le port */ Heard heard[NBHEARD]; /* Jheard */ ListFreq *lfreq; /* Tete de la liste des frequences */ } defport; typedef struct { int cbase; /* Adresse de base du COM */ int combios; /* Type d'interface logiciel */ int port; /* Numero du port telnet */ long baud; /* Vitesse du port */ #ifdef __WIN32__ HANDLE comfd; /* Ident du com port (Windows) */ #else int comfd; /* Ident du com port (Windows) */ #endif int irq; /* IRQ du port (Windows) */ int delai; /* Delai avant resync */ int ovr; /* Nb d'overruns */ char mult_sel; /* Selection courante du mux */ char options; /* Options : Deuxieme set de vitesses */ char multi[8]; /* Gestion du multiplexeur */ char compteur; /* compteur pour PTC */ char name[20]; /* Name of the device LINUX */ char pactor_st; /* Status of the pactor channel */ /* int rxptr_8 ; * Pointeur caracteres recus */ /* int rxptr_h ; * Pointeur caracteres lus */ /* int txptr_8 ; * Pointeur caracteres envoyes */ /* int txptr_h ; * Pointeur caracteres ecris */ /* char rxbuf_vide ; * Buffer de reception vide */ /* char txbuf_vide ; * Buffer d'emission vide */ /* char rxbuf[DIMBUF] ; * Buffer de reception */ /* char txbuf[DIMBUF] ; * Buffer d'emission */ } defcom; #ifdef __FBBDOS__ typedef struct { char *ptr; struct text_info sav_mod; unsigned int taille; unsigned char cg; unsigned char lh; unsigned char cd; unsigned char lb; } fen; #endif typedef struct param_fwd { char chaine[80]; int type; struct param_fwd *suiv; } typ_pfwd; typedef struct ymodem_list { struct ymodem_list *next; char filename[256]; long size_trans; long time_trans; int ok; } Ylist; typedef struct { uchar voie; uchar attr; char buf[160]; } Ligne; typedef struct { int first; /* 1ere ligne du buffer allouee a l'ecran */ int totlig; /* nb de lignes du buffer */ int curlig; /* Ligne de l'affichage */ int deblig; /* Ligne debut du buffer circulaire */ int carpos; /* Pointeur du caractere courant dans la ligne */ int scrlig; /* Pointeur de la ligne scrollee */ int voie; /* Voie du buffer de ligne */ int color; /* Couleur de la ligne courrante */ char cur_buf[160]; /* Buffer de la ligne en cours */ Ligne *ligne; } FScreen; typedef struct typ_edit_ch { int record; struct typ_edit_ch *suite; } edit_ch; typedef struct { int ligne; int carac; int max; int numero; int new_t; edit_ch *liste; } typedit; #define LABEL_FIC 80 #define LABEL_NOM 40 #define LABEL_OWN 8 typedef struct typYl { int record; long date_creation; char nomfic[LABEL_FIC]; struct typYl *suiv; } Ylabel; /* typedef struct { char nomfic[LABEL_FIC] ; char label[LABEL_NOM] ; long date_creation; long free; } Rlabel ; */ typedef struct { char nomfic[LABEL_FIC]; char label[LABEL_NOM]; char owner[LABEL_OWN]; long index; long date_creation; char free[24]; } Rlabel; /* 160 bytes */ typedef struct dde_huf_struct { int voie; int mode; bullist *bull; char header[160]; struct dde_huf_struct *next; } desc_huf; #define MAX_X 25 typedef struct { int nb_bid; int ls_bid; int r_bid; int ok_chck; unsigned chck; long numero[MAX_X]; char bid[MAX_X][13]; char ok_bid[MAX_X]; } XInfo; #define NBROUTE 10 typedef struct rt { char call[NBROUTE][7]; struct rt *suite; } Route; #ifdef __WINDOWS__ typedef struct { HWND hWnd; HINSTANCE hInst; /* hInstance of application */ int valid; /* int xChar, yChar, yCharnl; character size */ int xClient, yClient; /* client window size */ int nVscrollMax, nHscrollMax; /* scroll ranges */ int nVscrollPos, nHscrollPos; /* current scroll positions */ int numlines, numcolumns; /* number of lines/column in buffer */ int nVscrollInc, nHscrollInc; /* scroll increments */ int nPageMaxLines; /* max lines on screen */ int xPos, yPos; int val; HANDLE hbuff; LPSTR lpbuff; /* HFONT hnewsfont; * handle of new fixed font */ } WINF; typedef struct scrollkeys { WORD wVirtkey; int iMessage; WORD wRequest; } SCROLLKEYS; #endif typedef struct { int connect; /* voie connectee */ int ack; /* Ack de la voie */ int ret; /* Retry de la voie */ int stat; /* Etat du TNC */ int mem; /* Taille buffer dispo */ indicat callsign; /* Indicatif de la voie */ indicat indicatif; /* Indicatif de l'OM connecte */ indicat relais[8]; /* Indicatif des relais */ } stat_ch; #define NB_P_ROUTE 8 #define NB_DEL 50 typedef struct { sport affport; /* affectation des voies */ stat_ch sta; /* Etat de la voie */ char ch_status; /* Demande d'affichage du status */ int sid; /* Un SID a ete recu */ int aut_linked; /* Commande "Linked to" autorisee */ int nb_prompt; /* Nombre de prompts a attendre */ int private_dir; /* Acces au repertoire prive */ int aut_nc; /* Autorisation du (N)ext et (C)ontinue */ int rev_mode; /* Reverse Forward en mode MBL */ int data_mode; /* Forward des data */ int maj_ok; /* Autorise la mise a jour carnet de trafic */ int fbb; /* Autorise l'utilisation du protocole FBB */ int paclen; /* Longueur du paquet */ int mess_recu; /* Message entierement recu */ int stop; /* Arret de pagination */ int memoc; /* Memoire occupee par les buffers */ int conf; /* Indication de conference */ int xferok; /* Resultat du transfert */ int binary; /* Mode de fonctionnement des entrees */ int nb_err; /* nbre d'erreurs de la voie */ int dde_int; /* Demande d'interruption */ int lignes; /* Nbre de lignes dans la page en cours */ int niv1; /* Niveau 1 de procedures */ int niv2; /* Niveau 2 de procedures */ int niv3; /* Niveau 3 de procedures */ int sniv1; /* Sauve niveau 1 de procedures */ int sniv2; /* Sauve niveau 2 de procedures */ int sniv3; /* Sauve niveau 3 de procedures */ unsigned long mode; /* Aide : TRUE */ unsigned droits; /* Droits d'acces du sysop */ unsigned short checksum; /* Checksum transfert */ unsigned prot_fwd; /* Protocoles de forward supportes */ int timout; /* Temps de time-out de la voie */ int deconnect; /* Demande de deconnexion */ int cross_connect; /* Indicateur de cross_connexion */ int send_count; /* Time out yapp */ int type_yapp; /* Type de YAPP utilise (1 = Checksum) */ int dde_marche; /* Demande de mise en marche */ int mbl; /* Mode de fonctionnement */ int kiss; /* Mode kiss : get-away */ int groupe; /* current group */ long cur_bull; /* current bulletin */ int ch_mon; /* Mode monitoring du gateway */ int temp1; int temp2; int temp3; int ind_mess; /* Indice du tableau de messages */ int t_tr; /* Indique un traitement en cours */ int seq; /* Interruption traitements longs */ int sr_mem; /* gestion de la memoire de sortie */ int log; /* autorisation de log */ unsigned no_indic; /* Numero de l'indicatif dans la liste */ unsigned warning; /* Demande de warnings */ date_t tdeb; double t_trajec; double r4; double r6; uchar msg_held; /* Messages de la voie a passer en HOLD */ uchar pack; /* Packets en cours d'emission */ uchar mbl_ext; /* Extension du forward MBL (LATER/REJECT) */ /* uchar xfwd ; Protocole XFWD identifie */ uchar ret; /* Return character seen */ uchar read_only; /* Mode d'acces read-only */ uchar vdisk; /* Numero du disque virtuel de FbbDos */ uchar reverse; /* Sens de balayage de la liste des messages */ uchar entete; /* Position dans la reception d'un message */ uchar header; /* Lignes R: recues */ uchar bbsfwd; /* numero de la bbs forwardee */ uchar maxfwd; /* taille max des messages forwardes */ uchar oldfwd; /* delai max des messages forwardes */ uchar typfwd; /* Type de messages forwardes (0 = tous) */ uchar nb_choix; /* Nombre de choix du link courant */ uchar cur_choix; /* Choix surlequel se fait le link */ uchar nb_egal; /* Nombre de messages '=' en instance */ /* uchar nb_dupes ; Nombre de messages dupliques dans bloc */ uchar m_ack; /* Demande un message d'ack */ uchar clock; /* Mise a l'heure PMS */ uchar rev_param; /* Mise a jour des parametres en reverse */ uchar cmd_new; /* Commande "new" running */ int maxbuf; /* uchar wp ; * Demande de mise a jour des "White Pages" */ double w; /* Sauvegarde longitude */ double l; /* Sauvegarde latitude */ double cumul_dist; /* Cumul de distances */ long debut; /* Heure de debut de connexion */ long tstat; /* Temps d'occupation des rubrique */ long stemps[NBRUB]; /* Temps d'occupation par rubrique */ long tmach; /* Temps machine cumule par voie */ long messdate; /* Date de creation du message */ int typlist; /* type de liste (avec / sans BID) */ int localmode; /* Mode de fonctionnement local a la voie */ long ask; /* Demande de traitement apres huffman */ long nmess; /* No du message en cours de forward */ long tailm; /* Taille du message en cours */ long size_trans; /* Taille du transfert */ long time_trans; /* Temps de transfert */ long l_mess; /* Dernier message liste par L */ long l_hold; /* Dernier message liste par RE */ long l_yapp; /* Derniere consultation du YN */ long mess_num; /* Numero original du message */ long mess_egal[NB_DEL]; /* Numero des messages reportes */ long pass_time; /* Time pour calculer le passwd MD2 */ char ch_temp[MAXPATH]; /* Stockage temporaire */ char label[MAXPATH]; /* Label du fichier en cours de reception */ char dos_path[41]; /* Path actuel du DOS */ char mess_home[41]; /* Home BBS du message */ char passwd[5]; /* Password */ char sr_fic[MAXPATH]; /* nom du fichier en cours d'emission */ char mess_bid[13]; /* nom du fichier en cours d'emission */ Ylabel *llabel; /* Liste des label YAPP */ rd_list *t_read; /* tete de la liste des messages a lire */ rd_list *t_list; /* liste des messages a lister */ tlist recliste; /* Sauvegarde contexte trait. long */ Forward *curfwd; /* Bloc courant de forward */ long noenr_menu; obuf *outptr; /* pointeur du buffer de sortie */ ibuf inbuf; /* structures de buffers reception */ char appendf[MAXPATH]; /* nom du fichier append */ char chck; /* Checksum transfert binaire */ bullist entmes; /* pointeur de la structure message */ bullist fb_mess[MAX_FB]; /* Messages en attente de forward */ char ok_mess[MAX_FB]; /* Messages en attente de com/decompression */ ind_noeud *emis; /* noeud de travail */ ind_noeud *ncur; /* noeud de la pers. connectee */ info finf; /* struct enr. fichier info */ obuf *msgtete; /* tete de message en cours d'ecriture */ long enrcur; /* enrg. du msg. en cours */ struct ffblk dirblk; /* structures DTA des directories */ typedit tete_edit; /* structure de l'editeur */ Route *r_tete; /* Tete des routes en reception message */ Route *r_curr; /* Curr des routes en reception message */ int r_pos; /* position dans le tableau */ char p_route[NB_P_ROUTE][7]; /* routes prioritaires */ Ylist *ytete; /* Tete de la liste de fichiers en batch */ typ_pfwd *ctnc; /* Init du TNC apres la connection */ void *ptemp; /* Poiteur pour applis temporaires */ unsigned psiz; /* Taille de l'alloc temporaire */ XInfo *Xfwd; /* Structure pour XForwarding */ #ifdef __LINUX__ int to_rzsz[2]; /* Pipe pour la communication avec RZ/SZ */ int to_xfbb[2]; /* Pipe pour la communication avec RZ/SZ */ int rzsz_pid; #endif #ifdef __WINDOWS__ WINF Winh; /* Informations fenetre */ #ifdef __WIN32__ HANDLE task; /* Tache en cours */ #else HTASK task; /* Tache en cours */ #endif #endif } Svoie; /* #if !defined(MAIN) */ #include "fbb_var.h" #include "fbb_dec.h" /* #endif */ #if FBB_DEBUG void debut_fonction (char *, int, char *); void fin_fonction (void); void print_fonction (FILE *); void print_history (FILE *); #define df(str,lg) debut_fonction(str, lg, MK_FP(_SS, _BP)) #define ff() fin_fonction() #else #define df(str,lg) #define ff() #endif #include #endif /* _fbb_serv */ fbb-7.04j/include/fortify.h0100644000175100017510000001052707726646105013702 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #ifndef __FORTIFY_H__ #define __FORTIFY_H__ /* * FILE: * fortify.h * * DESCRIPTION: * Header file for fortify.c - A fortified shell for malloc, realloc, * calloc & free * * WRITTEN: * spb 29/4/94 * * VERSION: * 1.0 29/4/94 */ #include #ifdef __cplusplus extern "C" { #endif typedef void (*OutputFuncPtr) (char *); void *Fortify_malloc (size_t size, char *file, unsigned long line); void *Fortify_realloc (void *ptr, size_t new_size, char *file, unsigned long line); void *Fortify_calloc (size_t num, size_t size, char *file, unsigned long line); void Fortify_free (void *uptr, char *file, unsigned long line); char *Fortify_strdup (char *str, char *file, unsigned long line); int Fortify_OutputAllMemory (char *file, unsigned long line); int Fortify_CheckAllMemory (char *file, unsigned long line); int Fortify_CheckPointer (void *uptr, char *file, unsigned long line); int Fortify_Disable (char *file, unsigned long line); int Fortify_SetMallocFailRate (int Percent); int Fortify_EnterScope (char *file, unsigned long line); int Fortify_LeaveScope (char *file, unsigned long line); int Fortify_DumpAllMemory (int scope, char *file, unsigned long line); void *Fortify_m_alloue (size_t size, char *file, unsigned long line); void Fortify_m_libere (void *uptr, unsigned int taille, char *file, unsigned long line); typedef void (*Fortify_OutputFuncPtr) (const char *); Fortify_OutputFuncPtr Fortify_SetOutputFunc (Fortify_OutputFuncPtr Output); #ifdef __cplusplus } #endif #ifndef __FORTIFY_C__ /* Only define the macros if we're NOT in fortify.c */ #ifdef FORTIFY /* Add file and line information to the fortify calls */ #define malloc(size) Fortify_malloc(size, __FILE__, __LINE__) #define realloc(ptr,new_size) Fortify_realloc(ptr, new_size, __FILE__, __LINE__) #define calloc(num,size) Fortify_calloc(num, size, __FILE__, __LINE__) #define free(ptr) Fortify_free(ptr, __FILE__, __LINE__) #define strdup(str) Fortify_strdup(str, __FILE__, __LINE__) #define m_alloue(num) Fortify_m_alloue(num, __FILE__, __LINE__) #define m_libere(ptr, num) Fortify_m_libere(ptr, num, __FILE__, __LINE__) #define Fortify_OutputAllMemory() Fortify_OutputAllMemory(__FILE__, __LINE__) #define Fortify_CheckAllMemory() Fortify_CheckAllMemory(__FILE__, __LINE__) #define Fortify_CheckPointer(ptr) Fortify_CheckPointer(ptr, __FILE__, __LINE__) #define Fortify_Disable() Fortify_Disable(__FILE__, __LINE__) #define Fortify_EnterScope() Fortify_EnterScope(__FILE__, __LINE__) #define Fortify_LeaveScope() Fortify_LeaveScope(__FILE__, __LINE__) #define Fortify_DumpAllMemory(s) Fortify_DumpAllMemory(s,__FILE__, __LINE__) #else /* FORTIFY Define the special fortify functions away to nothing */ #define Fortify_OutputAllMemory() 0 #define Fortify_CheckAllMemory() 0 #define Fortify_CheckPointer(ptr) 1 #define Fortify_Disable() 1 #define Fortify_SetOutputFunc() 0 #define Fortify_SetMallocFailRate(p) 0 #define Fortify_EnterScope() 0 #define Fortify_LeaveScope() 0 #define Fortify_DumpAllMemory(s) 0 #endif /* FORTIFY */ #endif /* __FORTIFY_C__ */ #endif /* __FORTIFY_H__ */ fbb-7.04j/include/serv.h0100644000175100017510000001006007726646105013167 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Fichier des variables locales */ #ifndef _XFBB_SERV_H #define _XFBB_SERV_H #define ENGLISH #include #include #include #define _timezone timezone #define xprintf printf #define cprintf printf #define stricmp strcasecmp #define strcmpi strcasecmp #define strnicmp strncasecmp #define strncmpi strncasecmp #define _read read #define _write write #define wsprintf sprintf #define tell(fd) lseek((fd), 0L, SEEK_CUR) #define MAXPATH 512 #define O_BINARY 0 #define O_TEXT 0100000 /* ne doit pas gener ds fcntl.h */ struct ftime { unsigned ft_tsec : 5; /* Two second interval */ unsigned ft_min : 6; /* Minutes */ unsigned ft_hour : 5; /* Hours */ unsigned ft_day : 5; /* Days */ unsigned ft_month : 4; /* Months */ unsigned ft_year : 7; /* Year */ }; #define FA_NORMAL 0x00 /* Normal file, no attributes */ #define FA_RDONLY 0x01 /* Read only attribute */ #define FA_HIDDEN 0x02 /* Hidden file */ #define FA_SYSTEM 0x04 /* System file */ #define FA_LABEL 0x08 /* Volume label */ #define FA_DIREC 0x10 /* Directory */ #define FA_ARCH 0x20 /* Archive */ #define FA_LINK 0x80 /* Lien */ #define FBB_NAMELENGTH 64 #define FBB_MASKLENGTH 64 #define FBB_BASELENGTH 256 struct ffblk { DIR *ff_dir; char ff_mask[FBB_MASKLENGTH+1]; char ff_base[FBB_BASELENGTH+1]; char ff_attrib; unsigned ff_ftime; unsigned ff_fdate; long ff_fsize; char ff_name[FBB_NAMELENGTH+1]; }; /* #define MAXPATH 80 */ #define MAXDIR 66 #define MAXFILE 9 #define MAXEXT 5 #define P_WAIT 0 #include "fbb_serv.h" /* #ifdef __cplusplus extern "C" { #endif char *strupr (char *); char *itoa(int, char*, int); char *ltoa(long, char*, int); char *ultoa(unsigned long, char*, int); char *strupr(char *); int GetFileNameDialog(char *); void InfoMessage(int, char *, char *); void FbbMem(int); int fbb_list(int); int fbb_ax25_config_load_ports(void); int fbb_nr_config_load_ports(void); int fbb_rs_config_load_ports(void); void deb_io (void); void fin_io (void); void randomize(void); int random_nb(int num); long filelength(int fd); int getdisk(void); char *getcurdir(int drive, char *str); int is_cdir(int chr); int fnsplit(char *name, char *drive, char *rep, char *base, char *ext); int getftime(int fd, struct ftime *ft); void format_ffblk(struct ffblk *blk, struct dirent *dir); int findfirst (char *rech, struct ffblk *blk, int mask); int findnext (struct ffblk *blk); unsigned long free_disk (int disk); int filter (char *ligne, char *buffer, int len, char *data); int fbb_statfs(char *filename, struct statfs *buf); #ifdef __cplusplus } #endif */ #define CM_OPTIONJUSTIF 0 #define CM_OPTIONALARM 1 #define CM_OPTIONCALL 2 #define CM_OPTIONGATEWAY 3 #define CM_OPTIONAFFICH 4 #define CM_OPTIONSOUNDB 5 #define CM_OPTIONEDIT 6 #define CM_OPTIONINEXPORT 7 #define CM_FILESCANMSG 10 #endif fbb-7.04j/include/fbb_var.h0100644000175100017510000003544607726646105013630 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #ifdef __LINUX__ #define far #endif #ifdef __FBBDOS__ extern int _wscroll; extern int directvideo; extern int errno; extern long g_timer; #endif /* Variables globales */ #ifndef PUBLIC #define PUBLIC extern #endif #ifndef MAIN extern tp_ems t_ems[NB_EMS]; #endif /*-- Variables globales ----------------------------------------------*/ #ifdef __LINUX__ PUBLIC int t_tell; /* decompteur : appel du sysop */ PUBLIC int aff_use; /* Affichage de la memoire disponible */ PUBLIC int time_bcl; /* Temps entre deux broadcast */ PUBLIC int tempo; /* decompteur : environ 18 par seconde */ PUBLIC int all_packets; /* monitoring of all packets */ #endif #ifdef __WINDOWS__ PUBLIC int t_tell; /* decompteur : appel du sysop */ PUBLIC int aff_use; /* Affichage de la memoire disponible */ PUBLIC int time_bcl; /* Temps entre deux broadcast */ PUBLIC int tempo; /* decompteur : environ 18 par seconde */ PUBLIC int win_debug; /* Affichage debug valide */ #endif #ifdef __FBBDOS__ PUBLIC void (*XMSPtr) (void); /* Pointeur sur Extended Memory Manager (XMM) */ PUBLIC unsigned XMSErr; /* Code d'erreur de la dernire opration */ PUBLIC XMSRegs Xr; PUBLIC fen *fen_dos; /* Sauvegarde fenetre DOS */ extern int far desqview; /* presence de desqview */ extern int far ton_bip; /* bip de connexion */ extern int far t_tell; /* decompteur : appel du sysop */ extern int far kam_timer; /* Temporisation du KAM */ extern int far tempo; /* decompteur : environ 18 par seconde */ extern int far time_bcl; /* Temps entre deux broadcast */ extern int far attcar; /* Tempo d'attente d'un caractere */ extern int far t_scroll; /* tempo du scroll */ extern int far aff_use; /* Affichage de la memoire disponible */ #endif PUBLIC int editor_request; /* Ask for editor */ PUBLIC int moto; /* endian mode INTEL (R) /MOTOROLA (R) */ PUBLIC unsigned tid; /* Task identifier */ PUBLIC int pactor_scan[NBPORT]; /* Scanning of pactor */ PUBLIC int watchport; /* Port for watchdog */ PUBLIC int accept_connection; /* Accepting connections */ PUBLIC int is_idle; /* No processing is done */ PUBLIC int daemon_mode; /* Indique un mode sans IHM (Linux) */ PUBLIC int EditorOff; /* Etat de l'editeur */ PUBLIC int reply; /* Reponse a un message */ PUBLIC int fast_fwd; /* Cache forward */ PUBLIC int MAXTACHE; /* Time_out de tache */ PUBLIC unsigned prot_fwd; /* Masque des protocoles de fwd */ PUBLIC unsigned w_mask; /* Masque des messages warning */ PUBLIC int debug_on; /* Flag de debuggage */ PUBLIC FILE *debug_fptr; /* Fichier */ PUBLIC char *debug_ptr; /* Pointeur de debuggage */ PUBLIC long sys_disk; /* Free KB of main disk */ PUBLIC long tmp_disk; /* Free KB of temp (BINMAIL) disk */ PUBLIC char mute_unproto; /* Suppression des sujets prives */ PUBLIC char priv_unproto; /* Autorisation unproto (P locaux) */ PUBLIC char ack_unproto; /* Autorisation unproto (ACK) */ PUBLIC char via_unproto; /* Autorisation unproto (Messages transit) */ PUBLIC unsigned std_header; /* Type de header utilise */ PUBLIC unsigned BufSeg; /* Segment reel de la memoire partagee TSR */ PUBLIC unsigned BufSel; /* Select protege de la memoire partagee TSR */ PUBLIC char *BufReel; /* pointeur du segment partage reel/protege */ PUBLIC int miniserv; /* Acces aux rubriques */ PUBLIC int deflang; /* Langue par defaut */ PUBLIC int multi_prive; /* Multi-forwarding des prives */ PUBLIC int mail_ch; /* Canal de l'import/export */ PUBLIC int def_time_bcl; /* Temps minimum entre deux listes */ PUBLIC long nb_unproto; /* Nb de messages en arriere en liste UI */ PUBLIC int dde_wp_serv; /* demande de traitement du serveur WP */ PUBLIC int nb_ovr; /* Nombre de pages de la gestion d'overlay */ PUBLIC int stop_min; /* Minute de la demande d'arret */ PUBLIC int max_yapp; /* Maximum de transfert autorise en YAPP */ PUBLIC int max_mod; /* Maximum de transfert autorise en MODEM */ PUBLIC int num_semaine; /* Numero de la semaine durant la session */ PUBLIC unsigned in_exms; /* Donnees chargees en EMS-XMS */ PUBLIC char admin[8]; /* Indicatif de l'administrateur */ PUBLIC Msysop *mess_sysop; /* Indicatifs des messages sysop */ PUBLIC int FOND_VOIE, INIT, CONS, DEF, INDIC, VOIE; PUBLIC int SEND, RECV, UI, HEADER, STA, TOUR; PUBLIC int MWARNING;; /* Voie des messages warning */ PUBLIC unsigned long mem_alloue; /* Taille de la memoire allouee */ PUBLIC unsigned long tot_mem; /* Taille du bloc disponible */ PUBLIC unsigned BLK_TO; /* Time out blankscreen */ PUBLIC unsigned blank; /* Compteur blankscreen */ PUBLIC int video_off; /* Validation ecran */ PUBLIC int test_fichiers; /* Demande le test des fichiers systeme */ PUBLIC int console; /* Presence de la console */ PUBLIC int canaff; /* Canal a d'afficher */ PUBLIC int winlig; /* Nombre de lignes de la fenetre */ PUBLIC int editor; /* Console en mode editeur */ PUBLIC int ems_aut; /* Autorise l'utilisation d'EMS */ PUBLIC int internal_int; /* Interruption interne du drsi */ PUBLIC int tf_int; /* Interruption interne du tfpcx */ PUBLIC int bpq_deconnect; /* Mode de deconnexion du BPQ */ PUBLIC int test_message; /* Procedure de test message */ PUBLIC int NBVOIES; /* Nombre de voies allouees */ PUBLIC int balbul; /* Indicatifs bulletins dans la balise */ PUBLIC unsigned def_mask; /* Masque par defaut a la 1ere connexion */ PUBLIC int niveau; /* Niveau de test dans forward */ PUBLIC int comlog; /* Log complet */ PUBLIC int msg_cons; /* Nb de messages nouveaux pour la console */ PUBLIC int hold_cons; /* Nb de messages retenus pour la console */ PUBLIC int ch_fen; /* Modification de la position des fenetres */ PUBLIC int nb_hold; /* Nombre de messages "held" */ PUBLIC int direct; /* Type d'acces a l'ecran */ PUBLIC int backscroll; /* Ecran en backscroll */ PUBLIC int doubl; /* Nb de fenetres possibles actives */ PUBLIC int cnf_prec; /* Voie du dernier qui a parle */ PUBLIC int type_sortie; /* Fin du programme (0 = Arret 1 = reboot) */ PUBLIC int save_fic; /* Demande de fin de programme */ PUBLIC int ptype; /* Type de paquet recu en protocole Yapp */ PUBLIC int nb_trait; /* Nb de caracteres a traiter */ PUBLIC int aut_ui; /* Autorise la lecture des ui */ PUBLIC int maxbbid; /* Nombre de BIDs en fichier */ PUBLIC int d_blanc; /* Dernier blanc rencontre dans la ligne */ PUBLIC int DEBUG; /* TRUE = pas d'entrees sorties vers TNC2 */ PUBLIC int fbb_fwd; /* Flag autorisation forward type FBB */ PUBLIC int bin_fwd; /* Flag autorisation forward binaire */ PUBLIC int print; /* TRUE = imprimante valide */ PUBLIC int maxlang; /* Nombre de langues disponibles */ PUBLIC int NBLANG; /* Nombre de langues statiques */ PUBLIC int lastaff; /* Derniere voie affichee */ PUBLIC int vlang; /* Numero buffer utilisee sur la voie en traitement */ PUBLIC int nlang; /* Langue utilisee sur la voie en traitement */ PUBLIC int time_n; /* Time_out pour user normal */ PUBLIC int time_b; /* Time_out pour forward */ PUBLIC int nb_error; /* Nbre d'erreurs TNC */ PUBLIC int hour_time; /* Indicateur de l'heure */ PUBLIC int new_om; /* premiere connexion */ PUBLIC int temp_sec; /* Cadence de la seconde (19 tempo) */ PUBLIC int v_tell; /* voie connectee avec le sysop. - 0 : libre */ PUBLIC int son; /* duree de la tonalite d'appel */ PUBLIC int operationnel; /* Phase d'initialisations */ PUBLIC int snd_io; /* TRUE = en entree-sortie */ PUBLIC int port; /* Numero du port RS232 en traitement */ PUBLIC short bip; /* Vrai si bip de connexion */ PUBLIC short ok_tell; /* autorisation de l'appel */ PUBLIC short ok_aff; /* affichage de l'indicatif */ PUBLIC short separe; /* position de la separation des fenetres */ PUBLIC short doub_fen; /* mode de visualisation des fenetres */ PUBLIC short gate; /* Autorisation d'utilisation du gateway */ PUBLIC short just; /* Justification de la console */ PUBLIC short sed; /* Usage du fullscreen editor */ PUBLIC short aff_inexport; /* Affichage du canal import/export */ PUBLIC short aff_popsmtp; /* Affichage du port POP/SMTP */ PUBLIC ushort p_forward; /* pointeur de mise a jour du forward */ PUBLIC int voiecur; /* voie courante */ PUBLIC int af_voie[NBLIG]; /* position de la ligne d'affichage */ PUBLIC int v_aff; /* Numero de la voie a afficher */ PUBLIC int let_prec; /* Etat d'affichage du status */ PUBLIC int arret; /* etat du serveur */ PUBLIC int stat_fwd; /* status de forwarding */ PUBLIC int trait_time; /* temps de traitement */ PUBLIC int t_balise[NBPORT]; /* temporisation balise */ PUBLIC int cmd_fct; /* touche de fonction demandee */ PUBLIC int inexport; /* Import-export de fichiers */ PUBLIC int EGA; /* Type de carte video utilise */ PUBLIC int h_screen; /* Hauteur de l'ecran */ PUBLIC int h_maint; /* Heure de maintenance */ PUBLIC int stype; /* Type d'ecran demande */ PUBLIC int max_indic; /* Nombre d'indicatifs dans la balise */ PUBLIC unsigned rinfo; /* nb. enr. INF.DAT */ PUBLIC long nb_jour_val; /* nb de jours pour bulletin valide */ PUBLIC long nomess; /* no du dernier message */ PUBLIC long nbmess; /* nb de messages en instance */ PUBLIC long t_appel; /* date de mise a jour de OPTIONS.SYS */ PUBLIC long t_bbs; /* date de mise a jour de BBS.SYS */ PUBLIC long t_rej; /* date de mise a jour de REJET.SYS */ PUBLIC long t_swap; /* date de mise a jour de SWAPP.SYS */ PUBLIC long t_thm; /* date de mise a jour de THEMES.SYS */ PUBLIC long *time_include; /* date de mise a jour de FORWARD.SYS */ PUBLIC int include_size; /* Longueur de la table FORWARD.SYS */ PUBLIC unsigned d_droits; /* droits de tous */ PUBLIC unsigned ds_droits; /* droits sysop */ PUBLIC unsigned dss_droits; /* droits sysop + cmde SYS */ PUBLIC long timeprec; /* Test des temps */ PUBLIC long stemps[NBRUB]; /* Temps d'occupation par rubrique */ PUBLIC char wp_line[258]; /* Ligne d'envoi des messages White Pages */ PUBLIC char msg_header[257]; /* Header du message */ PUBLIC char *indd; /* index du tableau data */ PUBLIC char mycall[10]; /* indicatif du serveur */ PUBLIC char mypath[40]; /* path du serveur */ PUBLIC int myssid; /* SSID du serveur */ PUBLIC char txtfwd[52]; /* texte entete forwarding */ PUBLIC char qra_locator[9]; /* Qra locator du serveur */ PUBLIC char *varx[10]; /* Variables de calcul */ PUBLIC char DATADIR[80]; /* Path des fichiers donnees du serveur */ PUBLIC char CONFDIR[80]; /* Path des fichiers conf du serveur */ PUBLIC char MESSDIR[80]; /* Path des fichiers message du serveur */ PUBLIC char MBINDIR[82]; /* Path des fichiers message binaires du serveur */ PUBLIC char PATH[NB_PATH][80]; /* Path des utilisateurs DOS */ PUBLIC char YAPPDIR[82]; /* Path des utilisateurs YAPP */ PUBLIC char DOCSDIR[82]; /* Path des Fichiers DOC */ PUBLIC char PGDIR[82]; /* Path des Programmes PG */ PUBLIC char FILTDIR[82]; /* Path des Programmes filtre */ PUBLIC char SERVDIR[82]; /* Path des Programmes serveur */ PUBLIC char TOOLDIR[82]; /* Path des Outils FWD, CRON, etc... */ PUBLIC char MAILIN[82]; /* Fichier courrier entrant */ PUBLIC char LOCK_IN[82]; /* Fichier de verrou du courrier entrant */ PUBLIC char BBS_UP[80]; /* Script BBS_UP */ PUBLIC char BBS_DW[80]; /* Script BBS_DW */ PUBLIC char my_call[7]; /* Indicatif du Sysop */ PUBLIC char my_name[80]; /* Prenom du Sysop */ PUBLIC char my_city[20]; /* Ville domicile */ PUBLIC char my_zip[10]; /* Zip du serveur */ PUBLIC char data[DATABUF + 1]; /* buffer de donnees recues */ PUBLIC char io_fich[257]; /* Nom du fichier import-export */ PUBLIC char pop_host[41]; /* Hostname for POP session */ PUBLIC char *nomlang; /* Nom des fichiers langue */ PUBLIC tlang **langue; PUBLIC char Oui; /* Caractere 'O' */ PUBLIC char Non; /* Caractere 'N' */ PUBLIC indicat cons_call; /* Indicatif de la console */ PUBLIC unsigned fwd_size; /* Taille du buffer forward */ PUBLIC char *fwd_file; /* Pointeur du buffer forward */ PUBLIC char *fwd_scan; /* Pointeur courant du buffer forward */ PUBLIC unsigned rej_size; /* Taille du buffer rejet */ PUBLIC char *rej_file; /* Pointeur du buffer rejet */ PUBLIC char *rej_scan; /* Pointeur courant du buffer rejet */ PUBLIC unsigned swap_size; /* Taille du buffer swap */ PUBLIC char *swap_file; /* Pointeur du buffer swap */ PUBLIC char *swap_scan; /* Pointeur courant du buffer swap */ PUBLIC bloc_indic *racine; /* debut de la liste d'indicatifs */ PUBLIC bloc_mess *tete_dir; /* tete de la liste de directory */ PUBLIC iliste t_iliste; /* tete de la liste des indicatifs de messages */ PUBLIC iliste *p_iliste; /* pointeur sur la liste des indic_messages */ PUBLIC pglist *tete_pg; /* Tete de la liste des pg */ PUBLIC serlist *tete_serv; /* Tete de la liste des serveurs */ PUBLIC lfwd *tete_fwd; /* tete de la liste forward */ PUBLIC ind_noeud def_cur; /* Noeud null */ PUBLIC int com_error; PUBLIC int old_com_error; PUBLIC defport *p_port; /* parametres des ports */ PUBLIC defcom *p_com; /* parametres des COMs */ PUBLIC int time_att[MAXVOIES + 1]; /* Time out des voies */ PUBLIC int time_yapp[MAXVOIES + 1]; /* Time out YAPP */ PUBLIC Hroute *throute; /* Tete de la liste des maj */ PUBLIC Broute *tbroute; /* Tete de la liste des blocs */ PUBLIC int h_ok; /* Validation HRoutes */ PUBLIC int info_ok; /* Demande obligatoire d'infos */ PUBLIC FScreen winbuf; PUBLIC FScreen conbuf; PUBLIC FScreen monbuf; PUBLIC Svoie *svoie[TOTVOIES]; /* Structures des voies */ PUBLIC Svoie *pvoie; /* Pointeur de la voie courante */ PUBLIC bullist *ptmes; /* Pointeur du message courant */ PUBLIC FILE *log_ptr; /* File ptr du log */ PUBLIC cbuf buf_kb; /* buffer clavier */ PUBLIC cbuf buf_md; /* buffer modem */ PUBLIC char *bid_ptr; /* pointeur du tableau BIDs */ PUBLIC char *bbs_ptr; /* pointeur du tableau BBSs */ PUBLIC FILE *file_prn; /* Fichier d'impression */ fbb-7.04j/include/fbb_dec.h0100644000175100017510000013456507726646105013575 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #ifdef __cplusplus extern "C" { #endif #ifdef __LINUX__ extern char *back2slash (char *); extern char *get_nextparam(void); extern char *getcurdir (int drive, char *str); extern char *GetUserInfo(char *call, int *nLen); extern char *GetMsgInfo(char *numero, int *nLen); extern char *itoa (int, char *, int); extern char *ltoa (long, char *, int); extern char *MessPath (void); extern char *slash2back (char *); extern char *ultoa (unsigned long, char *, int); extern char *StartForward(int numbbs); extern char *StopForward(int numbbs); extern char *long_filename(char *path, char *filename); extern int call_dll (char *cmd, int mode, char *buffer, int len, char *data); extern int call_nbdos (char **cmd, int nb_cmd, int mode, char *log, char *dir, char *data); extern int check_passwd (char *call, char *pass); extern int default_tty(int com); extern int DelUserInfo(char *call); extern int end_xfbb_edit (void); extern int fnsplit (char *name, char *drive, char *rep, char *base, char *ext); extern int fbb_ax25_config_load_ports (void); extern int fbb_list (int); extern int fbb_nr_config_load_ports (void); extern int fbb_rs_config_load_ports (void); extern int fbb_statfs (char *filename, struct statfs *buf); extern int findfirst (char *rech, struct ffblk *blk, int mask); extern int findnext (struct ffblk *blk); extern int filter (char *ligne, char *buffer, int len, char *data, char *xdir); extern int getdisk (void); extern int GetFileNameDialog (char *); extern int getftime (int fd, struct ftime *ft); extern int GetMsgInfos (bullist * plig, long numero); extern int GetUserInfos (char *callsign, info * frec); extern int initcom_linux (int com); extern int init_pfh (void); extern int is_cdir (int chr); extern int is_cmd (int voie); extern int linux_port (int port, int canal); extern int nbcan_linux (void); extern int NewUserInfo(char *call); extern int play (char *name); extern int PutMsgInfo(char *number, char *buf, int nLen); extern int PutUserInfo(char *call, char *buf, int nLen); extern int random_nb (int num); extern int SetMsgInfo (bullist * plig, long numero); extern int SetUserInfos (char *callsign, info * frec); extern int xfbb_edit (void); extern long filelength (int fd); extern unsigned long free_disk (int disk); extern void add_pfh(bullist *pbul); extern void AddMessageList (char *number); extern void AddPendingLine (char *call, int priv, int bull, int kb); extern void AddUserLang (char *lang); extern void AddUserList (char *callsign); extern void CloseFbbWindow (int numero); extern void CmdCHO(int port, int val); extern void CmdScan(int port, int val); extern void CompressPosition (int mode, int val, long numero); extern void console_inbuf (char *, int len); extern void deb_io (void); extern void disconnect_channel (int channel, int immediate); extern void DisplayResync (int port, int nb); extern void dump_core(void); extern void exec_cmd (cmdlist * cptr); extern void fbb_quit (unsigned retour); extern void FbbMem (int); extern void FbbRequestMessageList (void); extern void FbbRequestUserList (void); extern void FbbStatus (char *callsign, char *texte); extern void fin_io (void); extern void format_ffblk (struct ffblk *blk, struct dirent *dir); extern void InfoMessage (int, char *, char *); extern void InitText (char *); extern void justifie (unsigned char *); extern void kill_rzsz (int voie); extern void maj_menu_options (void); extern void orb_options(void); extern void orb_info(int val, char *str); extern void orb_pactor_status(int port, int p_status); extern void orb_con_list (int channel, char *ligne); extern void orb_con_nb (int nb); extern void orb_disc (void); extern void orb_nb_msg (int priv, int hold, int nbmess); extern void orb_status (long lmem, long gmem, long disk1, long disk2); extern void orb_write (int channel, char *data, int len, int color, int header); extern void pbsv (void); extern void randomize (void); extern void RequestPendingForward(char *datafile); extern void RequestMsgsList(char *datafile); extern void RequestUsersList(char *datafile); extern void reset_msgs (void); extern void set_info_channel(int channel); extern void set_win_colors (void); extern void ShowError (char *titre, char *info, int lig); extern void SpoolLine (int voie, int attr, char *data, int lg); extern void sysop_call (char *texte); extern void sysop_end (void); extern void user_status (int voie); extern void win_msg_cons (int priv, int hold); extern void win_status (char *txt); extern void WinDebug (char *fmt,...); extern void window_connect (int numero); extern void window_disconnect (int numero); extern void window_init (void); extern void window_write (int numero, char *data, int len, int color, int header); extern void WinMessage (int temps, char *text); extern void WinMSleep (unsigned milliseconds); extern void WinSleep (unsigned seconds); #endif #ifdef __WINDOWS__ /* Declarations de prototypes specifiques Windows */ extern void WinDebug (char *fmt,...); extern char *win_memo (int); extern char *xmodem_str (int voie, char *s); extern char *yapp_str (int voie, char *s); extern char *abin_str (int voie, char *s); extern char *ffwd_str (int voie, char *s); extern char *xfwd_str (int voie, char *s); extern int call_dll (char *cmd, int mode, char *buffer, int len, char *data); extern int call_nbdos (char **cmd, int nb_cmd, int mode, char *log, char *dir, char *data); extern int editor_on (void); extern int fbb_exec (char *commande); extern int fbb_list (void); extern int filter (char *ligne, char *buffer, int len, char *data); extern int GetCommStatus (int nCid); extern int get_win_lig (int numero); extern int in_comm (int port, char *buf, int nb); extern int initcom_windows (int, int, int, int); extern int out_comm (int port, char *buf, int nb); extern int tcp_busy (int voie); extern int wcprintf (char *format,...); extern int win_edit (void); extern int win_inittnc (HWND hWnd); extern int WindowService (void); extern int wputch (char carac); extern DWORD dos2rgb (int couleur); extern void AddList (int canal, char *callsign); extern void AddListFwd (int mode, char *bbs); extern void AddMessageList (char *number); extern void AddPendingLine (char *call, int priv, int bull, int kb); extern void AddUserList (char *callsign); extern void AddUserLang (char *langue); extern void closecom_windows (int); extern void CloseFbbWindow (int numero); extern void CompressPosition (int mode, int val, long numero); extern void console_inbuf (char *, int len); extern void CreateTtyWindow (HWND, HINSTANCE, int, char *, int); extern void CreateConsWindow (HWND, HINSTANCE, char *, int); extern void CreateCommWindow (HWND, HINSTANCE, int); extern void ded_init_tnc (int); extern void disconnect_channel (int channel, int immediate); extern void DisplayResync (int port, int nb); extern void end_win_edit (void); extern void EndResync (void); extern void fbb_quit (unsigned retour); extern void FbbMem (void); extern void FbbStatus (char *callsign, char *texte); extern void free_socket (int port); extern void InfoMessage (int temps, char *text, char *message); extern void init_socket (int port); extern void InitText (char *text); extern void m_libere (void *ptr, unsigned int taille); extern void maj_menu_options (void); extern void n_cpy (int longueur, char *dest, char *orig); extern void read_tnc (void); extern void ded_resynchro (int); extern void select_con (int voie); extern void send_tnc_windows (int, int); extern void SendEchoCmd (char *buf, int lg); extern void set_option (int); extern void set_win_colors (void); extern void ShowComm (void); extern void ShowError (char *titre, char *text, int val); extern void ShowMessage (unsigned int type, char *text); extern void SpoolLine (int voie, int attr, char *data, int lg); extern void strn_cpy (int longueur, char *dest, char *orig); extern void sysop_call (char *texte); extern void sysop_end (void); extern void user_status (int voie); extern void win_cree_bid (HWND); extern void win_init_bbs (HWND); extern void win_init_admin (HWND hWnd); extern void win_copyright (HWND hWnd); extern void win_cree_bid (HWND hWnd); extern void win_execute (char *buffer); extern void win_initialisations (HWND hWndParent, HINSTANCE hInstance, int cmdShow); extern void win_initexte (HWND hWnd); extern void win_initport (HWND hWnd); extern void win_msg_cons (int priv, int hold); extern void win_status (char *txt); extern void win_time_out (int temps); extern void WinDebug (char *fmt,...); extern void window_connect (int numero); extern void window_disconnect (int numero); extern void window_init (void); extern void window_write (int numero, char *data, int len, int color, int header); extern void WinMessage (int temps, char *text); extern void WinMSleep (unsigned milliseconds); extern void WinSleep (unsigned seconds); extern void WriteConsBuf (char *, int, COLORREF); extern void WriteLine (int, char *, int); #endif #ifdef __FBBDOS__ extern int call_dll (char *cmd, int mode, char *buffer, int len, char *data); extern void close_win (fen *); extern void dump_core (void); extern void end_dll (void); extern void fen_libere (fen *); extern void gettext_info (struct text_info *); extern void gettxt (int, int, int, int, void *); extern void puttext_info (struct text_info *); extern void puttxt (fen *); extern void wr_scr (FScreen *, Ligne *, int); extern Ligne *sel_scr (FScreen *, int); #endif extern atfwd *attend_fwd (int, uchar, uchar, uchar, int); extern bloc_indic *new_bloc_info (void); /* System timer management */ extern FbbTimer *add_timer (int, int, void *, void *); extern int del_timer (FbbTimer *); extern bloc_mess *last_dir (void); extern bloc_mess *new_bloc_mess (void); extern bloc_mess *prec_dir (bloc_mess *); extern bullist *ch_record (bullist *, long, char); extern char extind (char *, char *); extern char *abin_str (int voie, char *s); extern char *alt_variable (char); extern char *bbs_via (char *); extern char *ch_slash (char *); extern char *ch_slash (char *); extern char *check_dates (time_t date); extern char *comp_bid (char *); extern char *copy_name (int, char *); extern char *cr_to_lf (char *); extern char *cur_theme (int); extern char *date (void); extern char *date_mbl (long); extern char *datheure_mbl (long); extern char *dir_date (int); extern char *c_disque (char *); extern char *d_disque (char *); extern char *d_sauve (char *); extern char *d_yapp (char *); extern char *epure (char *, int); extern char *expand (char *); extern char *extend_bbs (char *); extern char *fbb_fgets (char *, int, FILE *); extern char *ffwd_str (int voie, char *s); extern char *first_group (void); extern char *get_group_info(char *nom, char *buffer); extern char *heure_mbl (long); extern char *hold_name (long, char *); extern char *idnt_fwd (void); extern char *k_var (void); extern char *lf_to_cr (char *); extern char *lfile (char *); extern char *ligne (FILE *); extern char *local_path (char *); extern char *make_header (bullist *, char *); extern char *mess_name (char *, long, char *); extern char *mk_passwd (char *chaine); extern char *mot (char *); extern char *new_bloc (int); extern char *next_group (void); extern char *nom_yapp (void); extern char *os (void); extern char *pop_date(long date); extern char *sel_bloc (int, int); extern char *snbgen (void); extern char *snbpers (void); extern char *snd_passwd (char *); extern char *stat_voie (int); extern char *strdate (long); extern char *strdt (long); extern char *strflags (info * frec); extern char *strheure (long); extern char *strjour (long); extern char *strmois (long); extern char *sup_ln (char *); extern char *task_name (int); extern char *temp_name (int, char *); extern char *titre_rubrique (int); extern char *tot_path (char *, char *); extern char *typ_exms (void); extern char *variable (char); extern char *var_txt (char *); extern char *var_crlf (char *); extern char *version (void); extern char *vir_path (char *); extern char *who (char *); extern char *xfwd_name (int voie, char *tempname); extern char *xfwd_str (int voie, char *s); extern char *xmodem_str (int voie, char *s); extern char *xuidl(long numero, char *callsign); extern char *yapp_str (int voie, char *s); #ifdef __FBBDOS__ extern fen *create_win (int, int, int, int); extern fen *fen_alloue (unsigned int); extern fen *open_win (int, int, int, int, int, char *); #endif extern FILE *cree_mess (long); extern FILE *fappend (char *, char *); extern FILE *fbb_fopen (char *, char *); extern FILE *fsopen (char *, char *); extern FILE *ouvre_dirmes (void); extern FILE *ouvre_menu_info (void); extern FILE *ouvre_mess (unsigned, long, char); extern FILE *ouvre_nomenc (void); extern FILE *ouvre_sat (void); extern FILE *ouvre_stats (void); extern float t_compute (void); extern ind_noeud *insnoeud (char *, unsigned *); extern ind_noeud *cher_noeud (char *); extern indicat *get_indic (char *); extern int accept_cnx (void); extern int ack_suiv (int); extern int actif (int); extern int addr_check (char *); extern int aff_etat (int); extern int affich_cond (info *); extern int affiche_annonce (void); extern int affiche_forward (int); extern int affiche_liste_fwd (int); extern int affiche_message (void); extern int affiche_texte_annonce (void); extern int affiche_texte_message (void); extern int affnbgen (void); extern int affnbmess (void); extern int affnbpers (void); extern int affniv (int); extern int aff_ack (int); extern int aff_bbs (char *, char *); extern int aff_nbsta (void); extern int aff_tell (int, char *); extern int aff_yapp (int); extern int already_forw (char *, int); extern int appel_pg (char *); extern int appel_rev_fwd (int); extern int appel_serveur (serlist *, bullist *); extern int attcurs (void); extern int attend_ack (int *); extern int attend_caractere (int); extern int attprompt (int, int); extern int attrib (int); extern int attrib_r (int); extern int attrib_b (int); extern int att_ligne (void); extern int att_prompt (void); extern int aut_bbs (char *); extern int aut_dir (char *, char *); extern int aut_ecr (char *, int); extern int bin_message (rd_list *); extern int bourse_echange (void); extern int bpq_appli_nb (void); extern int bpq_port (int port, int canal); extern int bpq_recv (int, char *); extern int bpq_send (int, char *, int); extern int bpq_test (char *); extern int break_annonce (void); extern int busy (char *); extern int bye (void); extern int car_tnc (int); extern int car_tx (int); extern int ch_language (int, ind_noeud *, info *); extern int chainer_annonce (void); extern int chainer_message (void); extern int check_dupes (int voie, int nb, char *exped, int tst_priv); extern int cherche_enrg_mess (char *, char *); extern int cherche_route (bullist *); extern int chercher_voie (char *); extern int ch_voie (int, int); extern int clr_bas_ecran (void); extern int clr_ind (void); extern int cls (void); extern int cls_drv (int port); extern int cmd_drv (int, int, char *); extern int commande_fwd (void); extern int commande_console (int); extern int comp_passwd (char *call, char *chaine, time_t pass_time); extern int compress_mess (bullist *); extern int con_voie (int, char *); extern int conference (void); extern int connect_console (void); extern int connect_fwd (int, Forward *); extern int connect_tell (void); extern int connect_tnc (void); extern int connect_station (int, int, char *); extern int consulte_bulletins (void); extern int consulte_rubrique (void); extern int copie (char *); extern int copie_message (long); extern int copy_mess (long, char *, char); extern int cree_annonce (void); extern int cree_fichier (char *); extern int cree_instance (void); extern int current_task (void); extern int date_valide (long, long); extern int dec_fwd (char *); extern int dec_voie (int); extern int defaut (void); extern int deja_recu (bullist *, int, int *); extern int demande_ack (int); extern int depile_prompt (void); extern int desel_voie (int); extern int desti_tous (char *); extern int dir_new (void); extern int dir_suite (char *); extern int dir_yapp (char *); extern int doc (void); extern int dpt_ind (char *); extern int droit_ok (bullist *, int); extern int droits (unsigned int); extern int droits_2 (unsigned int); extern int drsi_port (int, int); extern int hst_port (int, int); extern int port_free (int); extern int ecrit_fichier (FILE *, char *); extern int empile_prompt (int); extern int entete_annonce (void); extern int entete_liste (void); extern int entete_nouv_ann (void); extern int entete_tableau_rub (void); extern int env_buf (int, char *, int); extern int envoi (void); extern int envoi_annonce (void); extern int envoi_bulletins (void); extern int envoi_fwd (int); extern int envoi_nouv_ann (void); extern int envoyer_annonce (void); extern int envoyer_message (void); extern int error_fwd (int); extern int err_break (void); extern int err_new_fwd (int, int); extern int err_ouvert (char *); extern int err_rep (void); extern int export_message (char *); extern int fbb_access(char *filename, int mode); extern int fbb_close (int); extern int fbb_fclose (FILE *); extern int fbb_fcloseall (void); extern int fbb_fflush (FILE *); extern int fbb_fgetc (FILE *); extern int fbb_findfirst (char *chemin, struct ffblk *ffblk, int attribut); extern int fbb_findnext (struct ffblk *ffblk); extern int fbb_fprintf (FILE *, char *,...); extern int fbb_fputc (int, FILE *); extern int fbb_fputs (char *, FILE *); extern int fbb_fread (void *, size_t, size_t, FILE *); extern int fbb_free (void *, unsigned int); extern int fbb_fscanf (FILE *, char *,...); extern int fbb_fwrite (void *, size_t, size_t, FILE *); extern int fbb_read (int, void *, unsigned); extern int fbb_unlink (char *); extern int fbb_write (int, void *, unsigned); extern int fbb_stat (char *filename, struct stat *buf); extern int fbb_rmdir (char *filename); #ifdef __LINUX__ extern int fbb_mkdir (char *filename, int mode); #else extern int fbb_mkdir (char *filename); #endif #ifdef FBB_IO extern int fbb_open (char *filename, int acces, unsigned mode); #else extern int fbb_open (char *, int,...); #endif extern int fct_arret (int); extern int find (char *); extern int fin_annonce (int); extern int fin_envoi_fwd (int); extern int fin_message (int); extern int fin_trans (void); extern int find_next (struct ffblk *); extern int forward_auth (int); extern int fwd (void); extern int fwd_get (char *); extern int fwd_log (void); extern int fwd_mask (char *); extern int get_data (int); extern int get_inbuf (int); extern int get_link (int); extern int get_message (void); extern int get_mess_fwd (char, char *, int, int); extern int gmt_heure (long); extern int heure (long); extern int hiecmp (char *, char *); extern int high_memory_type (void); extern int hold (bullist *); extern int hold_kill (int); extern int hold_temp (int, char *, char *, int); extern int hupdate (void); extern int inbuf_ok (int); extern int incindd (void); extern int incondit1 (void); extern int incondit2 (void); extern int incondit3 (void); extern int incondit4 (void); extern int incondit5 (void); extern int incondit6 (void); extern int incondit7 (void); extern int incondit8 (void); extern int incondit9 (void); extern int indcmp (char *, char *); extern int ind_console (int, char *); extern int informations (void); extern int ini_bpq (int); extern int init_admin (void); extern int init_departements (void); extern int init_dpt (void); extern int init_liste_fwd (int); extern int init_liste_instance (void); extern int init_liste_rubrique (void); extern int init_pile (void); extern int init_pointeur (void); extern int init_pointeurs (void); extern int init_prompt (void); extern int init_white_pages (void); extern int initannonce (void); extern int inittnc (void); extern int initcom (void); extern int initcom_combios (int); extern int ins_liste_bbs (int, char *); extern int ins_liste_fwd (int, long, char, char *); extern int inslibr (unsigned); extern int insmess (unsigned, unsigned, long); extern int is_bid (char *); extern int is_bpq_monit (void); extern int is_dir (char *); extern int is_drsi (int); extern int is_espace (char *); extern int is_held (char *); extern int is_pactor (void); extern int is_room (void); extern int is_route (char *); extern int is_serv (char *); extern int is_wpupdate (char *); extern int iskey (void); extern int jour (long); extern int nojour (long); extern int kam_commande (int, char *); extern int kb_vide (void); extern int key (void); extern int keypressed (void); extern int lecture_annonce (void); extern int liberer_pile (void); extern int libere_buffer (struct typ_cbuf *); extern int libere_liste_fwd (int); extern int libere_liste_instance (void); extern int libere_liste_rubrique (void); extern int libere_prompt (void); extern int lig_bufi (int); extern int list_lc (void); extern int liste_bid (void); extern int liste_bulletins (void); extern int liste_dpt (void); extern int liste_message (void); extern int liste_rapide (int); extern int listind (void); extern int list_bul (int); extern int lit_ack (int); extern int lit_com_fwd (void); extern int lit_fenetre (int, char *); extern int lit_kbd (void); extern int lit_message (int, char *, char *); extern int lit_nb_dpt (void); extern int lit_port_modem (int); extern int lit_qra (void); extern int lit_relais (int, int, int); extern int lit_txt_pk (int, int); extern int littexte (void); extern int litvoie (int); extern int login (char *); extern int mail_out (char *); extern int main (int, char **); extern int maint_fwd (void); extern int maj_rubrique (void); extern int maj_with_wp (int); extern int mbl_bloc_list (void); extern int mbl_dump (void); extern int mbl_edit (void); extern int mbl_hold (void); extern int mbl_jheard (void); extern int mbl_kill (void); extern int mbl_list (void); extern int mbl_mess_read (void); extern int mbl_name (void); extern int mbl_options (void); extern int mbl_print (void); extern int mbl_read (int); extern int mbl_send (void); extern int md_busy (char *, int); extern int md_send (int, char *); extern int md_speed (int, int); extern int menu_rubriques (int); extern int menu_wp_search (void); extern int menu_yapp (void); extern int messagerie (void); extern int message_fichier (int, char *, long); extern int mess_conn (void); extern int mess_decc (void); extern int mess_fic (void); extern int mess_fin_annonce (void); extern int mess_suiv (int); extern int min_ok (int); extern int mini_edit (void); extern int minute (long); extern int modem_vide (int); extern int modif_condit (void); extern int msg_find (char *); extern int n_bbs (char *); extern int nb_ems_pages (void); extern int nbcan_bpq (void); extern int nbcan_drsi (void); extern int nbcan_hst (void); extern int nbgate (void); extern int nbl_page (int); extern int nbport (void); extern int nbull_theme (int); extern int no_canal (int); extern int no_port (int); extern int no_voie (int, int); extern int not_in_fb_mess (long, int); extern int not_in_xfwd_mess (long numero, int voie); extern int nouveau (int); extern int nouvelles_annonces (void); extern int num_bbs (char *); extern int num_voie (char *); extern int aff_ok(int); extern int opn_drv (int, int); extern int out_help (char *); extern int outfich (char *); extern int outfichs (char *); extern int ouvre (void); extern int p_cmd (void); extern int page (FILE *); extern int page_connect (char, FILE *); extern int page_doc (void); extern int page_dpt (void); extern int page_screen (int); extern int parcours_arbre (int, int); extern int part_file (char *, char *); extern int pile_vide (void); extern int pk_sonde (int, int, char *, int *); extern int pos_voie (int); extern int premier_enrg (char *); extern int print_fwd(int, unsigned char, unsigned char, unsigned char, int); extern int ptctrx (int, char *); extern int putxy (int, int, int); extern int put_annonce (void); extern int put_message (void); extern int put_ui (unsigned char *, int, int); extern int question (int); extern int quick_look (void); extern int rcv_drv (int *, int *, int *, char *, int *, ui_header *); extern int rcv_titre (void); extern int rcv_tnc (int); extern int reacheminement (void); extern int read_bid (unsigned, char *); extern int read_dir (unsigned, bullist *); extern int read_exms_string (int, char *); extern int read_only (void); extern int read_mess (int); extern int read_rej (unsigned record, Rej_rec * rej); extern int read_voie (unsigned voie, Svoie * pvoie); extern int read_wp (unsigned, Wp *); extern int rec_tnc (int); extern int recherche_message (void); extern int recoit (int, int *, char *); extern int recoit_pk (int, char *, int *); extern int redist (char *); extern int ref_ok (void); extern int rejet (bullist *); extern int rename_temp (int, char *); extern int req_cfg (char *); extern int retenu (bullist *); extern int review (void); extern int routage (long); extern int route_wp_hier (bullist *); extern int route_wp_home (bullist *); extern int rui_drv (int, char *, int *, ui_header *); extern int saisie_ref (void); extern int sauvef (int); extern int sauve_bloc (void); extern int sauve_fichiers (int); extern int scan_com_fwd (void); extern int search_bid (char *); extern int selection_rubrique (void); extern int selection_sat (void); extern int sel_option (char *, int *); extern int send_annonce (void); extern int send_bloc (int); extern int send_buf (int); extern int send_dos (int, char *, char *); extern int send_message (void); extern int send_pac (void); extern int senddata (unsigned int); extern int sendtexte (void); extern int snd_drv (int, int, char *, int, Beacon *); extern int snd_mess (int, int); extern int sortie_defaut (int); extern int sta_drv (int, int, void *); extern int step_initialisations (int); extern int status_message (void); extern int strmatch (char *, char *); extern int sui_drv (int, char *, Beacon *); extern int supp_annonce (void); extern int supp_ann_autorisee (void); extern int supp_autorisee (void); extern int supp_nomess (long, int); extern int swapp_bbs (bullist *); extern int switch_voie (int); extern int test_curseur (void); extern int test_date (char *); extern int test_desti (void); extern int test_forward (int); extern int test_heure (char *); extern int test_linked (void); extern int test_temp (int); extern int teste_espace (void); extern int teste_flag (int, ind_noeud *, int); extern int teste_rep (char *); extern int texte (int); extern int themes (void); extern int tnccar (int); extern int tncchr (int); extern int tnc_send (int, int, char *); extern int tncin (int); extern int tncprog (int, char *); extern int tps_cnx (void); extern int traite_console (void); extern int trait_ver (int, int, int); extern int tstqra (char *); extern int tst_fwd (char *, int, long, int, int *, int, int); extern int tst_passwd (char *); extern int tst_point (char *); extern int typadmin (int); extern int type_admin (int); extern int user_ok (void); extern int val_fwd (char *, int *, int); extern int validation (void); extern int via_bbs (char *); extern int vidbuf (int, int); extern int vide (int, int); extern int virt_canal (int); extern int voie_forward (int); extern int what_port (int); extern int where_exms_bid (char *); extern int wp_server (void); extern int wp_service (char *); extern int wr_nobul (long); extern int write_bid (unsigned, char *); extern int write_exms_string (int, char *); extern int write_fich (char *, char *, int); extern int write_dir (unsigned, bullist *); extern int write_mess (unsigned, long); extern int write_mess_temp (unsigned, int); extern int write_rej (unsigned record, Rej_rec * rej); extern int write_voie (unsigned voie, Svoie * pvoie); extern int write_temp (char *, int); extern int write_temp_bin (int, int); extern int write_wp (unsigned, Wp *); extern lcall call2l (char *); extern long basic_lzhuf (int mode, char *in_f, char *ou_f); extern long btime (void); extern long cherche_aide (void); extern long cherche_nomess (long); extern long copy_fic (int, int, char *); extern long date_to_pc (int d3, int n3, int y3, int h3, int m3, int s3); extern long date_to_time (char *); extern long date_to_second (struct tm *); extern long decompress (long); extern long fbb_filelength (int); extern long file_size (char *); extern unsigned long free_disk (int); extern long hour_to_time (char *); extern long lit_chiffre (int); extern long lzhuf (desc_huf *); extern long maj_date (int, char *); extern long msg_fwd_suiv (int, uchar, uchar, uchar, int); extern long next_num (void); extern long rd_nobul (void); extern long saisie_num (void); extern long supp_header (FILE *, int); extern long tell_exms_string (int); extern mess_noeud *findmess (long); extern short chdpt (char *); extern struct typ_cbuf *alloue_buffer (void); extern struct typ_lfwd *cree_bloc_fwd (struct typ_lfwd *ptr); extern unsigned chercoord (char *); extern unsigned insarbre (bullist *); extern unsigned length_dir (void); extern unsigned search_wp_record (lcall, int, unsigned); extern unsigned xms_free (void); extern unsigned char *ansi_to_ibm(unsigned char *buffer, int len); extern unsigned char *ibm_to_ansi(unsigned char *buffer, int len); unsigned short xendien (unsigned short); unsigned long xendienl (unsigned long); extern void accueil_modem (void); extern void add_heard (int, indicat *); extern void add_wp_trace (int val); extern void aff_bas (int, int, char *, int); extern void aff_chaine (int, int, int, char *); extern void aff_date (void); extern void aff_event (int, int); extern void aff_ind_console (void); extern void aff_forward (void); extern void aff_freq (void); extern void aff_header (int); extern void aff_msg_cons (void); extern void aff_rep (int); extern void aff_stations (void); extern void aff_traite (int voie, int val); extern void affich_logo (int); extern void affich_pg (int); extern void affich_serveurs (int); extern void affiche_user (info *, int); extern void aide_commandes (void); extern void alloue_screen (int); extern void analyse_idnt (char *); extern void analyse_header (int, char *); extern void appel_fwd (Forward *, int); extern int appel_serveur (serlist *, bullist *); extern void bipper (void); extern void bin_transfer (void); extern void blank_screen (void); extern void break_ok (void); extern void break_stop (void); extern void boot_prg (void); extern void broadcast_list (void); extern void cancel (char *); extern void carac_satel (void); extern void ch_bbs (int, char[NBBBS][7]); extern void ch_bit (ind_noeud *, info *, unsigned, char); extern void ch_call (void); extern void ch_info (void); extern void ch_niv1 (int); extern void ch_niv2 (int); extern void ch_niv3 (int); extern void change_dir (void); extern void change_droits (int); extern void change_scr (void); extern void check_bin (bullist *, char *); extern void chg_mess (unsigned, long); extern void choix (void); extern void clear_fwd (long); extern void clear_histo (void); extern void clear_inbuf (int); extern void clear_insert (void); extern void clear_outbuf (int); extern void close_print (void); extern void clear_queue (int voie); extern void closecom (void); extern void clr_bit_fwd (char *, int); extern void cmd_err (char *); extern void cmd_export (void); extern void cmd_import (void); extern void commande_dec (void); extern void commande_dos (char *); extern void commande_tell (void); extern void commande_tnc (void); extern void commande_visu (void); extern void compress_display (int, long, long); extern void connect_fen (void); extern void connect_log (int, char *); extern void connect_modem (int); extern void connexion (int); extern void console_off (void); extern void console_on (void); extern void copyright (void); extern void cr (void); extern void cr_cond (void); extern void create_mess (void); extern void cree_bid (void); extern void cree_dir (int); extern void cree_info (void); extern void cree_routes (void); extern void cree_sat (void); extern void cree_stat (void); extern void cron (long); extern void ctrl_z (void); extern void curoff (void); extern void curon (void); extern void curseur (void); extern void cursor (int); extern void dde_huf (int, bullist *, int); extern void dde_synchro (char *, long, int); extern void dde_warning (int); extern void dde_wp (void); extern void deb_compute (void); extern void deb_io (void); extern void debug (char *); extern void debug_mode (void); extern void debug_wp (char *); extern void dec (int, int); extern void deconnect_modem (int); extern void deconnexion (int, int); extern void del_copy (int); extern void del_file (void); extern void del_part (int, char *); extern void del_temp (int); extern void delete_bid (char *); extern void delete_exms_bid (int); extern void deroute_clavier (void); extern void deroute_erreur (void); extern void deroute_ticker (void); extern void deroute_tracker (void); extern void deroute_next_task (void); extern void deroute_vecteurs (void); extern void dir (void); extern void display_dsz_perf (int voie); extern void display_perf (int); extern void display_screen (void); extern void doc_path (void); extern void documentations (void); extern void double_fen (void); extern void dos (void); extern void droits_serv (void); extern void du (void); extern void dump_exms (void); extern void dump_screen (void); extern void duplex_tnc (void); extern void dv_beginc (void); extern void dv_endc (void); extern void dv_pause (void); extern void dv_test (void); extern void e_edit (int); extern void ecran_dos (void); extern void ega_close (void); extern void ega_open (void); extern void edit (void); extern void ems_ovr (int); extern void en_navant_toute (void); extern void end_admin (void); extern void end_arbre (void); extern void end_bbs (void); extern void end_beacon (void); extern void end_compute (void); extern void end_exms (void); extern void end_fwd (void); extern void end_hold (void); extern void end_lzhuf (void); extern void end_messages (void); extern void end_mini_edit (void); extern void end_modem (void); extern void end_parts (void); extern void end_ports (void); extern void end_pg (void); extern void end_swap (void); extern void end_textes (void); extern void end_themes (void); extern void end_voies (void); extern void end_watchdog (void); extern void end_wp (void); extern void entete_envoi_fwd (int); extern void entete_fwd (int); extern void entete_message (void); extern void entete_mess_fwd (bullist *, char *); extern void entete_saisie (void); extern void env_com_pk (int, int, char *); extern void env_com_tnc (int, int, char *); extern void env_date (void); extern void env_message (void); extern void envoi_commande (int, int, char *); extern void envoie (int, char, char *); extern void err_alloc (unsigned); extern void err_init (int); extern void exec_pg (void); extern void exms_overlay (void); extern void exped_wp (char *, char *); extern void fbb_clrscr (void); extern void fbb_error (unsigned, char *, unsigned); extern void fbb_except (unsigned, char *, unsigned); extern void fbb_log (int, char, char *); extern void fbb_printfiles (FILE *); extern void fbb_textattr (int); extern void fbb_warning (unsigned, char *, unsigned); extern void fen_bas (void); extern void fen_haut (int); extern void ferme (FILE *, int); extern void ferme_dir (void); extern void ferme_log (void); extern void fin_backscroll (void); extern void fin_io (void); extern void fin_tnc (void); extern void finentete (void); extern void flush_wp_cache (void); extern void force_deconnexion (int, int); extern void free_mem (void); extern void free_use (void); extern void fwd_cpy (recfwd *, bullist *); extern void fwd_encours (void); extern void fwd_value (char *, char *, char *); extern void get_zrpos (int); extern void header_wp (long, char *, char *, char *); extern void help (char *); extern void house_keeping (void); extern void hroute_wp (char *); extern void import_message (char *); extern void in_buf (int, char *, int); extern void indic_modem (void); extern void ini_champs (int); extern void ini_rec (Wpr *); extern void init_bbs (void); extern void init_bpq_streams (int); extern void init_buf_fwd (void); extern void init_buf_rej (void); extern void init_buf_swap (void); extern void init_debug (unsigned int); extern void init_etat (void); extern void init_exms (void); extern void init_exms_bid (FILE *); extern void init_fb_mess (int); extern void init_hold (void); extern void init_info (info *, indicat *); extern void init_kb (void); extern void init_keyboard (void); extern void init_langue (int); extern void init_modem (int); extern void init_part (void); extern void init_print (void); extern void init_rec_fwd (int); extern void init_recliste (int); extern void init_screen (char *, int, int); extern void init_semaine (void); extern void init_serveur (char *, int); extern void init_space (char *, int, int); extern void init_task (void); extern void init_timout (int); extern void init_voie (int); extern void init_watchdog(int val); extern void init_wp (void); extern void init_wp_cache (void); extern void initialisations (void); extern void initport (void); extern void initexte (void); extern void inputs (int, int, char *); extern void ins_fwd (bullist *); extern void ins_iliste (bullist *); extern void inscoord (unsigned, info *, ind_noeud *); extern void int14real (RSEGS *); extern void int86real (int, RSEGS *); extern void interruption (int); extern void io (void); extern void j_list (char); extern void k_tasks (void); extern void kernel (void); extern void kill_message (char *); extern void libere (int); extern void libere_bid (void); extern void libere_bid_exms (void); extern void libere_edit (int); extern void libere_xems (void); extern void libere_label (int); extern void libere_route (int); extern void libere_serveurs (void); extern void libere_tlist (int); extern void libere_tnc (typ_pfwd **); extern void libere_tread (int); extern void libere_ymodem (int, int); extern void libere_zones_allouees (int); extern void limite_commande (void); extern void list (void); extern void list_held (void); extern void list_messages (int, unsigned, int); extern void list_new (char *); extern void list_read (int); extern void liste_cnx (void); extern void liste_indic (void); extern void liste_label (void); extern void lit_appel (void); extern void lit_sat (satel *); extern void load_dirmes (void); extern void load_themes (void); extern void lonlat (char *, double *, double *); extern void m_libere (void *, unsigned int); extern void mail_in (void); extern void maintenance (void); extern void maj_fen (void); extern void maj_fwd (void); extern void maj_niv (int, int, int); extern void maj_options (void); extern void maj_rec (long, bullist *); extern void majinfo (int, int); extern void majfich (int); extern void make_bid (void); extern void make_dir (void); extern void mark_fwd (int voie, char mode); extern void mark_reverse_bid (bullist *, int, int *); extern void marque_obuf (void); extern void MD5String (unsigned char *dest, unsigned char *source); extern void mbl_disbul (void); extern void mbl_emul (void); extern void mbl_info (void); extern void mbl_passwd (void); extern void mbl_stat (void); extern void mbl_tell (void); extern void md_defaut (int); extern void md_echo (int); extern void md_inbuf (int, char *, int); extern void md_no_echo (int); extern void md_reset (int); extern void mess_liste (int); extern void menu_principal (void); extern void menu_sat (void); extern void menu_trajec (void); extern void mess_warning (char *, char *, char *); extern void mod_part (char *, long, char *); extern void modem (void); extern void modem_no_echo (int); extern void modem_start (int); extern void modem_stop (int); extern void modif_bloc (void); extern void modif_satel (void); extern void monitor (int, char *, int); extern void music (int); extern void my_exception (void); extern void n_cpy (int, char *, char *); extern void new_fwd (void); extern void new_label (void); extern void nomenclature (void); extern void old_part (char *, char *); extern void options (void); extern void outs (char *, int); extern void out (char *, int); extern void out_txt (void); extern void outsln (char *, int); extern void outln (char *, int); extern void ouvre_dir (void); extern void ouvre_ecran (void); extern void ouvre_log (void); extern void p_debug (int, char *); extern void paclen_change (int, int, char *); extern void param_satel (void); extern void param_tnc (int, typ_pfwd **, char *); extern void part_recu (bullist *, int, int *); extern void passwd_change (void); extern void passwd_modem (void); extern void pk_commande (int, char *); extern void pk_ui (int, char *); extern void port_log (int, int, char, char *); extern void premier_niveau (void); extern void print_part (void); extern void print_stack (unsigned int, FILE *); extern void print_tasks (void); extern void prog_modem (void); extern void prog_more (int); extern void prog_rev_tnc (int); extern void program_fwd (int, int, typ_pfwd **, int); extern void program_tnc (int, char *); extern void programm_indic (int); extern void prompt (int, int); extern void prompt_dos (void); extern void put_mess_fwd (char); extern void put_nr (unsigned char *, int, int); extern void put_rose (unsigned char *, int, int); extern void q_mark (void); extern void qraloc (void); extern void rcv_rev_fwd (void); extern void re_init_modem (int); extern void read_heard (void); extern void receive_file (void); extern void remet_clavier (void); extern void remet_erreur (void); extern void remet_ticker (void); extern void remet_tracker (void); extern void remet_next_task (void); extern void remet_bloc (int); extern void remet_vecteurs (void); extern void remove_dir (void); extern void retour_appel (void); extern void retour_dir (char); extern void set_bs (int voie, int val); extern void retour_dos (void); extern void retour_mbl (void); extern void retour_menu (int); extern void retour_niveau (void); extern void rewind_fwd (void); extern void saisie_infos (void); extern void scan_fwd (int val); extern void seek_exms_string (int, long); extern void selcanal (int); extern void selvoie (int); extern void send_balise (int); extern void send_bin_message (void); extern void send_binary_mess (void); extern void send_copy (void); extern void send_file (int); extern void send_list(int); extern void send_reply (void); extern void send_tnc (int, int); extern void send_wp_mess (void); extern void sendeot (unsigned char); extern void set_binary (int, int); extern void set_bit_fwd (char *, int); extern void set_busy (void); extern void set_call (char *, char *, char, int); extern void set_link (int, int); extern void sleep_ (unsigned int); extern void sortie (void); extern void sortie_prg (void); extern void start_tasks (void); extern void stat_conn (void); extern void stat_yapp (void); extern void statistiques (void); extern void status (int); extern void stop_scan_fwd (void); extern void stop_main_task (void); extern void strn_cpy (int, char *, char *); extern void sup_fwd (long, int, uchar); extern void supp_env_binaire (int); extern void supp_fich (FILE *, long); extern void supp_mess (long); extern void swap_langue (int, int); extern void swap_port (char *); extern void t_label (void); extern void test_buf_fwd (void); extern void test_disque (void); extern void test_kb (void); extern void test_pactor(int); extern void tester_masque (void); extern void text_conf (int); extern void text_cpy (char *, char *); extern void tnc_commande (int, char *, int); extern void tnc_s (int, int, char *); extern void tncout (int, int); extern void tncstr (int, char *, int); extern void tor_disc (int); extern void tor_stop (int); extern void tor_start (int); extern void trait (int, char *); extern void trait_hor (int); extern void traite_commande (int, char *, int); extern void traite_data (int, char *, int); extern void traite_voie (int); extern void trajec (void); extern void trajecto (void); extern void tst_ack (bullist *); extern void tst_appel (void); extern void tst_exms_bid (bullist *, int, int *); extern void tst_serveur (bullist *); extern void tst_sysop (char *, long); extern void tst_warning (bullist *); extern void user_time_out (void); extern void valide_themes (unsigned, int, bullist *); extern void valmess (bullist *); extern void var_cpy (int, char *); extern void w_bid (void); extern void w_label (char *, char *); extern void watchdog(void); extern void while_space (void); extern void win_message (int, char *); extern void winputs (int, int, char *); extern void user_wp (info *); extern void wp_message (Wpr *); extern void wp_read_mess (bullist *); extern void wp_search (void); extern void wp_upd (Wpr *, int); extern void wr_dir (char *, char *); extern void wreq_cfg (FILE * fptr); extern void write_capture (char *, int len); extern void write_error (char *); extern void write_heard (void); extern void xmodem (void); extern void xmodem_mode (int, int); extern void xfwd (void); extern void yapp (void); extern void yapp_message (int); extern void zero_tic (void); extern void XMSCall (void); extern void *m_alloue (unsigned int); extern Wps *wp_find (char *, int); #ifdef __cplusplus } /* extern "C" */ #endif fbb-7.04j/include/version.h0100644000175100017510000000223207726653454013704 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #define MAJEUR 7 #define MINEUR 04 #define LETTRE 'j' /* "pre" versions */ /* #define PRE 3 */ fbb-7.04j/include/fmtheaders.h0100644000175100017510000000570607726646105014345 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #ifndef _FMTHEADERS_H #define _FMTHEADERS_H 1 #include /* Definitions for .VOC files */ #define MAGIC_STRING "Creative Voice File\0x1A" #define ACTUAL_VERSION 0x010A #define VOC_SAMPLESIZE 8 #define MODE_MONO 0 #define MODE_STEREO 1 #define DATALEN(bp) ((u_long)(bp->datalen) | \ ((u_long)(bp->datalen_m) << 8) | \ ((u_long)(bp->datalen_h) << 16) ) typedef struct _vocheader { u_char magic[20]; /* must be MAGIC_STRING */ u_short headerlen; /* Headerlength, should be 0x1A */ u_short version; /* VOC-file version */ u_short coded_ver; /* 0x1233-version */ } VocHeader; typedef struct _blocktype { u_char type; u_char datalen; /* low-byte */ u_char datalen_m; /* medium-byte */ u_char datalen_h; /* high-byte */ } BlockType; typedef struct _voice_data { u_char tc; u_char pack; } Voice_data; typedef struct _ext_block { u_short tc; u_char pack; u_char mode; } Ext_Block; /* Definitions for Microsoft WAVE format */ #define RIFF 0x46464952 #define WAVE 0x45564157 #define FMT 0x20746D66 #define DATA 0x61746164 #define PCM_CODE 1 #define WAVE_MONO 1 #define WAVE_STEREO 2 /* it's in chunks like .voc and AMIGA iff, but my source say there are in only in this combination, so I combined them in one header; it works on all WAVE-file I have */ typedef struct _waveheader { u_long main_chunk; /* 'RIFF' */ u_long length; /* filelen */ u_long chunk_type; /* 'WAVE' */ u_long sub_chunk; /* 'fmt ' */ u_long sc_len; /* length of sub_chunk, =16 */ u_short format; /* should be 1 for PCM-code */ u_short modus; /* 1 Mono, 2 Stereo */ u_long sample_fq; /* frequence of sample */ u_long byte_p_sec; u_short byte_p_spl; /* samplesize; 1 or 2 bytes */ u_short bit_p_spl; /* 8, 12 or 16 bit */ u_long data_chunk; /* 'data' */ u_long data_length; /* samplecount */ } WaveHeader; #endif fbb-7.04j/include/yapp.h0100644000175100017510000000354207726646105013170 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #define UK 0 #define RR 1 #define RF 2 #define SI 3 #define HD 4 #define DT 5 #define EF 6 #define ET 7 #define NR 8 #define CN 9 #define CA 10 #define RI 11 #define TX 12 #define TM 13 #define AF 14 #define AT 15 #define SN 16 /* Envoie la suite des datas */ #define NUL 0 #define SOH 1 #define STX 2 #define ETX 3 #define EOT 4 #define ENQ 5 #define ACK 6 #define DLE 16 #define NAK 21 #define CAN 24 #define SA 99 /* start */ #define S 0 #define S1 1 #define SH 2 #define SD 3 #define SE 4 #define ST 5 #define R 6 #define RH 7 #define RD 8 #define AB 9 /* abort */ #define CW 10 #define C 11 #define DP 12 /* Etats transitoires */ #define E1 13 #define E2 14 #define E3 15 #define E4 16 #define E5 17 #define E6 18 #define RP 19 /* Reprise de l'envoi */ fbb-7.04j/include/modem.h0100644000175100017510000000451007726646105013314 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* Extensions au driver WINDOWS comm.drv */ #define SETECHO 12 #define CLRECHO 13 #define SETSTAR 14 #define INQUE 16384 #define OUTQUE 16384 #define INT14 0x14 /* Emission */ #define XS_INIT 0 #define XS_SEND 1 #define XS_WAIT 2 #define XS_END 3 #define XS_QUEUE 10 #define XS_EXTERN 11 /* Reception */ #define XR_INIT 4 #define XR_LABL 5 #define XR_RECV 6 #define XR_END 7 #define XR_EXTERN 12 /* Communes */ #define XM_ABORT 8 /* Zmodem */ #define ZS_FILE 9 /* Constantes */ #define NUL 0 #define SOH 1 #define EOT 4 #define ACK 6 #define NAK 21 #define CAN 24 /* Macros */ #define xmodem_off(voie) xmodem_mode(0x00, voie) #define xmodem_tx_on(voie) xmodem_mode(0x01, voie) #define xmodem_rx_on(voie) xmodem_mode(0x02, voie) #define xmodem_fin(voie) xmodem_mode(0x04, voie) #define xmodem_tx_1k(voie) xmodem_mode(0x05, voie) #define ymodem_tx_on(voie, type) xmodem_mode((type) ? 0x07 : 0x06, voie) /* Constantes ZModem */ #define ZRQINIT 0 #define ZRINIT 1 #define ZSINIT 2 #define ZACK 3 #define ZFILE 4 #define ZSKIP 5 #define ZNAK 6 #define ZABORT 7 #define ZFIN 8 #define ZRPOS 9 #define ZDATA 10 #define ZEOF 11 #define ZFERR 12 #define ZCRC 13 #define ZCHALL 14 #define ZCOMPL 15 #define ZCAN 16 #define ZFREEC 17 #define ZCOMM 18 #define ZSTDERR 19 fbb-7.04j/include/fbb_drv.h0100644000175100017510000000731607726646105013626 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Declaration des fonctions drivers */ #define STA_DRV 0 #define SND_DRV 1 #define RCV_DRV 2 #define OPN_DRV 3 #define CLS_DRV 4 #define TYP_DRV 5 /* * Drivers WA8DED */ int sta_ded (int, int, int, void *); int snd_ded (int, int, int, char *, int, Beacon *); int rcv_ded (int *, int *, int *, char *, int *, ui_header *); int opn_ded (int, int); int cls_ded (int); /* * Drivers PK232 */ int sta_aea (int, int, int, void *); int snd_aea (int, int, int, char *, int, Beacon *); int rcv_aea (int *, int *, int *, char *, int *, ui_header *); /* * Drivers BPQ */ int sta_bpq (int, int, int, void *); int snd_bpq (int, int, int, char *, int, Beacon *); int rcv_bpq (int *, int *, int *, char *, int *, ui_header *); /* * Drivers KAM */ int sta_kam (int, int, int, void *); int snd_kam (int, int, int, char *, int, Beacon *); int rcv_kam (int *, int *, int *, char *, int *, ui_header *); /* * Drivers MODEM */ int sta_mod (int, int, int, void *); int snd_mod (int, int, int, char *, int, Beacon *); /* * Drivers TCP */ #if defined(__WINDOWS__) int sta_tcp (int, int, int, void *); int snd_tcp (int, int, int, char *, int, Beacon *); int rcv_tcp (int *, int *, int *, char *, int *, ui_header *); #elif defined(__LINUX__) int sta_tcp (int, int, int, void *); int snd_tcp (int, int, int, char *, int, Beacon *); int rcv_tcp (int *, int *, int *, char *, int *, ui_header *); int opn_tcp (int, int); int cls_tcp (int); #endif /* * Drivers SOCKET */ #ifdef __LINUX__ int sta_sck (int, int, int, void *); int snd_sck (int, int, int, char *, int, Beacon *); int rcv_sck (int *, int *, int *, char *, int *, ui_header *); int opn_sck (int, int); int cls_sck (int); #endif /* * Drivers AGW */ #ifdef __WINDOWS__ int sta_agw (int, int, int, void *); int snd_agw (int, int, int, char *, int, Beacon *); int rcv_agw (int *, int *, int *, char *, int *, ui_header *); int opn_agw (int, int); int cls_agw (int); #endif /* * Drivers HostMode PTC-II */ int sta_hst (int, int, int, void *); int snd_hst (int, int, int, char *, int, Beacon *); int rcv_hst (int *, int *, int *, char *, int *, ui_header *); int opn_hst (int, int); int cls_hst (int); /* * Drivers Flexnet */ #if defined(__WINDOWS__) || defined(__FBBDOS__) int sta_flx (int, int, int, void *); int snd_flx (int, int, int, char *, int, Beacon *); int rcv_flx (int *, int *, int *, char *, int *, ui_header *); int opn_flx (int, int); int cls_flx (int); #endif /* * Drivers POP */ #if defined(__LINUX__) int sta_pop (int, int, int, void *); int snd_pop (int, int, int, char *, int, Beacon *); int rcv_pop (int *, int *, int *, char *, int *, ui_header *); int opn_pop (int, int); int cls_pop (int); #endif fbb-7.04j/include/crc.h0100644000175100017510000001025107726646105012761 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* crctab calculated by Mark G. Mendel, Network Systems Corporation */ static unsigned short crctab[256] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 }; /* * updcrc macro derived from article Copyright (C) 1986 Stephen Satchell. * NOTE: First srgument must be in range 0 to 255. * Second argument is referenced twice. * * Programmers may incorporate any or all code into their programs, * giving proper credit within the source. Publication of the * source routines is permitted so long as proper credit is given * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, * Omen Technology. */ /* #define updcrc(cp, crc) ( crctab[((crc >> 8) & 255)] ^ (crc << 8) ^ cp) */ #define updcrc(cp, crc) ((crc << 8) ^ crctab[(cp & 0xff) ^ (crc >> 8)]) fbb-7.04j/include/global.h0100644000175100017510000000350407726646105013455 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* GLOBAL.H - RSAREF types and constants */ /* PROTOTYPES should be set to one if and only if the compiler supports function argument prototyping. The following makes PROTOTYPES default to 0 if it has not already been defined with C compiler flags. */ #ifndef PROTOTYPES #define PROTOTYPES 0 #endif /* POINTER defines a generic pointer type */ typedef unsigned char *POINTER; /* UINT2 defines a two byte word */ typedef unsigned short int UINT2; /* UINT4 defines a four byte word */ typedef unsigned long int UINT4; /* PROTO_LIST is defined depending on how PROTOTYPES is defined above. If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it returns an empty list. */ #if PROTOTYPES #define PROTO_LIST(list) list #else #define PROTO_LIST(list) () #endif fbb-7.04j/include/md5.h0100644000175100017510000000457507726646105012713 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* MD5.H - header file for MD5C.C */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ /* MD5 context. */ typedef struct { UINT4 state[4]; /* state (ABCD) */ UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ } MD5_CTX; void MD5Init PROTO_LIST ((MD5_CTX *)); void MD5Update PROTO_LIST ((MD5_CTX *, unsigned char *, unsigned int)); void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); fbb-7.04j/include/pbsv.h0100644000175100017510000000472007726646105013170 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* pbsv.h 1993.8.6 */ #define DEBUG 1 #define PBSV_VER "0.04" #define PBSV_ID "[930806]" typedef int VOID; typedef int BOOL; typedef int TINY; #define OK 1 #define NG 0 #define ON 1 #define OFF 0 #define NOT_DEFINE (-1) #define MAXUSER 20 #define MAXHOLE 100 #define MAXPFHDIR 16384 #define MAXBLKSIZE 244 #define ADRSIZE 7 /* adrs length */ #define CALLSIZE 10 #define HDRSIZE (1+7+7+1+1) #define FRMSIZE 2048 #define F_DIR 0x0001 extern unsigned short calc_crc(unsigned char c, unsigned short crc); struct stqcell { struct stqcell *next; }; struct stqueue { struct stqcell *head; struct stqcell *tail; }; struct sthole { struct sthole *next; long offset; ushort length; time_t start; time_t end; }; struct stuser { struct stuser *next; time_t entry_t; ushort flags; char call[CALLSIZE]; int file_type; long file_id; ushort block_size; long file_size; struct stqueue hole; }; struct stpfhdir { time_t t_old; time_t t_new; long file_id; int pfh_type; /* int pfh_size; */ }; struct stpfh { u_long file_number; char file_name[8]; char file_ext[3]; u_long file_size; u_long create_time; u_long last_modied_time; u_char seu_flag; u_char file_type; ushort body_checksum; ushort header_cecksum; ushort body_offset; ushort pfh_size; }; /* pbsv.h */ fbb-7.04j/include/xfbb.h0100644000175100017510000001250507726646105013137 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Fichier des variables locales */ #define ENGLISH #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define IDOK 1 #define IDCANCEL 0 #define IDYES 1 #define IDNO 2 #define MB_OK 0x0000 #define MB_OKCANCEL 0x0001 #define MB_YESNOCANCEL 0x0003 #define MB_YESNO 0x0004 #define MB_ICONHAND 0x0010 #define MB_ICONQUESTION 0x0020 #define MB_ICONEXCLAMATION 0x0030 #define MB_ICONASTERISK 0x0040 #define MB_ICONINFORMATION MB_ICONASTERISK #define ED_MESSAGE 1 #define ED_EDITMSG 2 #define SEPARATOR 0 #define BUTTON 1 #define TOGGLE 2 #define TOOLBUTTON 3 #ifndef PUBLIC #define PUBLIC extern #endif PUBLIC XtAppContext app_context; PUBLIC XmRendition r_rend[10]; PUBLIC int r_index; PUBLIC FILE *p_fptr; PUBLIC Pixel df_pixel; PUBLIC Pixel rf_pixel; PUBLIC Pixel vf_pixel; PUBLIC Pixel bf_pixel; PUBLIC Pixel no_pixel; PUBLIC Pixel rc_pixel; PUBLIC Pixel vc_pixel; PUBLIC Pixel bc_pixel; PUBLIC Widget toplevel; PUBLIC Widget form; PUBLIC Widget pb; PUBLIC Widget MenuBar; PUBLIC Widget MenuFile; PUBLIC Widget MenuUser; PUBLIC Widget MenuEdit; PUBLIC Widget MenuWindow; PUBLIC Widget MenuOptions; PUBLIC Widget MenuConfig; PUBLIC Widget MenuPactor; PUBLIC Widget MenuHelp; PUBLIC Widget ToolBar; PUBLIC Widget Jauge; PUBLIC Widget ListForm; PUBLIC Widget ConnectLabel; PUBLIC Widget StatForm; PUBLIC Widget StatusLabel; PUBLIC Widget ConnectList; PUBLIC Widget ConnectString; PUBLIC Widget StatList; PUBLIC Widget Footer; PUBLIC int foothelp; PUBLIC int editoron; #define NB_ICON 16 PUBLIC Widget BIcon[NB_ICON]; #define NB_INIT_B 11 PUBLIC Widget Tb[NB_INIT_B]; PUBLIC Widget ScanSys; PUBLIC Widget ScanMsg; /* Liste des widgets de status */ PUBLIC Widget TxtUsed; PUBLIC Widget TxtGMem; PUBLIC Widget TxtDisk1; PUBLIC Widget TxtDisk2; PUBLIC Widget TxtMsgs; PUBLIC Widget TxtResync; PUBLIC Widget TxtState; PUBLIC Widget TxtHold; PUBLIC Widget TxtPriv; PUBLIC Widget Used; PUBLIC Widget GMem; PUBLIC Widget Disk1; PUBLIC Widget Disk2; PUBLIC Widget Msgs; PUBLIC Widget Resync; PUBLIC Widget State; PUBLIC Widget Hold; PUBLIC Widget Priv; PUBLIC Widget Popup; PUBLIC Widget Opt[10]; #define NB_PITEM 5 PUBLIC Widget PItem[NB_PITEM]; PUBLIC int CurrentSelection; int can_talk (int); int editor_on (void); int GetChList(void); int MessageBox(int, char *, char *, int); int record_message (char *ptr, int len); int set_callsign (char *buf); int SetChList(int clean); int talk_to (int channel); void CreateEditor(char *, char *, char *, int, int); void cursor_wait(void); void disconnect_channel(int, int); void end_edit (int); void end_wait(void); void FbbRequestUserList (void); void FbbSync (void); void EditMsgCB(Widget, XtPointer, XtPointer); void EditUsrCB(Widget, XtPointer, XtPointer); void get_callsign (char *buf); void ListCnxCB(Widget, XtPointer, XtPointer); void PendingCB(Widget, XtPointer, XtPointer); void set_option (int, int); void TextFieldGetString(Widget w, char *str, int len, int upcase); void HideFbbWindow(int numero, Widget parent); void AboutDialog(Widget, XtPointer, XtPointer); void CopyDialog(Widget, XtPointer, XtPointer); void InfoDialog(Widget, XtPointer, XtPointer); void CallsignDialog(Widget, XtPointer, XtPointer); void EditMessage(Widget); void EditUser(Widget); void ListCnx(Widget); void OptionsCB(Widget w, XtPointer client_data, XtPointer call_data); void PendingForward(Widget); void LabelSetString(Widget, char *, char *); void ScanMsgCB (Widget w, XtPointer client_data, XtPointer call_data); void ShowFbbWindow(int, Widget); void sysop_end(void); void TalkToCB (Widget w, XtPointer client_data, XtPointer call_data); void ToggleFbbWindow(int numero, Widget parent); void DisplayInfoDialog(int); void CreateEditor(char *file, char *preload, char *title, int options, int autow); Widget add_item(int type, Widget menu_pane, char *nom, XtPointer callback, XtPointer data, char *help, XtPointer HelpCB); fbb-7.04j/include/xfbbX.h0100644000175100017510000000706407726646105013273 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Fichier des variables locales */ #define ENGLISH #ifdef __MAIN__ #define PUBLIC #else #define PUBLIC extern #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define MB_OK 0x0000 #define MB_OKCANCEL 0x0001 #define MB_YESNOCANCEL 0x0003 #define MB_YESNO 0x0004 #define MB_ICONHAND 0x0010 #define MB_ICONQUESTION 0x0020 #define MB_ICONEXCLAMATION 0x0030 #define MB_ICONASTERISK 0x0040 #define MB_ICONINFORMATION MB_ICONASTERISK #define FBB_MSGS 1 #define FBB_STATUS 2 #define FBB_NBCNX 4 #define FBB_LISTCNX 8 #define FBB_MONITOR 16 #define FBB_CONSOLE 32 #define FBB_CHANNEL 64 #define FBB_XFBBX 128 #define CONSOLE 0 #define MONITOR 1 #define ALLCHAN 2 #define MAX_CONF 4 #define MAXFEN 3 typedef struct { char name[80]; char mycall[80]; char host[80]; char pass[256]; int port; int mask; } conf_t; PUBLIC Display *display; PUBLIC conf_t conf[MAX_CONF]; PUBLIC unsigned curconf; PUBLIC Widget Rmt[MAX_CONF]; PUBLIC Widget toplevel; PUBLIC int fenetre[MAXFEN]; PUBLIC int CurrentSelection; #ifdef __cplusplus extern "C" { #endif /* xfbbX.c */ extern int close_connection (void); extern int console_input (char *, int); extern int init_orb (char *); extern int MessageBox (int, char *, char *, int); extern void Caption (int); extern void LabelSetString (Widget, char *, char *); /* xfbbXcnsl.c */ extern void AllChanCB (Widget, XtPointer, XtPointer); extern void ConsoleCB (Widget, XtPointer, XtPointer); extern void HideFbbWindow (int numero, Widget parent); extern void MonitorCB (Widget, XtPointer, XtPointer); extern void set_win_colors (void); extern void ShowFbbWindow (int, Widget); extern void sysop_end (void); extern void window_init (void); extern void window_write (int, char *, int, int, int); /* xfbbXabtd.c */ extern int GetConfig (void); extern int PutConfig (void); extern void AboutDialog (Widget, XtPointer, XtPointer); extern void CallsignDialog (Widget, XtPointer, XtPointer); extern void CopyDialog (Widget, XtPointer, XtPointer); extern void SetupDialog (Widget, XtPointer, XtPointer); #ifdef __cplusplus } #endif fbb-7.04j/include/fbb.xbm0100755000175100017510000000301707726646105013307 0ustar abaaba#define fbb_width 48 #define fbb_height 48 static char fbb_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xff,0xff, 0xe3,0xff,0x7f,0xf8,0xff,0xff,0xe3,0xff,0x7f,0xf8,0xff,0xff,0xe3,0xff,0x7f, 0xe0,0x0f,0xe0,0x03,0x00,0x70,0xe0,0x0f,0x80,0x03,0x00,0x70,0xe0,0x0f,0x80, 0x03,0x00,0x70,0xe0,0x0f,0x00,0x03,0x00,0x70,0xe0,0x0f,0x00,0x00,0x00,0x70, 0xe0,0x0f,0x00,0x00,0x00,0x70,0xe0,0x0f,0xfe,0x3f,0x00,0x70,0xe0,0x0f,0xfc, 0xff,0x00,0x70,0xe0,0x0f,0xfc,0xff,0x00,0x70,0xe0,0x0f,0xf0,0xf8,0x01,0x70, 0xe0,0x0f,0xf0,0xe0,0x01,0x70,0xe0,0x0f,0xf0,0xe0,0x01,0x70,0xe0,0x0f,0xf0, 0xe0,0x01,0x70,0xe0,0x0f,0xf0,0xe0,0x01,0x00,0xe0,0x0f,0xf0,0xe0,0x01,0x00, 0xe0,0x0f,0xf2,0xe0,0x01,0x00,0xe0,0x8f,0xf3,0xe0,0xf9,0x0f,0xe0,0x8f,0xf3, 0xe0,0xf9,0x0f,0xe0,0xff,0xf3,0xe0,0xf1,0x1f,0xe0,0xff,0xf3,0xf8,0x71,0x1e, 0xe0,0xff,0xf3,0xf8,0x71,0x1e,0xe0,0x8f,0xf3,0xff,0x71,0x1c,0xe0,0x0f,0xf2, 0xff,0x70,0x1c,0xe0,0x0f,0xf2,0xff,0x70,0x1c,0xe0,0x0f,0xf0,0xe0,0x71,0x1c, 0xe0,0x0f,0xf0,0xc0,0x77,0x1e,0xe0,0x0f,0xf0,0xc0,0x77,0x1e,0xe0,0x0f,0xf0, 0xc0,0xf7,0x0f,0xe0,0x0f,0xf0,0xc0,0xf7,0x1f,0xe0,0x0f,0xf0,0xc0,0xf7,0x1f, 0xe0,0x0f,0xf0,0xc0,0x77,0x7c,0xe0,0x0f,0xf0,0xc0,0x77,0x70,0xe0,0x0f,0xf0, 0xc0,0x77,0x70,0xe0,0x0f,0xf0,0xc0,0x77,0x70,0xe0,0x0f,0xf0,0xc0,0x77,0x70, 0xe0,0x0f,0xf0,0xc0,0x77,0x70,0xe0,0x0f,0xf0,0xc0,0x77,0x70,0xe0,0x0f,0xf0, 0xe0,0x77,0x7c,0xe0,0x0f,0xf0,0xe0,0x77,0x7c,0xf8,0x3f,0xfc,0xff,0xf1,0x1f, 0xfc,0x7f,0xfe,0xff,0xf8,0x0f,0xfc,0x7f,0xfe,0xff,0xf8,0x0f,0x00,0x00,0x00, 0x00,0x00,0x00}; fbb-7.04j/include/fbb_conf.h0100644000175100017510000000236707726646105013761 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ int read_fbb_conf(char *pathname); char *find_fbb_conf(char *key, int next); char *def_fbb_conf(char *key); char *get_fbb_all(int next); char *get_fbb_def(int next); void free_fbb_conf(void); fbb-7.04j/include/ufortify.h0100755000175100017510000000456107726646105014073 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * FILE: * ufortify.h * * DESCRIPTION: * User options for fortify. Changes to this file require fortify.c to be * recompiled, but nothing else. */ #define FORTIFY_STORAGE #define FORTIFY_BEFORE_SIZE 16 /* Bytes to allocate before block */ #define FORTIFY_BEFORE_VALUE 0xA3 /* Fill value before block */ #define FORTIFY_AFTER_SIZE 16 /* Bytes to allocate after block */ #define FORTIFY_AFTER_VALUE 0xA5 /* Fill value after block */ #define FILL_ON_MALLOC /* Nuke out malloc'd memory */ #define FILL_ON_MALLOC_VALUE 0xA7 /* Value to initialize with */ #define FILL_ON_FREE /* free'd memory is cleared */ #define FILL_ON_FREE_VALUE 0xA9 /* Value to de-initialize with */ #define CHECK_ALL_MEMORY_ON_MALLOC #define CHECK_ALL_MEMORY_ON_FREE #define PARANOID_FREE #define WARN_ON_MALLOC_FAIL /* A debug is issued on a failed malloc */ #define WARN_ON_ZERO_MALLOC /* A debug is issued on a malloc(0) */ #define WARN_ON_FALSE_FAIL /* See Fortify_SetMallocFailRate */ #define WARN_ON_SIZE_T_OVERFLOW/* Watch for breaking the 64K limit in */ /* some braindead architectures... */ #define FORTIFY_LOCK() #define FORTIFY_UNLOCK() fbb-7.04j/include/fbb_orb.h0100644000175100017510000001055707726646105013616 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Packet sent protocol : * buf[0] = service * buf[1] = command * buf[2] = data length LSB * buf[3] = data length MSB * * Service : * ORB_CONSOLE * ORB_MONITOR * ORB_CHANNEL * data[0] = channel (CONSOLE=0, MONITOR=0xff, channel [1..254]); * data[1] = color; * data[2] = header; * data[3..] = data * ORB_XFBBX * data[0] = 0: disconnected * 1: connected * 2: connexion refused * 3: ask editor for Sx * 4: ask editor for SR * ORB_LISTCNX * (data = connection line) * ORB_MSGS * (data = private and bulletin number) * ORB_STATUS * (data = status) * ORB_NBCNX * (data = connection number) * ORB_DATA * Command = 0 : list of services * (data = list of services (one per byte)) * Command = 1 : Dir * (1st packet = filename/dir-mask, next packets = data, length=0 = end) * Command = 2 : File sent to client * (1st packet = filename+size, next packets = data, length=0 = end) * Command = 3 : File received accepted (length=0) * (1st packet = filename+size, next packets = data, length=0 = end) * Command = 4 : Forward management to client * (1st packet = filename+size, next packets = data, length=0 = end) * Command = 5 : Disconnection of users * (1st packet = Channel(1..50) callsign immediate(0/1)) */ /* * Packet received protocol : * buf[0] = service * buf[1] = command * * Service : * ORB_REQUEST * Command : * 0 : mask configuration * buf[2] = mask * 1 : Directory (mask follows) * buf[2] = data length LSB * buf[3] = data length MSB * buf[4..] = directory mask * 2 : get file (filename follows) * buf[2] = data length LSB * buf[3] = data length MSB * buf[4..] = filename * 3 : put file (1st packet = filename, next packets = data, length=0 = end) * buf[2] = data length LSB * buf[3] = data length MSB * buf[4..] = filename or data * 4 : forward management * buf[2] = data length LSB * buf[3] = data length MSB * buf[4..] = command * 5 : disconnect request * buf[2] = data length LSB * buf[3] = data length MSB * buf[4..] = command * 6 : user management * buf[2] = data length LSB * buf[3] = data length MSB * buf[4..] = command * 7 : message management * buf[2] = data length LSB * buf[3] = data length MSB * buf[4..] = command * 8 : message request * buf[2] = data length LSB * buf[3] = data length MSB * buf[4..] = command * 9 : options management * buf[2] = data length LSB * buf[3] = data length MSB * buf[4..] = command * 10: pactor management * buf[2] = data length LSB * buf[3] = data length MSB * buf[4..] = command */ #define ORB_REQUEST 0 #define ORB_MSGS 1 #define ORB_STATUS 2 #define ORB_NBCNX 4 #define ORB_LISTCNX 8 #define ORB_MONITOR 16 #define ORB_CONSOLE 32 #define ORB_CHANNEL 64 #define ORB_XFBBX 128 #define ORB_DATA 0 #define SVC_LIST 0 #define SVC_DIR 1 #define SVC_RECV 2 #define SVC_SEND 3 #define SVC_FWD 4 #define SVC_DISC 5 #define SVC_USER 6 #define SVC_MSG 7 #define SVC_MREQ 8 #define SVC_OPT 9 #define SVC_PACTOR 10 #define SVC_INFO 11 #define SVC_MAX 12 #define IYapp 1 #define ICall 2 #define IDigis 3 #define IName 4 #define IHome 5 #define IChan 6 #define IPort 7 #define IN1N2N3 8 #define IFlags 9 #define IPaclen 10 #define IStatus 11 #define IMem 12 #define IBuf 13 #define IRet 14 #define IPerso 15 #define IUnread 16 fbb-7.04j/src/0042755000175100017510000000000007726666461011222 5ustar abaabafbb-7.04j/src/Makefile0100644000175100017510000000573107726646105012654 0ustar abaaba# this is only if "old" ax25 for kernel 2.0.x are used AX25OLDPATH = /usr/src/ax25 # the rest should not be changed AX25LIBPATH = /usr/lib AX25INCPATH = /usr/include/netax25 .EXPORT_ALL_VARIABLES: USE_NCURSES := $(shell test -f /usr/include/ncurses.h && echo 1) OLD_AX25 := $(shell test -f $(AX25OLDPATH)/lib/axutils.h && echo 1) NEW_AX25 := $(shell test -f $(AX25INCPATH)/axlib.h && echo 1) ifneq ($(NEW_AX25), 1) ifeq ($(OLD_AX25), 1) DEFS = -DOLD_AX25 AX25INCPATH = $(AX25OLDPATH)/lib endif endif CC = gcc CFLAGS = -Wall -Wstrict-prototypes -O2 -g -funsigned-char $(DEFS) -D__LINUX__ -DPROTOTYPES -I../include LIBS = -L$(AX25LIBPATH) -lm -lax25 COMMON_OBJECTS = \ arbre.o\ autobin.o\ balise.o\ bidexms.o\ conf.o\ console.o\ date.o\ devio.o\ dos_1.o\ dos_dir.o\ driver.o\ drv_aea.o\ drv_ded.o\ drv_hst.o\ drv_kam.o\ drv_mod.o\ drv_pop.o\ drv_sock.o\ drv_tcp.o\ edit.o\ ems.o\ error.o\ exec_pg.o\ fbb_conf.o\ fortify.o\ forward.o\ fwdovl1.o\ fwdovl2.o\ fwdovl3.o\ fwdovl4.o\ fwdovl5.o\ fwdovl6.o\ fwdovl7.o\ fwdutil.o\ gesfic.o\ ibm.o\ info.o\ init.o\ init_srv.o\ init_tnc.o\ initfwd.o\ initport.o\ k_tasks.o\ kernel.o\ lzhuf.o\ maint_fw.o\ mbl_edit.o\ mbl_expo.o\ mbl_impo.o\ mbl_kill.o\ mbl_lc.o\ mbl_list.o\ mbl_log.o\ mbl_menu.o\ mbl_opt.o\ mbl_prn.o\ mbl_read.o\ mbl_rev.o\ mbl_stat.o\ mbl_sys.o\ mbl_user.o\ mblutil.o\ md5c.o\ modem.o\ nomenc.o\ nouvfwd.o\ pac_crc.o\ pacsat.o\ qraloc.o\ redist.o\ rx25.o\ serv.o\ serveur.o\ statis.o\ themes.o\ tnc.o\ tncio.o\ trait.o\ trajec.o\ trajovl.o\ variable.o\ warning.o\ watchdog.o\ waveplay.o\ wp.o\ wp_mess.o\ wpserv.o\ xfwd.o\ xmodem.o\ yapp.o all : xfbbd fbbgetconf epurmess epurwp reqdir clr_user maintinf xfbbC install: all @cd ..;./install_sh clean : $(RM) *.o *.orig ../include/*.orig core $(RM) xfbbd xfbbC epurmess epurwp reqdir clr_user maintinf xfbbd: $(COMMON_OBJECTS) xfbbd.o fbb_orb.o $(CC) $(CFLAGS) -o xfbbd xfbbd.o fbb_orb.o $(COMMON_OBJECTS) $(LIBS) xfbbd.o : xfbbd.c $(CC) $(CFLAGS) -D__ORB__ -c -o xfbbd.o xfbbd.c fbbgetconf : fbbgetconf.o fbb_conf.o $(CC) $(CFLAGS) -o fbbgetconf fbbgetconf.o fbb_conf.o epurmess : epurmess.o fbb_conf.o $(CC) $(CFLAGS) -o epurmess epurmess.o fbb_conf.o epurwp : epurwp.o fbb_conf.o $(CC) $(CFLAGS) -o epurwp epurwp.o fbb_conf.o maintinf : maintinf.o fbb_conf.o $(CC) $(CFLAGS) -o maintinf maintinf.o fbb_conf.o reqdir : reqdir.o fbb_conf.o $(CC) $(CFLAGS) -o reqdir reqdir.o fbb_conf.o ifeq ($(USE_NCURSES),1) CFLAGS += -DUSE_NCURSES xfbbC : xfbbC.o md5c.o terminal.o $(CC) $(CFLAGS) -o xfbbC -lncurses xfbbC.o md5c.o terminal.o else xfbbC : xfbbC.o md5c.o @echo "***" @echo "*** ncurses is not installed. xfbbC client will use terminal mode" @echo "***" $(CC) $(CFLAGS) -o xfbbC xfbbC.o md5c.o endif fbb-7.04j/src/fortify.c0100644000175100017510000006156507726646105013051 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * FILE: * fortify.c * * DESCRIPTION: * A fortified shell for malloc, realloc, calloc and free. * To use Fortify, each source file will need to #include "fortify.h". To * enable Fortify, define the symbol FORTIFY. If FORTIFY is not defined, it * will compile away to nothing. If you do not have stdout available, you may * wish to set an alternate output function. See Fortify_SetOutputFunc(), * below. * You will also need to link in fortify.o * * None of the functions in this file should really be called * directly; they really should be called through the macros * defined in fortify.h * */ #define __FORTIFY_C__ /* So fortify.h knows to not define the fortify macros */ #include #ifdef FORTIFY #include #include #include #include #include #ifndef __LINUX__ #include #endif #include "fortify.h" #include "ufortify.h" /* the user's options */ struct Header { char *File; /* The sourcefile of the caller */ unsigned long Line; /* The sourceline of the caller */ size_t Size; /* The size of the malloc'd block */ struct Header *Prev, /* List pointers */ *Next; int Scope; int Checksum; /* For validating the Header structure; see ChecksumHeader() */ }; static int CheckBlock(struct Header *h, char *file, unsigned long line); static int CheckFortification(unsigned char *ptr, unsigned char value, size_t size); static void SetFortification(unsigned char *ptr, unsigned char value, size_t size); static void OutputFortification(unsigned char *ptr, unsigned char value, size_t size); static int IsHeaderValid(struct Header *h); static void MakeHeaderValid(struct Header *h); static int ChecksumHeader(struct Header *h); static int IsOnList(struct Header *h); static void OutputHeader(struct Header *h); static void OutputMemory(struct Header *h); static void st_DefaultOutput(char *String) { /* cprintf(String); cprintf("\r"); */ FILE *fptr; char *ptri; char tro[128]; int i; #ifdef __WINDOWS__ WinDebug(String); #endif #ifdef __FBBDOS__ // dprintf(String); cprintf(String); #endif for (i = 0 ; (*String) ; String++) { if (*String != '\r') tro[i++] = *String; } tro[i] = '\0'; fptr = fopen ("error.sys", "a+"); if (fptr) { fputs(tro, fptr); fclose(fptr); } #ifdef __LINUX__ fprintf(stderr, tro); #endif } static struct Header *st_Head = 0; /* Head of alloc'd memory list */ static OutputFuncPtr st_Output = st_DefaultOutput; /* Output function for errors */ static char st_Buffer[256]; /* Temporary buffer for sprintf's */ static int st_Disabled = 0; /* If true, Fortify is inactive */ static int st_MallocFailRate = 0; /* % of the time to fail mallocs */ static char *st_LastVerifiedFile = "unknown"; static unsigned long st_LastVerifiedLine = 0; static int st_Scope = 0; static void OutputLastVerifiedPoint(void); /* * Fortify_malloc() - Allocates a block of memory, with extra bits for * misuse protection/detection. * * Features: * + Adds the malloc'd memory onto Fortify's own private list. * (With a checksum'd header to detect corruption of the memory list) * + Places sentinals on either side of the user's memory with * known data in them, to detect use outside of the bounds * of the block * + Initializes the malloc'd memory to some "nasty" value, so code * can't rely on it's contents. * + Can check all sentinals on every malloc. * + Can generate a warning message on a malloc fail. * + Can randomly "fail" at a set fail rate */ void *FORTIFY_STORAGE Fortify_malloc(size_t size, char *file, unsigned long line) { unsigned char *ptr; struct Header *h; FORTIFY_LOCK(); if(st_Disabled) { ptr = malloc(size); FORTIFY_UNLOCK(); return(ptr); } #ifdef CHECK_ALL_MEMORY_ON_MALLOC Fortify_CheckAllMemory(file, line); #endif if(size == 0) { #ifdef WARN_ON_ZERO_MALLOC sprintf(st_Buffer, "\r\nFortify: %s.%ld\r\n malloc(0) attempted failed\r\n", file, line); st_Output(st_Buffer); /* sleep(10); */ #endif FORTIFY_UNLOCK(); return(0); } if(st_MallocFailRate > 0) { if(rand() % 100 < st_MallocFailRate) { #ifdef WARN_ON_FALSE_FAIL sprintf(st_Buffer, "\r\nFortify: %s.%ld\r\n malloc(%ld) \"false\" failed\r\n", file, line, (unsigned long)size); st_Output(st_Buffer); /* sleep(10); */ #endif FORTIFY_UNLOCK(); return(0); } } /* * malloc the memory, including the space for the header and fortification * buffers */ #ifdef WARN_ON_SIZE_T_OVERFLOW { size_t private_size = sizeof(struct Header) + FORTIFY_BEFORE_SIZE + size + FORTIFY_AFTER_SIZE; if(private_size < size) /* Check to see if the added baggage is larger than size_t */ { sprintf(st_Buffer, "\r\nFortify: %s.%ld\r\n malloc(%ld) has overflowed size_t.\r\n", file, line, (unsigned long)size); st_Output(st_Buffer); /* sleep(10); */ FORTIFY_UNLOCK(); return(0); } } #endif ptr = malloc(sizeof(struct Header) + FORTIFY_BEFORE_SIZE + size + FORTIFY_AFTER_SIZE); if(!ptr) { #ifdef WARN_ON_MALLOC_FAIL sprintf(st_Buffer, "\r\nFortify: %s.%ld\r\n malloc(%ld) failed\r\n", file, line, (unsigned long)size); st_Output(st_Buffer); /* sleep(10); */ #endif FORTIFY_UNLOCK(); return(0); } /* * Initialize and validate the header */ h = (struct Header *)ptr; h->Size = size; h->File = file; h->Line = line; h->Next = st_Head; h->Prev = 0; h->Scope = st_Scope; if(st_Head) { st_Head->Prev = h; MakeHeaderValid(st_Head); } st_Head = h; MakeHeaderValid(h); /* * Initialize the fortifications */ SetFortification(ptr + sizeof(struct Header), FORTIFY_BEFORE_VALUE, FORTIFY_BEFORE_SIZE); SetFortification(ptr + sizeof(struct Header) + FORTIFY_BEFORE_SIZE + size, FORTIFY_AFTER_VALUE, FORTIFY_AFTER_SIZE); #ifdef FILL_ON_MALLOC /* * Fill the actual user memory */ SetFortification(ptr + sizeof(struct Header) + FORTIFY_BEFORE_SIZE, FILL_ON_MALLOC_VALUE, size); #endif /* * We return the address of the user's memory, not the start of the block, * which points to our magic cookies */ FORTIFY_UNLOCK(); return(ptr + sizeof(struct Header) + FORTIFY_BEFORE_SIZE); } /* * Fortify_free() - This free must be used for all memory allocated with * Fortify_malloc(). * * Features: * + Pointers are validated before attempting a free - the pointer * must point to a valid malloc'd bit of memory. * + Detects attempts at freeing the same block of memory twice * + Can clear out memory as it is free'd, to prevent code from using * the memory after it's been freed. * + Checks the sentinals of the memory being freed. * + Can check the sentinals of all memory. */ void FORTIFY_STORAGE Fortify_free(void *uptr, char *file, unsigned long line) { unsigned char *ptr = (unsigned char *)uptr - sizeof(struct Header) - FORTIFY_BEFORE_SIZE; struct Header *h = (struct Header *)ptr; FORTIFY_LOCK(); if(st_Disabled) { free(uptr); FORTIFY_UNLOCK(); return; } #ifdef CHECK_ALL_MEMORY_ON_FREE Fortify_CheckAllMemory(file, line); #endif #ifdef PARANOID_FREE if(!IsOnList(h)) { sprintf(st_Buffer, "\r\nFortify: %s.%ld\r\n Invalid pointer, corrupted header, or possible free twice\r\n", file, line); st_Output(st_Buffer); /* sleep(10); */ OutputLastVerifiedPoint(); goto fail; } #endif if(!CheckBlock(h, file, line)) goto fail; /* * Remove the block from the list */ if(h->Prev) { if(!CheckBlock(h->Prev, file, line)) goto fail; h->Prev->Next = h->Next; MakeHeaderValid(h->Prev); } else st_Head = h->Next; if(h->Next) { if(!CheckBlock(h->Next, file, line)) goto fail; h->Next->Prev = h->Prev; MakeHeaderValid(h->Next); } #ifdef FILL_ON_FREE /* * Nuke out all memory that is about to be freed */ SetFortification(ptr, FILL_ON_FREE_VALUE, sizeof(struct Header) + FORTIFY_BEFORE_SIZE + h->Size + FORTIFY_AFTER_SIZE); #endif /* * And do the actual free */ free(ptr); FORTIFY_UNLOCK(); return; fail: sprintf(st_Buffer, " free(%p) failed\r\n", uptr); st_Output(st_Buffer); /* sleep(10); */ FORTIFY_UNLOCK(); } /* * Fortify_realloc() - Uses Fortify_malloc() and Fortify_free() to implement * realloc(). * * Features: * + The realloc'd block is ALWAYS moved. * + The pointer passed to realloc() is verified in the same way that * Fortify_free() verifies pointers before it frees them. * + All the Fortify_malloc() and Fortify_free() protection */ void *FORTIFY_STORAGE Fortify_realloc(void *ptr, size_t new_size, char *file, unsigned long line) { void *new_ptr; struct Header *h = (struct Header *) ((unsigned char *)ptr - sizeof(struct Header) - FORTIFY_BEFORE_SIZE); if(st_Disabled) { FORTIFY_LOCK(); new_ptr = realloc(ptr, new_size); FORTIFY_UNLOCK(); return(new_ptr); } if(!ptr) return(Fortify_malloc(new_size, file, line)); FORTIFY_LOCK(); if(!IsOnList(h)) { sprintf(st_Buffer, "\r\nFortify: %s.%ld\r\n Invalid pointer or corrupted header passed to realloc\r\n", file, line); st_Output(st_Buffer); /* sleep(10); */ goto fail; } if(!CheckBlock(h, file, line)) goto fail; new_ptr = Fortify_malloc(new_size, file, line); if(!new_ptr) { FORTIFY_UNLOCK(); return(0); } if(h->Size < new_size) memcpy(new_ptr, ptr, h->Size); else memcpy(new_ptr, ptr, new_size); Fortify_free(ptr, file, line); FORTIFY_UNLOCK(); return(new_ptr); fail: sprintf(st_Buffer, " realloc(%p, %ld) failed\r\n", ptr, (unsigned long)new_size); st_Output(st_Buffer); /* sleep(10); */ FORTIFY_UNLOCK(); return (NULL); } /* * Fortifty_calloc() - Uses Fortify_malloc() to implement calloc(). Much * the same protection as Fortify_malloc(). */ void *FORTIFY_STORAGE Fortify_calloc(size_t num, size_t size, char *file, unsigned long line) { void *ptr; ptr = Fortify_malloc(num * size, file, line); if(ptr) memset(ptr, 0, num * size); return(ptr); } /* * Fortifty_strdup() - Uses Fortify_malloc() to implement strdup(). Much * the same protection as Fortify_malloc(). */ char * Fortify_strdup(char *str, char *file, unsigned long line) { char *ptr; size_t size = strlen(str)+1; ptr = Fortify_malloc(size, file, line); if(ptr) strcpy(ptr, str); return(ptr); } /* * Fortify_CheckPointer() - Returns true if the uptr points to a valid * piece of Fortify_malloc()'d memory. The memory must be on the malloc'd * list, and it's sentinals must be in tact. * If anything is wrong, an error message is issued. * * (Note - if fortify is disabled, this function always returns true). */ int FORTIFY_STORAGE Fortify_CheckPointer(void *uptr, char *file, unsigned long line) { unsigned char *ptr = (unsigned char *)uptr - sizeof(struct Header) - FORTIFY_BEFORE_SIZE; int r; if(st_Disabled) return(1); FORTIFY_LOCK(); if(!IsOnList((struct Header *)ptr)) { sprintf(st_Buffer, "\r\nFortify: %s.%ld\r\n Invalid pointer or corrupted header detected (%p)\r\n", file, line, uptr); st_Output(st_Buffer); /* sleep(10); */ FORTIFY_UNLOCK(); return(0); } r = CheckBlock((struct Header *)ptr, file, line); FORTIFY_UNLOCK(); return r; } /* * Fortify_SetOutputFunc(OutputFuncPtr Output) - Sets the function used to * output all error and diagnostic messages by fortify. The output function * takes a single unsigned char * argument, and must be able to handle newlines. * The function returns the old pointer. */ Fortify_OutputFuncPtr FORTIFY_STORAGE Fortify_SetOutputFunc(Fortify_OutputFuncPtr Output) { OutputFuncPtr Old = st_Output; st_Output = Output; return(Old); } /* * Fortify_SetMallocFailRate(int Percent) - Fortify_malloc() will make the * malloc attempt fail this Percent of the time, even if the memory is * available. Useful to "stress-test" an application. Returns the old * value. The fail rate defaults to 0. */ int FORTIFY_STORAGE Fortify_SetMallocFailRate(int Percent) { int Old = st_MallocFailRate; st_MallocFailRate = Percent; return(Old); } /* * Fortify_CheckAllMemory() - Checks the sentinals of all malloc'd memory. * Returns the number of blocks that failed. * * (If Fortify is disabled, this function always returns 0). */ int FORTIFY_STORAGE Fortify_CheckAllMemory(char *file, unsigned long line) { struct Header *curr = st_Head; int count = 0; if(st_Disabled) return(0); FORTIFY_LOCK(); while(curr) { if(!CheckBlock(curr, file, line)) count++; curr = curr->Next; } if(file) { st_LastVerifiedFile = file; st_LastVerifiedLine = line; } FORTIFY_UNLOCK(); return(count); } /* Fortify_EnterScope - enters a new Fortify scope level. * returns the new scope level. */ int FORTIFY_STORAGE Fortify_EnterScope(char *file, unsigned long line) { return(++st_Scope); } /* Fortify_LeaveScope - leaves a Fortify scope level, * also prints a memory dump of all non-freed memory that was allocated * during the scope being exited. */ int FORTIFY_STORAGE Fortify_LeaveScope(char *file, unsigned long line) { struct Header *curr = st_Head; int count = 0; unsigned long size = 0; if(st_Disabled) return(0); FORTIFY_LOCK(); st_Scope--; while(curr) { if(curr->Scope > st_Scope) { if(count == 0) { sprintf(st_Buffer, "\r\nFortify: Memory Dump at %s.%ld\r\n", file, line); st_Output(st_Buffer); OutputLastVerifiedPoint(); sprintf(st_Buffer, "%11s %8s %s\r\n", "Address", "Size", "Allocator"); st_Output(st_Buffer); } OutputHeader(curr); count++; size += curr->Size; } curr = curr->Next; } if(count) { sprintf(st_Buffer, "%11s %8ld bytes overhead\r\n", "and", (unsigned long)(count * (sizeof(struct Header) + FORTIFY_BEFORE_SIZE + FORTIFY_AFTER_SIZE))); st_Output(st_Buffer); sprintf(st_Buffer,"%11s %8ld bytes in %d blocks\r\n", "total", size, count); st_Output(st_Buffer); } FORTIFY_UNLOCK(); return(count); } /* * Fortify_OutputAllMemory() - Outputs the entire list of currently * malloc'd memory. For each malloc'd block is output it's Address, * Size, and the SourceFile and Line that allocated it. * * If there is no memory on the list, this function outputs nothing. * * It returns the number of blocks on the list, unless fortify has been * disabled, in which case it always returns 0. */ int FORTIFY_STORAGE Fortify_OutputAllMemory(char *file, unsigned long line) { struct Header *curr = st_Head; int count = 0; unsigned long size = 0; if(st_Disabled) return(0); FORTIFY_LOCK(); if(curr) { sprintf(st_Buffer, "\r\nFortify: Memory Dump at %s.%ld\r\n", file, line); st_Output(st_Buffer); OutputLastVerifiedPoint(); sprintf(st_Buffer, "%11s %8s %s\r\n", "Address", "Size", "Allocator"); st_Output(st_Buffer); while(curr) { OutputHeader(curr); count++; size += curr->Size; curr = curr->Next; } sprintf(st_Buffer, "%11s %8ld bytes overhead\r\n", "and", (unsigned long)(count * (sizeof(struct Header) + FORTIFY_BEFORE_SIZE + FORTIFY_AFTER_SIZE))); st_Output(st_Buffer); sprintf(st_Buffer,"%11s %8ld bytes in %d blocks\r\n", "total", size, count); st_Output(st_Buffer); } FORTIFY_UNLOCK(); return(count); } /* Fortify_DumpAllMemory(Scope) - Outputs the entire list of currently * new'd memory within the specified scope. For each new'd block is output * it's Address, Size, the SourceFile and Line that allocated it, a hex dump * of the contents of the memory and an ascii dump of printable characters. * * If there is no memory on the list, this function outputs nothing. * * It returns the number of blocks on the list, unless Fortify has been * disabled, in which case it always returns 0. */ int FORTIFY_STORAGE Fortify_DumpAllMemory(int scope, char *file, unsigned long line) { struct Header *curr = st_Head; int count = 0; unsigned long size = 0; if(st_Disabled) return(0); FORTIFY_LOCK(); while(curr) { if(curr->Scope >= scope) { if(count == 0) { sprintf(st_Buffer, "\r\nFortify: Memory Dump at %s.%ld\r\n", file, line); st_Output(st_Buffer); OutputLastVerifiedPoint(); sprintf(st_Buffer, "%11s %8s %s\r\n", "Address", "Size", "Allocator"); st_Output(st_Buffer); } OutputHeader(curr); OutputMemory(curr); st_Output("\r\n"); count++; size += curr->Size; } curr = curr->Next; } if(count) { sprintf(st_Buffer, "%11s %8ld bytes overhead\r\n", "and", (unsigned long)(count * (sizeof(struct Header) + FORTIFY_BEFORE_SIZE + FORTIFY_AFTER_SIZE))); st_Output(st_Buffer); sprintf(st_Buffer,"%11s %8ld bytes in %d blocks\r\n", "total", size, count); st_Output(st_Buffer); } FORTIFY_UNLOCK(); return(count); } /* * Fortify_Disable() - This function provides a mechanism to disable Fortify * without recompiling all the sourcecode. It can only be called, though, * when there is no memory on the Fortify malloc'd list. (Ideally, at the * start of the program before any memory has been allocated). If you * call this function when there IS memory on the Fortify malloc'd list, * it will issue an error, and fortify will not be disabled. */ int FORTIFY_STORAGE Fortify_Disable(char *file, unsigned long line) { int result; FORTIFY_LOCK(); if(st_Head) { sprintf(st_Buffer, "Fortify: %s.%d\r\n", file, line); st_Output(st_Buffer); st_Output(" Fortify_Disable failed\r\n"); st_Output(" (because there is memory on the Fortify memory list)\r\n"); Fortify_OutputAllMemory(file, line); result = 0; } else { st_Disabled = 1; result = 1; } FORTIFY_UNLOCK(); return(result); } /* * Check a block's header and fortifications. */ static int CheckBlock(struct Header *h, char *file, unsigned long line) { unsigned char *ptr = (unsigned char *)h; int result = 1; if(!IsHeaderValid(h)) { sprintf(st_Buffer, "\r\nFortify: %s.%ld\r\n Invalid pointer or corrupted header detected (%p)\r\n", file, line, ptr + sizeof(struct Header) + FORTIFY_BEFORE_SIZE); st_Output(st_Buffer); /* sleep(10); */ OutputLastVerifiedPoint(); return(0); } if(!CheckFortification(ptr + sizeof(struct Header), FORTIFY_BEFORE_VALUE, FORTIFY_BEFORE_SIZE)) { sprintf(st_Buffer, "\r\nFortify: %s.%ld\r\n Memory overrun detected before block\r\n", file, line); st_Output(st_Buffer); /* sleep(10); */ sprintf(st_Buffer," (%p,%ld,%s.%ld)\r\n", ptr + sizeof(struct Header) + FORTIFY_BEFORE_SIZE, (unsigned long)h->Size, h->File, h->Line); st_Output(st_Buffer); /* sleep(10); */ OutputFortification(ptr + sizeof(struct Header), FORTIFY_BEFORE_VALUE, FORTIFY_BEFORE_SIZE); OutputLastVerifiedPoint(); result = 0; } if(!CheckFortification(ptr + sizeof(struct Header) + FORTIFY_BEFORE_SIZE + h->Size, FORTIFY_AFTER_VALUE, FORTIFY_AFTER_SIZE)) { sprintf(st_Buffer, "\r\nFortify: %s.%ld\r\n Memory overrun detected after block\r\n", file, line); st_Output(st_Buffer); /* sleep(10); */ sprintf(st_Buffer," (%p,%ld,%s.%ld)\r\n", ptr + sizeof(struct Header) + FORTIFY_BEFORE_SIZE, (unsigned long)h->Size, h->File, h->Line); st_Output(st_Buffer); /* sleep(10); */ OutputFortification(ptr + sizeof(struct Header) + FORTIFY_BEFORE_SIZE + h->Size, FORTIFY_AFTER_VALUE, FORTIFY_AFTER_SIZE); OutputLastVerifiedPoint(); result = 0; } return(result); } /* * Checks if the _size_ bytes from _ptr_ are all set to _value_ */ static int CheckFortification(unsigned char *ptr, unsigned char value, size_t size) { while(size--) if(*ptr++ != value) return(0); return(1); } /* * Set the _size_ bytes from _ptr_ to _value_. */ static void SetFortification(unsigned char *ptr, unsigned char value, size_t size) { memset(ptr, value, size); } /* * Output the corrupted section of the fortification */ static void OutputFortification(unsigned char *ptr, unsigned char value, size_t size) { unsigned long offset, column; char ascii[17]; st_Output("Address Offset Data"); offset = 0; column = 0; while(offset < size) { if(column == 0) { sprintf(st_Buffer, "\r\n%8p %8d ", ptr, offset); st_Output(st_Buffer); } sprintf(st_Buffer, "%02x ", *ptr); st_Output(st_Buffer); ascii[ column ] = isprint( *ptr ) ? (char)(*ptr) : (char)(' '); ascii[ column + 1 ] = '\0'; ptr++; offset++; column++; if(column == 16) { st_Output( " \"" ); st_Output( ascii ); st_Output( "\"" ); column = 0; } } if ( column != 0 ) { while ( column ++ < 16 ) { st_Output( " " ); } st_Output( " \"" ); st_Output( ascii ); st_Output( "\"" ); } st_Output("\r\n"); } /* * Returns true if the supplied pointer does indeed point to a real Header */ static int IsHeaderValid(struct Header *h) { return(!ChecksumHeader(h)); } /* * Updates the checksum to make the header valid */ static void MakeHeaderValid(struct Header *h) { h->Checksum = 0; h->Checksum = -ChecksumHeader(h); } /* * Calculate (and return) the checksum of the header. (Including the Checksum * variable itself. If all is well, the checksum returned by this function should * be 0. */ static int ChecksumHeader(struct Header *h) { int c, checksum, *p; for(c = 0, checksum = 0, p = (int *)h; c < sizeof(struct Header)/sizeof(int); c++) checksum += *p++; return(checksum); } /* * Examines the malloc'd list to see if the given header is on it. */ static int IsOnList(struct Header *h) { struct Header *curr; curr = st_Head; while(curr) { if(curr == h) return(1); curr = curr->Next; } return(0); } /* * Hex and ascii dump the memory */ static void OutputMemory(struct Header *h) { OutputFortification((unsigned char*)h + sizeof(struct Header) + FORTIFY_BEFORE_SIZE, 0, h->Size); } /* * Output the header... */ static void OutputHeader(struct Header *h) { sprintf(st_Buffer, "%11p %8ld %s.%ld (%d)\r\n", (unsigned char*)h + sizeof(struct Header) + FORTIFY_BEFORE_SIZE, (unsigned long)h->Size, h->File, h->Line, h->Scope); st_Output(st_Buffer); } static void OutputLastVerifiedPoint() { sprintf(st_Buffer, "\r\nLast Verified point: %s.%ld\r\n", st_LastVerifiedFile, st_LastVerifiedLine); st_Output(st_Buffer); } void *Fortify_m_alloue (unsigned int taille, char *file, unsigned long line) { char *ptr; mem_alloue += (unsigned long) taille; free_use (); if ((tot_mem - (unsigned long) taille) < 10000L) libere_bid (); deb_io (); if ((ptr = Fortify_calloc (1L, (unsigned long) taille, file, line)) == NULL) { fin_io (); err_alloc (taille); } /* free_mem(); */ fin_io (); return (ptr); } void Fortify_m_libere (void *ptr, unsigned int taille, char *file, unsigned long line) { deb_io (); Fortify_free (ptr, file, line); mem_alloue -= (unsigned long) taille; fin_io (); free_use (); } #else /* defined FORTIFY */ void *m_alloue (unsigned int taille) { char *ptr; mem_alloue += (unsigned long) taille; free_use (); if ((tot_mem - (unsigned long) taille) < 10000L) libere_bid (); deb_io (); if ((ptr = calloc (1L, (unsigned long) taille)) == NULL) { fin_io (); err_alloc (taille); } /* free_mem(); */ fin_io (); return (ptr); } void m_libere (void *ptr, unsigned int taille) { deb_io (); free (ptr); mem_alloue -= (unsigned long) taille; fin_io (); free_use (); } #endif /* FORTIFY */ fbb-7.04j/src/waveplay.c0100644000175100017510000001730107726646105013204 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* vplay.c - plays and records CREATIVE LABS VOICE-files, Microsoft WAVE-files and raw data Autor: Michael Beck - beck@informatik.hu-berlin.de */ #include #include #include #include #include #ifndef __STDC__ #include #endif /* __STDC__ */ #include #include #ifdef __STDC__ #include #else /* __STDC__ */ #include #endif /* __STDC__ */ #include "fmtheaders.h" /* trying to define independent ioctl for sounddrivers version 1 and 2+ , but it dosn't work everywere */ #ifdef SOUND_VERSION #define IOCTL(a,b,c) ioctl(a,b,&c) #else #define IOCTL(a,b,c) (c = ioctl(a,b,c) ) #endif #define DEFAULT_DSP_SPEED 8000 #define AUDIO "/dev/dsp" #define min(a,b) ((a) <= (b) ? (a) : (b)) #define VOC_FMT 0 #define WAVE_FMT 1 #define RAW_DATA 2 /* global data */ static int dsp_speed = DEFAULT_DSP_SPEED, dsp_stereo = 0; static int samplesize = 8; static int quiet_mode = 0; static u_long count; static int audio, abuf_size, zbuf_size; static u_char *audiobuf, *zerobuf; /* needed prototypes */ static int r_play (char *name); /* test, if it's a .WAV file, 0 if ok (and set the speed, stereo etc.) < 0 if not */ int test_wavefile(void *buffer) { WaveHeader *wp = buffer; if (wp->main_chunk == RIFF && wp->chunk_type == WAVE && wp->sub_chunk == FMT && wp->data_chunk == DATA) { if (wp->format != PCM_CODE) { fprintf (stderr, "can't play not PCM-coded WAVE-files\n"); return (-1); } if (wp->modus > 2) { fprintf (stderr, "can't play WAVE-files with %d tracks\n", wp->modus); return (-1); } dsp_stereo = (wp->modus == WAVE_STEREO) ? 1 : 0; samplesize = wp->bit_p_spl; dsp_speed = wp->sample_fq; count = wp->data_length; return 0; } return -1; } /* if need a SYNC, (is needed if we plan to change speed, stereo ... during output) */ #ifdef __STDC__ int sync_dsp(void) #else /* __STDC__ */ inline int sync_dsp(void) #endif /* __STDC__ */ { if (ioctl (audio, SNDCTL_DSP_SYNC, NULL) < 0) { perror(AUDIO); return (0); } return(1); } /* setting the speed for output */ int set_dsp_speed (int dsp_speed) { if (IOCTL(audio, SNDCTL_DSP_SPEED, dsp_speed) < 0) { fprintf (stderr, "unable to set audio speed\n"); perror (AUDIO); return(0); } return(1); } /* if to_mono: compress 8 bit stereo data 2:1, needed if we want play 'one track'; this is usefull, if you habe SB 1.0 - 2.0 (I have 1.0) and want hear the sample (in Mono) if to_8: compress 16 bit to 8 by using hi-byte; wave-files use signed words, so we need to convert it in "unsigned" sample (0x80 is now zero) WARNING: this procedure can't compress 16 bit stereo to 16 bit mono, because if you have a 16 (or 12) bit card you should have stereo (or I'm wrong ?? ) */ #ifdef __STDC__ u_long one_channel(u_char *buf, u_long l, char to_mono, char to_8) #else /* __STDC__ */ inline u_long one_channel(char *buf, u_long l, char to_mono, char to_8) #endif /* __STDC__ */ { register u_char *w = buf; register u_char *w2 = buf; char ofs = 0; u_long incr = 0; u_long c, ret; if (to_mono) ++incr; if (to_8) { ++incr; ++w2; ofs = 128; } ret = c = l >> incr; incr = incr << 1; while (c--) { *w++ = *w2 + ofs; w2 += incr; } return ret; } int play (char *name) { int retour; audio = open (AUDIO, O_WRONLY, 0); if (audio == -1) { perror (AUDIO); return (0); } IOCTL(audio, SNDCTL_DSP_GETBLKSIZE, abuf_size); if (abuf_size < 4096 || abuf_size > 65536) { if (abuf_size == -1) perror (AUDIO); else fprintf (stderr, "Invalid audio buffers size %d\n", abuf_size); return(0); } zbuf_size = 256; if ( (audiobuf = (u_char *)malloc (abuf_size)) == NULL || (zerobuf = (u_char *)malloc (zbuf_size)) == NULL ) { fprintf (stderr, "unable to allocate input/output buffer\n"); return(0); } memset ((char *)zerobuf, 128, zbuf_size); retour = r_play (name); close (audio); return retour; } /* playing/recording raw data, this proc handels WAVE files and recording .VOCs (as one block) */ int recplay (int fd, int loaded, u_long count, int rtype, char *name) { int l, real_l; u_long c; char one_chn = 0; char to_8 = 0; int tmps; if (!sync_dsp()) return(0); if (!quiet_mode) { if (samplesize != 8) fprintf(stderr, "%d bit, ", samplesize); fprintf (stderr, "Speed %d Hz ", dsp_speed); fprintf (stderr, "%s ...\n", dsp_stereo ? "Stereo" : "Mono"); } tmps = samplesize; IOCTL(audio, SNDCTL_DSP_SAMPLESIZE, tmps); if (tmps != samplesize) { fprintf (stderr, "unable to set %d bit sample size", samplesize); if (samplesize == 16) { samplesize = 8; IOCTL(audio, SNDCTL_DSP_SAMPLESIZE, samplesize); if (samplesize != 8) { fprintf(stderr, "unable to set 8 bit sample size!\n"); return(0); } fprintf (stderr, "; playing 8 bit\n"); to_8 = 1; } else { fprintf (stderr, "\n"); return(0); } } #ifdef SOUND_VERSION if (ioctl (audio, SNDCTL_DSP_STEREO, &dsp_stereo) < 0) { #else if (dsp_stereo != ioctl (audio, SNDCTL_DSP_STEREO, dsp_stereo) ) { #endif fprintf (stderr, "can't play in Stereo; playing only one channel\n"); dsp_stereo = MODE_MONO; one_chn = 1; } if (!set_dsp_speed (dsp_speed)) return(0); while (count) { c = count; if (c > abuf_size) c = abuf_size; if ((l = read (fd, (char *)audiobuf + loaded, c - loaded)) > 0) { l += loaded; loaded = 0; /* correct the count; ugly but ... */ real_l = (one_chn || to_8) ? one_channel(audiobuf, l, one_chn, to_8) : l; if (write (audio, (char *)audiobuf, real_l) != real_l) { perror (AUDIO); return(0); } count -= l; } else { if (l == -1) { perror (name); return(0); } count = 0; /* Stop */ } } /* while (count) */ return(1); } /* let's play or record it (record_type says VOC/WAVE/raw) */ int r_play(char *name) { int fd; int retour = 0; fprintf(stderr, "Playing %s : ", name); if ((fd = open (name, O_RDONLY, 0)) == -1) { perror (name); return(0); } /* read bytes for WAVE-header */ read (fd, (char *)audiobuf, sizeof(WaveHeader)); if (test_wavefile (audiobuf) >= 0) { retour = recplay (fd, 0, count, WAVE_FMT, name); } if (fd != 0) close(fd); return(retour); } fbb-7.04j/src/serv.c0100644000175100017510000004264607726646105012345 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * * SERV.C : Programme principal */ #define FBB_MAIN #define MAIN #ifdef __MSDOS__ #define PUBLIC #endif #include #include char *os (void) { #ifdef __FBBDOS__ static char *my_os = "MsDos"; #endif #ifdef __WINDOWS__ static char *my_os = "Windows"; #endif #ifdef __LINUX__ static char *my_os = "Linux"; #endif return (my_os); } #if defined(__WINDOWS__) || defined(__LINUX__) tp_ems t_ems[NB_EMS] = { {"MSG", EMS_MSG}, {"BID", EMS_BID}, {"HIE", EMS_HRT}, {"FWD", EMS_FWD}, {"REJ", EMS_REJ}, {"WPG", EMS_WPG}, {"SCR", 0}, }; static int out_file (int, char *); unsigned short xendien ( unsigned short xe1 ) { unsigned short xe2; xe2 = ( xe1 & 0x00FF ) << 8 ; xe2 |= ( xe1 & 0xFF00 ) >> 8 ; return xe2 ; } unsigned long xendienl ( unsigned long xe1 ) { unsigned long xe2; xe2 = ( xe1 & 0x000000FF ) << 24 ; xe2 |= ( xe1 & 0x0000FF00 ) << 8 ; xe2 |= ( xe1 & 0x00FF0000 ) >> 8 ; xe2 |= ( xe1 & 0xFF000000 ) >> 24 ; return xe2 ; } void sortie_prg (void) { static int done = 0; if (done) return; done = 1; if (*BBS_DW) { #if defined(__WINDOWS__) || defined(__FBBDOS__) send_dos (5, BBS_DW, NULL); #endif #ifdef __LINUX__ char *pptr = BBS_DW; call_nbdos (&pptr, 1, NO_REPORT_MODE, NULL, TOOLDIR, NULL); #endif } write_heard (); /* #ifdef __WIN32__ EndThread(); #endif */ if (operationnel >= 0) { operationnel = FALSE; flush_wp_cache (); dde_wp_serv = 0; ferme_log (); #ifdef TRACE close_trace (); #endif } /* Dealloue les listes chainees */ end_pg (); /* Dealloue la chaine des PG */ end_watchdog (); end_messages (); end_admin (); end_textes (); /* end_ports (); */ end_arbre (); end_bbs (); end_parts (); end_hold (); end_themes (); end_swap (); end_beacon (); end_wp (); end_lzhuf (); end_fwd (); /* end_voies (); */ end_modem (); end_exms (); } #endif /* __WINDOWS__ */ #ifdef __FBBDOS__ /********* Test overflow ********** long maxrec; ********** Fin du test ***********/ #define BREAK tp_ems t_ems[NB_EMS] = { {"MSG", EMS_MSG}, {"BID", EMS_BID}, {"HIE", EMS_HRT}, {"FWD", EMS_FWD}, {"REJ", EMS_REJ}, {"WPG", EMS_WPG}, {"SCR", EMS_SCR}, }; /* extern unsigned _stklen = 17408; / 16384 ; / 12000 */ extern unsigned _stklen = 32768; /* 16384 ; / 12000 */ static char nom_programme[80]; static void init_mem (void); static int out_file (int, char *); /* Routine appelee avant le _exit -> directive pragma */ void sortie_prg (void) { static int done = 0; if (done) return; done = 1; if (*BBS_DW) send_dos (5, BBS_DW, NULL); write_heard (); if (operationnel >= 0) { operationnel = FALSE; flush_wp_cache (); dde_wp_serv = 0; ferme_log (); #ifdef TRACE close_trace (); #endif libere_xems (); remet_vecteurs (); } cprintf ("Exiting %d ...", type_sortie); sleep (2); sleep (2); if (!EGA) /* outportb(0x3d9, 0x0) */ ; else ega_close (); close_win (fen_dos); /* Dealloue les listes chainees */ end_pg (); /* Dealloue la chaine des PG */ end_watchdog (); end_messages (); end_admin (); end_textes (); end_ports (); end_arbre (); end_bbs (); end_parts (); end_hold (); end_themes (); end_swap (); end_beacon (); end_wp (); end_lzhuf (); end_fwd (); end_voies (); end_modem (); end_exms (); end_dll (); /* remet_dos(); */ /* Fortify_OutputAllMemory(); Fortify_DumpAllMemory(0); Fortify_LeaveScope(); */ } #ifdef __FBBDOS__ #pragma exit sortie_prg #endif main (int ac, char **av) { int voie; /* ind_noeud null_cur; daemon_mode = 0; strcpy(null_cur.indic, "NULL"); */ accept_connection = FALSE; Fortify_EnterScope (); Fortify_CheckAllMemory (); init_semaine (); /* #if FBB_DEBUG */ init_debug (_CS); /* #endif */ operationnel = -1; df ("main", 3); /* debut_fonction("main", 3, MK_FP(_SS, _BP)); */ #ifdef BREAK break_stop (); #endif strcpy (nom_programme, av[0]); vlang = -1; init_mem (); if ((ac < 2) || (strcmp (av[1], "-t") != 0)) boot_prg (); initialisations (); #ifndef BREAK dprintf ("Break off !\r\n"); #endif /* chmod(nom_programme, S_IREAD); */ /*cprintf("Voie = %d\r\n", sizeof(Svoie)); */ /*cprintf("Port = %d\r\n", sizeof(defport)); */ /*cprintf("Fwd = %d\r\n", sizeof(Forward)); */ /*sleep_(5); */ operationnel = 1; display_screen (); for (voie = 1; voie < NBVOIES; voie++) programm_indic (voie); accept_connection = TRUE; kernel (); ff (); return (0); } static void init_mem (void) { #ifndef __DPMI16__ FILE *fp; int i; char ligne[256]; char *ptr = ligne; char *scan; if ((fp = fopen ("INIT.SRV", "r")) == NULL) { #ifdef ENGLISH cprintf ("Cannot open file INIT.SRV \r\n\a"); #else cprintf ("Erreur ouverture fichier INIT.SRV\r\n\a"); #endif curon (); exit (0); } i = 0; while (fgets (ligne, 250, fp)) { ptr = sup_ln (ligne); if (*ligne == '#') continue; i++; if (i == 36) { int ems = atoi (ptr); /* in_exms = 0; */ if (ems < 0 || ems > 2) ems = 0; strtok (ptr, " ,\t"); if (ems == 2) { while (scan = strtok (NULL, " ,\t")) { strupr (scan); if (strcmp ("OVR", scan) == 0) { if (_OvrInitExt (0L, 0L) == 0) { cprintf ("XMS driver initialized\r\n"); /* sleep(5); */ } else { cprintf ("XMS driver not found\r\n"); curon (); exit (1); } } } } break; } } ferme (fp, 57); #endif } void break_stop (void) { bdos (0x33, 0x00, 0x31); /* Driver transparent */ setcbrk (0); /* breaks inhibes */ } void break_ok (void) { bdos (0x33, 0x00, 0x30); /* Driver non transparent */ setcbrk (1); /* breaks valides */ } #endif /* __FBBDOS__ */ void sleep_ (unsigned sec) { #ifdef __WINDOWS__ WinSleep (sec); #endif #ifdef __FBBDOS__ long temps; long tempo; temps = btime (); for (;;) { tempo = btime (); if (tempo < temps) break; if (tempo > (temps + (long) (sec * 18))) break; } /* tempo = sec * 18 ; while (tempo) ; */ /* attend_caractere(sec); */ #endif } void clear_inbuf (int voie) { lbuf *bptr; while (svoie[voie]->inbuf.tete) { bptr = svoie[voie]->inbuf.tete->suite; svoie[voie]->memoc -= svoie[voie]->inbuf.tete->lgbuf; m_libere ((char *) svoie[voie]->inbuf.tete->buffer, svoie[voie]->inbuf.tete->lgbuf); m_libere ((char *) svoie[voie]->inbuf.tete, sizeof (lbuf)); svoie[voie]->inbuf.tete = bptr; } svoie[voie]->inbuf.nblig = svoie[voie]->inbuf.nbcar = svoie[voie]->inbuf.nocar = 0; svoie[voie]->inbuf.curr = NULL; svoie[voie]->inbuf.ptr = NULL; } void init_timout (int voie) { time_att[voie] = svoie[voie]->timout; } void init_langue (int voie) { int v, cpt, lutil, luse, lang; nlang = svoie[voie]->finf.lang; if (nlang >= maxlang) nlang = 0; vlang = -1; for (cpt = 0; cpt < NBLANG; cpt++) { if (langue[cpt]->numlang == nlang) { vlang = cpt; break; } } if (vlang == -1) { /* swapp de la langue la moins utilisee */ lutil = MAXVOIES; for (lang = 0; lang < NBLANG; lang++) { if (langue[lang]->numlang == -1) { vlang = lang; break; } luse = 0; for (v = 0; v < NBVOIES; v++) { if ((voie != v) && (svoie[v]->sta.connect) && (svoie[v]->finf.lang == lang)) ++luse; } if (luse < lutil) { lutil = luse; vlang = lang; } } swap_langue (vlang, nlang); } Oui = *(langue[vlang]->plang[OUI - 1]); Non = *(langue[vlang]->plang[NON - 1]); } int nbl_page (int voie) { int lig; if (voie == CONSOLE) #ifdef __WINDOWS__ lig = get_win_lig (CONSOLE) - 1; #elsif __FBBDOS__ lig = (doub_fen) ? separe - (M_LIG + 2) : h_screen - console - (M_LIG + 1); #else lig = svoie[voie]->finf.nbl - 1; #endif else lig = svoie[voie]->finf.nbl - 1; return (lig); } void prog_more (int voie) { if (!(PAG (svoie[voie]->finf.flags)) || (FOR (svoie[voie]->mode)) || ((voie_forward (voie)) && (voie != CONSOLE)) || ((voie == CONSOLE) && (print)) || (svoie[voie]->binary) || (POP ( no_port(voie)))) { svoie[voie]->lignes = -1; } else { svoie[voie]->lignes = nbl_page (voie); } svoie[voie]->stop = 0; } /* Substitue les variables : */ /* mode = 1 : $W = \r */ /* mode = 2 : $W = \n */ /* mode = 3 : $W = \r\n */ static char *expand_txt (int mode, char *texte) /* Fin de ligne = Return */ { static char sbuffer[600]; char *ptr; char c; int var = 0; int nb = 0; ptr = NULL; while (1) { if (nb > 590) break; if (var) { if (*ptr) { sbuffer[nb] = *ptr++; nb++; } else var = 0; } else { if ((c = *texte++) == '\0') break; if (c == '$') { if ((c = *texte++) == '\0') break; if (c == 'W') { /* Fin de ligne */ switch (mode) { case 1: sbuffer[nb++] = '\r'; break; case 2: sbuffer[nb++] = '\n'; break; case 3: sbuffer[nb++] = '\r'; sbuffer[nb++] = '\n'; break; } } else { ptr = variable (c); var = 1; } } else if (c == '%') { if ((c = *texte++) == '\0') break; ptr = alt_variable (c); var = 1; } else { sbuffer[nb] = c; nb++; } } } sbuffer[nb] = '\0'; return (sbuffer); } char *expand (char *texte) /* Fin de ligne = LF */ { return (expand_txt (2, texte)); } char *var_txt (char *texte) /* Fin de ligne = Return */ { return (expand_txt (1, texte)); } char *var_crlf (char *texte) /* Fin de ligne = Return/LineFeed */ { return (expand_txt (3, texte)); } int outfich (char *nomfich) { /* Sortie avec variables */ return (out_file (1, nomfich)); } int outfichs (char *nomfich) { /* Sortie sans variables */ return (out_file (0, nomfich)); } int out_file (int var, char *nomfich) { int nb; char sbuffer[300]; FILE *fptr; if ((fptr = fopen (nomfich, "rt")) != NULL) { while (fgets (sbuffer, 255, fptr)) { nb = strlen (sbuffer); if (var) out (sbuffer, nb); else outs (sbuffer, nb); } ferme (fptr, 48); return (TRUE); } return (FALSE); } char *who (char *ptr) { int i = 0, j; char s[80]; char freq[80]; for (i = 2; i < NBVOIES; i++) { if (svoie[i]->sta.connect) { j = 0; sprintf (freq, "(%s)", p_port[no_port (i)].freq); sprintf (s, "Ch. %-2d %9s : %6s-%-2d - %s\r", virt_canal (i), freq, svoie[i]->sta.indicatif.call, svoie[i]->sta.indicatif.num, strdate (svoie[i]->debut)); if (ptr) { strcpy (ptr, s); ptr += strlen (s); } else outs (s, strlen (s)); if (*(svoie[i]->sta.relais[j].call)) { sprintf (s, " via : %6s-%-2d", svoie[i]->sta.relais[j].call, svoie[i]->sta.relais[j].num); if (ptr) { strcpy (ptr, s); ptr += strlen (s); } else outs (s, strlen (s)); ++j; while (*(svoie[i]->sta.relais[j].call)) { if (j == 4) { if (ptr) { strcpy (ptr, "\r "); ptr += 9; } else outs ("\n ", 9); } sprintf (s, " %6s-%-2d", svoie[i]->sta.relais[j].call, svoie[i]->sta.relais[j].num); if (ptr) { strcpy (ptr, s); ptr += strlen (s); } else outs (s, strlen (s)); ++j; } if (ptr) { *ptr++ = '\r'; *ptr = '\0'; } else outsln (" ", 1); } } } return (ptr); } void maj_niv (int nivo1, int nivo2, int nivo3) { long caltemps; if (pvoie->niv1 != nivo1) { stemps[pvoie->niv1] += (time (&caltemps) - pvoie->tstat); pvoie->tstat = caltemps; } pvoie->niv1 = nivo1; pvoie->niv2 = nivo2; pvoie->niv3 = nivo3; status (voiecur); } int num_voie (char *indic_recherche) { int i; for (i = 0; i < NBVOIES; ++i) if (svoie[i]->sta.connect && indcmp (svoie[i]->sta.indicatif.call, indic_recherche)) return (i); return (-1); } int texte (int no) { int nl = 0; char *ptr; if (langue == NULL) return (nl); ptr = langue[vlang]->plang[no - 1]; /* cprintf("Texte : <%s>\r\n", ptr) ; */ if ((no > 0) && (no <= NBTEXT)) out (ptr, strlen (ptr)); while (*ptr) { if ((*ptr == '$') && (*(ptr + 1) == 'W')) ++nl; ++ptr; } return (nl); } int incindd (void) { if (*indd) { do { ++indd; } while ((*indd) && (*indd != '\n') && (!ISGRAPH (*indd))); } return (*indd); } void selvoie (voie) { /* static int cv = -1; */ /* static Svoie curr; */ df ("selvoie", 1); /* if (voie != CONSOLE) selcanal(no_port(voie)) ; */ if (((voie >= 0) && (voie < NBVOIES)) || (voie == MWARNING)) { pvoie = svoie[voie]; voiecur = voie; ptmes = &(pvoie->entmes); } else fbb_error (ERR_CANAL, "Select channel", voie); ff (); } void deconnexion (int voie, int type) { if (voie == CONSOLE) { /* dprintf("deconnexion console\n"); */ if (pvoie->cross_connect != -1) { int save_voie = voiecur; pvoie->ch_mon = -1; selvoie (pvoie->cross_connect); dec (voiecur, 1); selvoie (save_voie); fin_tnc (); } svoie[voie]->sta.connect = 0; console_off (); maj_niv (0, 0, 0); aff_nbsta (); curseur (); if (svoie[voie]->l_yapp) { svoie[voie]->finf.lastyap = svoie[voie]->l_yapp; svoie[voie]->l_yapp = 0L; } if (svoie[voie]->curfwd) { svoie[voie]->curfwd->forward = -1; svoie[voie]->curfwd->no_bbs = 0; svoie[voie]->curfwd = NULL; } majinfo (voie, 2); #ifdef __FBBDOS__ clear_insert (); #endif libere_zones_allouees (voie); /* Vide les eventuelles listes */ aff_forward (); del_temp (voie); del_copy (voie); /* printf("Fin deconnexion console\n"); */ } else if (voie == INEXPORT) { svoie[voie]->sta.connect = 0; aff_event (voie, 2); maj_niv (0, 0, 0); aff_nbsta (); if (svoie[voie]->curfwd) { svoie[voie]->curfwd->forward = -1; svoie[voie]->curfwd->no_bbs = 0; svoie[voie]->curfwd = NULL; } /* majinfo(voie, 2); */ /* clear_insert(); */ libere_zones_allouees (voie); /* Vide les eventuelles listes */ aff_forward (); del_temp (voie); del_copy (voie); } else { dec (voie, type); } } void en_navant_toute (void) { } /* * Type = 0 : toutes les voies actives * 1 : pas la console * 2 : toutes les voies sauf la console */ int actif (int type) { int i, nb = 0; int val = (type == 2) ? 0 : 1; for (i = 1; i < NBVOIES; i++) { if (svoie[i]->sta.connect > val) nb++; } if ((type == 0) && (svoie[CONSOLE]->sta.connect)) nb++; return (nb); } char *d_disque (char *chaine) { static char s[256]; char *ptr; strcpy (s, DATADIR); ptr = s + strlen (s); while (*chaine) { *ptr++ = tolower (*chaine); ++chaine; } *ptr = '\0'; #ifdef __LINUX__ strcpy(s, back2slash(s)); #endif return (sup_ln (s)); } char *c_disque (char *chaine) { static char s[256]; char *ptr; strcpy (s, CONFDIR); ptr = s + strlen (s); while (*chaine) { *ptr++ = tolower (*chaine); ++chaine; } *ptr = '\0'; #ifdef __LINUX__ strcpy(s, back2slash(s)); #endif return (sup_ln (s)); } void test_disque () { #if defined(__WINDOWS__) || defined(__FBBDOS__) char texte[300]; unsigned long mfree; mfree = free_disk (0); #ifdef ENGLISH cprintf ("Disk space available : %ld \r\n\n", mfree); #else cprintf ("Espace disque disponible : %ld\r\n\n", mfree); #endif if (mfree < 1000L) { #ifdef ENGLISH sprintf (texte, "Warning ! Disk space available on disk %c: = %ld bytes. \r", getdisk () + 'A', mfree * 1024UL); #else sprintf (texte, "Attention ! Stockage disponible sur le disque %c: = %ld octets.\r", getdisk () + 'A', mfree * 1024UL); #endif cprintf (texte); if (w_mask & W_DISK) { #ifdef ENGLISH mess_warning (admin, "*** WARNING : DISK *** ", texte); #else mess_warning (admin, "*** ATTENTION DISQUE ***", texte); #endif } } #endif } int find (char *s) { char *t = s; int n = 0; int dernier = 0, chiffre = 0, lettre = 0; /* Pour valider 50MHz */ if (isdigit (s[0]) && isdigit (s[1])) return (FALSE); while (*t) { /*** Test rajoute ***/ if (!isalnum (*t)) return (FALSE); *t = toupper (*t); dernier = (isdigit (*t)); if (isdigit (*t)) ++chiffre; else ++lettre; ++t; ++n; } /* *t = '\0' ; */ if (strcmp ("SYSOP", s) == 0) return (TRUE); if (strcmp ("WP", s) == 0) return (TRUE); if (std_header & 4096) { /* * L'indicatif doit avoir entre 3 et 6 caracteres . * doit contenir au moins un chiffre * doit contenir au moins une lettre */ if ((n < 3) || (n > 6) || (chiffre < 1) || (lettre < 1)) return (FALSE); } else { /* * L'indicatif doit avoir entre 3 et 6 caracteres . * doit contenir 1 ou 2 chiffres * et finir par une lettre. */ if ((n < 3) || (n > 6) || (chiffre < 1) || (chiffre > 2) || dernier) return (FALSE); } return (TRUE); } fbb-7.04j/src/arbre.c0100644000175100017510000001701707726646105012453 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * ARBRE.C * */ #include static void aff_ind (char *, char *); void end_arbre (void) { bloc_indic *bptr; iliste *temp; iliste *c_iliste = t_iliste.suiv; /* Libere l'arbre des indicatifs */ while (racine) { bptr = racine; racine = racine->suiv; m_libere (bptr, sizeof (bloc_indic)); } /* Libere la liste des indicatifs balise */ while (c_iliste) { temp = c_iliste; c_iliste = c_iliste->suiv; m_libere (temp, sizeof (iliste)); } t_iliste.suiv = NULL; } ind_noeud *insnoeud (char *indic_om, unsigned *no_indic) { int i; int trouve = 0; char om[10]; char *ptr_om = om; int offset = 0; unsigned num_ind = 0; bloc_indic *bptr = racine; static ind_noeud *pnoeud; i = 0; while ((*ptr_om++ = *indic_om++) != '\0') { if (i++ == 9) { *ptr_om = '\0'; break; } } while (bptr) { pnoeud = &(bptr->st_ind[offset]); if (*(pnoeud->indic) == '\0') break; if (strncmp (om, pnoeud->indic, 6) == 0) { trouve = 1; break; } if (++offset == T_BLOC_INFO) { if (!bptr->suiv) bptr->suiv = new_bloc_info (); bptr = bptr->suiv; offset = 0; } ++num_ind; } if (!trouve) { n_cpy (6, pnoeud->indic, om); pnoeud->coord = 0xffff; pnoeud->nbmess = (short) 0; pnoeud->nbnew = (short) 0; pnoeud->val = 1; } *no_indic = num_ind; return (pnoeud); } /* * Pointe sur le dernier bloc */ bloc_mess *last_dir () { bloc_mess *temp = tete_dir; while (temp->suiv) temp = temp->suiv; /* aller au dernier bloc */ return (temp); } /* * Pointe sur le bloc precedent */ bloc_mess *prec_dir (bloc_mess * bptr) { bloc_mess *temp = tete_dir; while (temp->suiv) { if (temp->suiv == bptr) return (temp); temp = temp->suiv; } return (NULL); } /* * Insere un message dans la liste de directory */ int insmess (unsigned r, unsigned num_ind, long numero) { int i; bloc_mess *temp = tete_dir; while (temp->suiv) temp = temp->suiv; /* aller au dernier bloc */ for (i = 0; ((i < T_BLOC_MESS) && (temp->st_mess[i].nmess)); i++) ; if (i == T_BLOC_MESS) { temp->suiv = new_bloc_mess (); temp = temp->suiv; i = 0; } temp->st_mess[i].nmess = numero; temp->st_mess[i].noenr = r; temp->st_mess[i].no_indic = num_ind; return (1); } /* * Cherche un message deja insere dans la liste de directory */ mess_noeud *findmess (long numero) { int i; bloc_mess *temp = tete_dir; if (numero == 0L) return (NULL); while (temp->suiv) { if (temp->suiv->st_mess[0].nmess > numero) break; temp = temp->suiv; } for (i = 0; i < T_BLOC_MESS; i++) { if (temp->st_mess[i].nmess == numero) return (&temp->st_mess[i]); } return (NULL); } /* * Valide un message deja insere dans la liste de directory */ void valmess (bullist * bptr) { mess_noeud *mptr; if ((mptr = findmess (bptr->numero)) != NULL) { ouvre_dir (); write_dir (mptr->noenr, bptr); ferme_dir (); insarbre (bptr); } } /* * Change le numero du destinataire d'un message dans la liste de directory */ void chg_mess (unsigned num_ind, long numero) { mess_noeud *mptr; if ((mptr = findmess (numero)) != NULL) mptr->no_indic = num_ind; } unsigned insarbre (bullist * pbuf) { char temp[2]; unsigned no_indic; ind_noeud *noeud; if ((pbuf->status == 'A') || (pbuf->status == 'K')) return (0xffff); if (isdigit (pbuf->type)) { temp[0] = pbuf->type; temp[1] = '\0'; noeud = insnoeud (temp, &no_indic); } else { noeud = insnoeud (pbuf->desti, &no_indic); } if (pbuf->status != 'H') { ++(noeud->nbmess); if (pbuf->status == 'N') ++(noeud->nbnew); } return (no_indic); } void inscoord (unsigned r, info * pbuf, ind_noeud * pnoeud) { char om[80]; char *indic_om = pbuf->indic.call; char *ptr_om = om; if ((isdigit (*indic_om)) && (strlen (indic_om) == 1)) { strcpy (om, indic_om); } else { while ((*ptr_om++ = *indic_om++) != '\0'); } n_cpy (6, pnoeud->indic, om); pnoeud->coord = r; pnoeud->val = (uchar) (EXC (pbuf->flags) == 0); pnoeud->nbmess = (short) 0; pnoeud->nbnew = (short) 0; } void connexion (int voie) { svoie[voie]->ncur = insnoeud (svoie[voie]->sta.indicatif.call, &(svoie[voie]->no_indic)); aff_nbsta (); } ind_noeud *cher_noeud (char *indic_om) { int trouve = 0; int offset = 0; bloc_indic *bptr = racine; ind_noeud *pnoeud = NULL; while (bptr) { pnoeud = &(bptr->st_ind[offset]); if (*(pnoeud->indic) == '\0') break; if (strncmp (indic_om, pnoeud->indic, 6) == 0) { trouve = 1; break; } if (++offset == T_BLOC_INFO) { bptr = bptr->suiv; offset = 0; } } if (!trouve) pnoeud = NULL; return (pnoeud); } unsigned chercoord (char *indic_om) { ind_noeud *noeud = cher_noeud (indic_om); if (noeud) return (noeud->coord); else return (0xffff); } /* * Liste des destinataires prives -> balise */ void ins_iliste (bullist * buf) { int cmp; iliste *temp, *prec; iliste *c_iliste = &t_iliste; if ((*buf->bbsv) && (!hiecmp (mypath, buf->bbsv))) return; if (buf->status == 'H') return; if ((buf->type == 'P') && (buf->status != 'N')) return; if (strcmp (buf->desti, "WP") == 0) return; if ((buf->type != 'P') && ( (balbul == 0) || (buf->status == 'X') || (buf->status == 'K') || (buf->status == 'A') )) return; prec = c_iliste; while ((c_iliste = c_iliste->suiv) != NULL) { cmp = strcmp (c_iliste->indic, buf->desti); if (cmp == 0) return; if (cmp > 0) break; prec = c_iliste; } temp = (iliste *) m_alloue (sizeof (iliste)); prec->suiv = temp; temp->suiv = c_iliste; strcpy (temp->indic, buf->desti); } void list_new (char *chaine) { iliste *prec; int flag_l, nombre = max_indic; ind_noeud *noeud; unsigned num_indic; *chaine = '\0'; flag_l = FALSE; while (nombre) { if (t_iliste.suiv == NULL) break; prec = p_iliste; if (p_iliste == &t_iliste) flag_l = TRUE; p_iliste = p_iliste->suiv; if (p_iliste == NULL) { p_iliste = &t_iliste; if (flag_l) break; continue; } noeud = insnoeud (p_iliste->indic, &num_indic); if (noeud->nbnew == 0) { prec->suiv = p_iliste->suiv; m_libere (p_iliste, sizeof (iliste)); p_iliste = prec; continue; } aff_ind (noeud->indic, chaine); nombre--; } if (*chaine == '\0') strcpy (chaine, " None"); } static void aff_ind (char *indptr, char *indch) { strcat (indch, " "); strcat (indch, indptr); } bloc_indic *new_bloc_info (void) { int i; bloc_indic *bptr = (bloc_indic *) m_alloue (sizeof (bloc_indic)); bptr->suiv = NULL; for (i = 0; i < T_BLOC_INFO; i++) *(bptr->st_ind[i].indic) = '\0'; return (bptr); } fbb-7.04j/src/autobin.c0100644000175100017510000001642107726646105013017 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* * Module transfert de fichiers binaires. protocole AUTOBIN. */ #if defined(__WINDOWS__) || defined(__LINUX__) char *abin_str (int voie, char *s) { #define XMODLEN 44 static char stdesc[8][11] = { "SendInit ", "SendInit ", "SendData ", "SendEof ", " ", "WaitRecv ", "RecvData ", "RecvEof " }; char taille[40]; int niv = svoie[voie]->niv3; *s = '\0'; if ((niv >= 0) && (niv < 10)) { if (svoie[voie]->tailm) { sprintf (taille, "/%ld", svoie[voie]->tailm); } else { *taille = '\0'; } sprintf (s, "ABin:%s %s %ld%s", stdesc[niv], svoie[voie]->appendf, svoie[voie]->enrcur, taille); } return s; } static void aff_bin (int ok) { } #else static void aff_bin (int ok) { #define XMODLEN 44 static char stdesc[8][11] = { "SendInit ", "SendInit ", "SendData ", "SendEof ", " ", "WaitRecv ", "RecvData ", "RecvEof " }; char s[80]; char taille[40]; int n; int niv = pvoie->niv3; *s = '\0'; if (ok) { if ((niv >= 0) && (niv < 10)) { if (pvoie->tailm) { sprintf (taille, "/%ld", pvoie->tailm); } else { *taille = '\0'; } sprintf (s, "ABin:%s %s %ld%s", stdesc[niv], pvoie->appendf, pvoie->enrcur, taille); } } for (n = strlen (s); n < XMODLEN; n++) s[n] = ' '; s[XMODLEN] = '\0'; aff_chaine (W_DEFL, 17, 3, s); } #endif static void compute_CRC (short ch, short *crc) { short hibit; short shift; for (shift = 0x80; shift; shift >>= 1) { hibit = *crc & 0x8000; *crc <<= 1; *crc |= (ch & shift ? 1 : 0); if (hibit) *crc ^= 0x1021; } } static void wrbuf (void) { int i; int ncars; int nbcar = nb_trait; uchar *uptr; obuf *msgtemp; char *ptcur; char *ptr; uptr = data; for (i = 0; i < nbcar; i++) { compute_CRC ((short) *uptr, (short *) &pvoie->checksum); uptr++; } pvoie->enrcur += (long) nbcar; pvoie->size_trans += (long) nbcar; if ((msgtemp = pvoie->msgtete) != NULL) { while (msgtemp->suiv) msgtemp = msgtemp->suiv; } else { msgtemp = (obuf *) m_alloue (sizeof (obuf)); pvoie->msgtete = msgtemp; msgtemp->nb_car = msgtemp->no_car = 0; msgtemp->suiv = NULL; } ncars = msgtemp->nb_car; ptcur = msgtemp->buffer + ncars; ptr = data; while (nbcar--) { ++pvoie->memoc; *ptcur++ = *ptr++; if (++ncars == 250) { msgtemp->nb_car = ncars; msgtemp->suiv = (obuf *) m_alloue (sizeof (obuf)); msgtemp = msgtemp->suiv; msgtemp->nb_car = msgtemp->no_car = ncars = 0; msgtemp->suiv = NULL; ptcur = msgtemp->buffer; } } msgtemp->nb_car = ncars; if (pvoie->memoc > MAXMEM) { write_mess_temp (O_BINARY, voiecur); } } void bin_transfer (void) { char s[80]; struct stat bufstat; var_cpy (0, "AUTOBIN"); switch (pvoie->niv3) { case 0: strtok (indd, " \r"); if ((indd = strtok (NULL, " \r")) == NULL) { yapp_message (T_ERR + 20); retour_appel (); break; } if ((voiecur == CONSOLE) || ((!P_YAPP (voiecur)) && (!SYS (pvoie->finf.flags)))) { yapp_message (T_YAP + 2); retour_appel (); break; } if ((tst_point (indd)) && (stat (nom_yapp (), &bufstat) != -1) && ((bufstat.st_mode & S_IFREG) != 0)) { if (pvoie->kiss != -2) texte (T_YAP + 0); pvoie->tailm = pvoie->enrcur = 0L; pvoie->size_trans = 0L; pvoie->xferok = 1; pvoie->type_yapp = 4; pvoie->tailm = file_size (pvoie->sr_fic); sprintf (s, "#BIN#%ld", pvoie->tailm); outln (s, strlen (s)); aff_bin (1); ch_niv3 (1); } else { /* ok = 0; */ yapp_message (T_ERR + 11); retour_appel (); } break; case 1: if (strnicmp (indd, "#OK#", 4) == 0) { ch_niv3 (2); pvoie->size_trans = 0L; pvoie->time_trans = 0L; pvoie->checksum = 0; set_binary (voiecur, 1); bin_transfer (); } else { aff_bin (0); retour_appel (); } break; case 2: pvoie->lignes = -1; if (strnicmp (indd, "#ABORT#", 7) == 0) { set_binary (voiecur, 0); clear_outbuf (voiecur); retour_dos (); aff_bin (0); break; } if (senddata (1) == 1) { aff_etat ('E'); send_buf (voiecur); set_binary (voiecur, 0); ch_niv3 (3); } aff_bin (1); break; case 3: sprintf (s, "BIN-TX OK #%u ", 0xffff & pvoie->checksum); outln (s, strlen (s)); pvoie->finf.download += (int) (pvoie->size_trans / 1024L); retour_dos (); aff_bin (0); break; case 4: strtok (indd, " \r"); if ((indd = strtok (NULL, " \r")) == NULL) { yapp_message (T_ERR + 20); retour_appel (); break; } if ((voiecur == CONSOLE) || ((!P_YAPP (voiecur)) && (!SYS (pvoie->finf.flags)))) { yapp_message (T_YAP + 2); /* ok = 0; */ retour_appel (); break; } if (read_only ()) retour_appel (); else { int fd; if ((tst_point (indd)) && (stat (nom_yapp (), &bufstat) == -1)) { /*fd = creat (pvoie->sr_fic, S_IREAD | S_IWRITE); */ fd = open (pvoie->sr_fic, O_CREAT | O_WRONLY | O_TRUNC, S_IREAD | S_IWRITE); if (fd > 0) { close (fd); unlink (pvoie->sr_fic); pvoie->tailm = pvoie->enrcur = 0L; texte (T_YAP + 1); ch_niv3 (5); aff_bin (1); } else { /* ok = 0; */ yapp_message (T_ERR + 30); retour_appel (); } } else { /* ok = 0; */ yapp_message (T_ERR + 23); retour_appel (); } } break; case 5: if (strnicmp (indd, "#BIN#", 5) == 0) { outln ("#OK#", 4); aff_etat ('E'); send_buf (voiecur); del_temp (voiecur); new_label (); pvoie->tailm = atol (indd + 5); pvoie->enrcur = 0L; pvoie->checksum = 0; pvoie->size_trans = 0L; pvoie->time_trans = time (NULL); set_binary (voiecur, 1); pvoie->xferok = 0; pvoie->type_yapp = 4; ch_niv3 (6); aff_bin (1); } else { retour_appel (); aff_bin (0); } break; case 6: wrbuf (); aff_bin (1); if (pvoie->enrcur == pvoie->tailm) { pvoie->xferok = 2; write_mess_temp (O_BINARY, voiecur); if (test_temp (voiecur)) { /* Le fichier est mis en place */ rename_temp (voiecur, pvoie->sr_fic); wr_dir (pvoie->sr_fic, pvoie->sta.indicatif.call); } set_binary (voiecur, 0); sprintf (s, "BIN-RX OK #%u ", 0xffff & pvoie->checksum); outln (s, strlen (s)); ch_niv3 (7); aff_bin (1); } break; case 7: retour_appel (); aff_bin (0); break; } } fbb-7.04j/src/balise.c0100644000175100017510000003374407726646105012624 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * BALISE.C Gestion de la balise * */ #include #define INT14 0x14 #define INT7F 0x7f typedef struct typ_ddes { char indic[8]; long numero; int port; struct typ_ddes *suiv; } Ddes; static Beacon *tete_beacon[NBPORT]; static long current_bcl[NBPORT]; /* Message BCL en cours */ static Ddes *t_ddes[NBPORT]; static char *broadcast_bloc (int); static char *broadcast_line (long); static char *via (char *); static void broadcast_port (int, char *); static void mode_binaire (int); static void send_broadcast (int, char *, int); static void set_beacon (char *, Beacon *); static void set_bcall (char *, indicat *); static void free_beacon (int port) { Beacon *ptemp; Beacon *pb = tete_beacon[port]; while (pb) { ptemp = pb; pb = pb->next; m_libere (ptemp, sizeof (Beacon)); } tete_beacon[port] = NULL; } void end_beacon (void) { int port; for (port = 0; port < NBPORT; port++) free_beacon (port); } static void add_beacon (int port, char *texte) { Beacon *pb = tete_beacon[port]; if (pb) { while (pb->next) { pb = pb->next; } pb->next = (Beacon *) m_alloue (sizeof (Beacon)); pb = pb->next; } else { pb = tete_beacon[port] = (Beacon *) m_alloue (sizeof (Beacon)); } set_beacon (texte, pb); pb->next = NULL; } static void set_bcall (char *callsign, indicat * call_str) { int i = 0; char *ptr = call_str->call; df ("set_bcall", 4); call_str->num = 0; if (callsign == NULL) { *ptr = '\0'; ff (); return; } strupr (callsign); while ((*callsign) && (!isalnum (*callsign))) ++callsign; while (isalnum (*callsign)) if (i++ < 6) *ptr++ = *callsign++; *ptr = '\0'; while ((*callsign) && (!isdigit (*callsign))) ++callsign; i = 0; while (isdigit (*callsign)) { i *= 10; i += (*callsign++ - '0'); } if ((i >= 0) && (i <= 15)) call_str->num = i; ff (); } static void set_beacon (char *path, Beacon * beacon) { int i = 0; char *ptr; beacon->nb_digi = 0; ptr = strtok (path, " ,\r\n"); set_bcall (ptr, &beacon->desti); ptr = strtok (NULL, " ,\r\n"); if (ptr) { strupr (ptr); if (((strlen (ptr) == 1) && (*ptr == 'V')) || ((strlen (ptr) == 3) && (strcmp (ptr, "VIA") == 0))) { ptr = strtok (NULL, " ,\r\n"); } } for (i = 0; i < 8; i++) { if (ptr) ++beacon->nb_digi; set_bcall (ptr, &beacon->digi[i]); ptr = strtok (NULL, " ,\r\n"); } } static void aff_ui (int port, char *line) { int nbcar; nbcar = strlen (line); put_ui (line, W_CNST, nbcar); } void dde_synchro (char *indic, long num, int port) { Ddes *ptemp; char line[80]; sprintf (line, "[%d] Broadcast SYNC #%ld asked fm %s", port, num, indic); aff_ui (port, line); if (p_port[port].moport & 0x20) { if (t_ddes[port]) { ptemp = t_ddes[port]; while (ptemp->suiv) ptemp = ptemp->suiv; ptemp->suiv = (Ddes *) m_alloue (sizeof (Ddes)); ptemp = ptemp->suiv; } else { ptemp = t_ddes[port] = (Ddes *) m_alloue (sizeof (Ddes)); } ptemp->suiv = NULL; strn_cpy (6, ptemp->indic, indic); ptemp->numero = num; ptemp->port = port; } else { sprintf (line, "[%d] Port %d not allowed for unproto lists !", port, port); aff_ui (port, line); } } void send_balise (int port) { static int first = 1; FILE *fptr; char *ptr; char sbuffer[600]; int c, var, nb, pos = 0; int maxcar; int debut = 1; Beacon *pb; df ("send_balise", 1); aff_etat ('B'); if (first) { first = 0; for (nb = 0; nb < NBPORT; nb++) { t_ddes[nb] = NULL; tete_beacon[nb] = NULL; current_bcl[nb] = nomess; } } free_beacon (port); if (p_port[port].pvalid) { sprintf (sbuffer, "BEACON%d.SYS", port); if ((fptr = fopen (c_disque (sbuffer), "rt")) != NULL) { maxcar = p_port[port].beacon_paclen; if (maxcar == 0) maxcar = 128; nb = 0; vlang = 0; /* langue primaire */ var = FALSE; ptr = NULL; while (1) { if (var) { if (*ptr) { sbuffer[nb] = *ptr++; nb++; } else var = FALSE; } else { if ((c = fgetc (fptr)) == EOF) break; if ((pos == 0) && (c == '%')) { fscanf (fptr, "%d", &t_balise[port]); t_balise[port] *= 60; fgetc (fptr); } else if ((pos == 0) && (c == '!')) { fgets (sbuffer, 80, fptr); add_beacon (port, sbuffer); nb = 0; } else { if (tete_beacon[port] == NULL) { strcpy(sbuffer, "MAIL"); add_beacon (port, sbuffer); } if ((debut) && (p_port[port].moport & 0x20)) { if (current_bcl[port] == nomess) { sprintf (sbuffer, "%-6ld !!\r", nomess); send_broadcast (port, sbuffer, strlen (sbuffer)); } debut = 0; } ++pos; if (c == '$') { if ((c = fgetc (fptr)) == EOF) break; ptr = variable (c); var = TRUE; } else if (c == '%') { if ((c = fgetc (fptr)) == EOF) break; ptr = alt_variable (c); var = TRUE; } else { if (c == '\n') { sbuffer[nb] = '\r'; ++nb; pos = 0; } else if (c != '\r') { sbuffer[nb] = c; nb++; } } } } if (nb == maxcar) { for (pb = tete_beacon[port]; pb ; pb = pb->next) { snd_drv (port, UNPROTO, sbuffer, nb, pb); } nb = 0; } } ferme (fptr, 12); if (nb) { for (pb = tete_beacon[port]; pb ; pb = pb->next) { snd_drv (port, UNPROTO, sbuffer, nb, pb); } } } } ff (); } static char *via (char *bbsv) { int lg = 0; static char buffer[40]; char *ptr = buffer; if (*bbsv) { *ptr++ = '@'; ++lg; } while (isalnum (*bbsv)) { *ptr++ = *bbsv++; if (++lg == 7) break; } while (lg++ < 7) *ptr++ = ' '; *ptr = '\0'; return (buffer); } static void send_broadcast (int port, char *buffer, int len) { indicat sav_beacon; Beacon *pb = tete_beacon[port]; if ((len == 0) || (*buffer == '\0')) return; while (pb) { sav_beacon = pb->desti; strcpy (pb->desti.call, "FBB"); pb->desti.num = 0; snd_drv (port, UNPROTO, buffer, len, pb); pb->desti = sav_beacon; pb = pb->next; } } void broadcast_port (int port, char *chaine) { int len; int lt; char bloc[256]; char tampon[90]; char *optr; int maxcar = p_port[port].pk_t; if (maxcar == 0) maxcar = 128; *bloc = '\0'; len = 0; while (*chaine) { optr = tampon; lt = 0; for (;;) { *optr++ = *chaine; ++lt; if ((*chaine++ == '\r') || (lt == 89)) { break; } } *optr = '\0'; if ((len + lt) > maxcar) { if (*bloc) { send_broadcast (port, bloc, len); *bloc = '\0'; len = 0; } else { send_broadcast (port, tampon, lt); *tampon = '\0'; lt = 0; } } strcat (bloc, tampon); len += lt; } send_broadcast (port, bloc, len); } static char *broadcast_line (long numero) { static char sbuffer[90]; char titre[40]; bullist bull; bullist *sav; int ok = 0; sav = ptmes; ptmes = • if (ch_record (NULL, numero, '\0')) { ok = 1; } if (ok && (strcmp (ptmes->desti, "KILL") == 0)) ok = 0; if (ok && (strcmp (ptmes->desti, "WP") == 0)) ok = 0; if (ok && (ptmes->type == 'A') && (!ack_unproto)) ok = 0; if (ok && (ptmes->type != 'B')) { if ((*ptmes->bbsv == '\0') && (!priv_unproto)) ok = 0; } if (ok && (ptmes->type != 'B')) { if ((*ptmes->bbsv) && (!via_unproto)) ok = 0; } if (ok && ((ptmes->status == 'A') || (ptmes->status == 'K'))) ok = 0; if (ok) { if ((mute_unproto) && (ptmes->type == 'P')) strcpy (titre, "***"); else n_cpy (34, titre, ptmes->titre); sprintf (sbuffer, "%-6ld %c %6ld %-6s%s %-6s %s %s\r", ptmes->numero, ptmes->type, (ptmes->taille > 1000000L) ? 999999L : ptmes->taille, ptmes->desti, via (ptmes->bbsv), ptmes->exped, date_mbl (ptmes->date), titre); } else sprintf (sbuffer, "%-6ld #\r", numero); ptmes = sav; return (sbuffer); } static char *broadcast_bloc (int port) { FILE *fptr; info frec; int back_mess = 0; int offset; long dde_bcl; char *ptr; Ddes *ptemp; ind_noeud *exp; bloc_mess *bptr; mess_noeud *mptr; unsigned num_indic; bullist bul; static char beacon_buffer[256]; char line[80]; *beacon_buffer = '\0'; *line = '\0'; while (t_ddes[port]) { /* Demande de synchro */ dde_bcl = t_ddes[port]->numero; if ((nomess - dde_bcl) > nb_unproto) dde_bcl = nomess - nb_unproto; else back_mess = 1; /* cherche les prives eventuels et envoie le premier ... */ exp = insnoeud (t_ddes[port]->indic, &num_indic); if (exp->coord != 0xffff) { fptr = ouvre_nomenc (); fseek (fptr, (long) exp->coord * sizeof (frec), 0); fread (&frec, sizeof (info), 1, fptr); ferme (fptr, 79); if (!UNP (frec.flags)) { sprintf (beacon_buffer, "%-6ld / %s\r", current_bcl[port], t_ddes[port]->indic); sprintf (line, "[%d] U Flag not set for %s, stopped !", port, t_ddes[port]->indic); aff_ui (port, line); back_mess = 1; } else { if (nomess <= dde_bcl) { sprintf (beacon_buffer, "%-6ld !!\r", nomess); sprintf (line, "[%d] %s asked %ld, end of list %ld !", port, t_ddes[port]->indic, dde_bcl, nomess); aff_ui (port, line); back_mess = 1; } else { ouvre_dir (); bptr = tete_dir; offset = 0; if (dde_bcl < current_bcl[port]) { current_bcl[port] = dde_bcl; } sprintf (line, "[%d] %s allowed, resync to %ld", port, t_ddes[port]->indic, current_bcl[port]); aff_ui (port, line); while (bptr) { mptr = &(bptr->st_mess[offset]); if ((mptr->noenr) && (mptr->no_indic == num_indic)) { read_dir (mptr->noenr, &bul); /* if ((bul.status != 'K') && (bul.status != 'H') && (bul.status != 'A')) { */ if (bul.status == 'N') { if ((bul.numero > t_ddes[port]->numero) && (bul.numero <= current_bcl[port])) { sprintf (line, "[%d] %s unread private %ld", port, t_ddes[port]->indic, bul.numero - 1); aff_ui (port, line); sprintf (beacon_buffer, "%-6ld ! %s\r", bul.numero - 1, t_ddes[port]->indic); ptr = broadcast_line (bul.numero); strcat (beacon_buffer, ptr); back_mess = 1; break; } } } if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } } ferme_dir (); } } } else { sprintf (line, "[%d] Unknown callsign %s, stopped !", port, t_ddes[port]->indic); aff_ui (port, line); sprintf (beacon_buffer, "%-6ld / %s\r", current_bcl[port], t_ddes[port]->indic); back_mess = 1; } if (back_mess == 0) { sprintf (line, "[%d] %s, end of list %ld", port, t_ddes[port]->indic, current_bcl[port]); aff_ui (port, line); sprintf (beacon_buffer, "%-6ld ! %s\r", current_bcl[port], t_ddes[port]->indic); } ptemp = t_ddes[port]; t_ddes[port] = t_ddes[port]->suiv; m_libere (ptemp, sizeof (Ddes)); } if (back_mess == 0) { for (;;) { if (current_bcl[port] == nomess) break; ptr = broadcast_line (current_bcl[port] + 1); if ((strlen (beacon_buffer) + strlen (ptr)) > 250) { break; } strcat (beacon_buffer, ptr); ++current_bcl[port]; } } return (beacon_buffer); } void broadcast_list (void) { int port; char *ptr; df ("broadcast_list", 0); for (port = 1; port < NBPORT; port++) { if ((p_port[port].pvalid) && (p_port[port].moport & 0x20)) { if ((t_ddes[port] == NULL) && (current_bcl[port] == nomess)) continue; ptr = broadcast_bloc (port); if (*ptr == '\0') { ff (); return; } broadcast_port (port, ptr); } } ff (); } static void mode_binaire (int voie) { if (svoie[voie]->binary == 0) { clear_inbuf (voie); time_yapp[voie] = -1; set_binary(voie, 1); } } void send_bin_message (void) { switch (pvoie->niv3) { case 5: env_message (); break; case 6: if (bin_message (pvoie->t_read) == 0) { ch_niv3 (5); env_message (); } break; } if (pvoie->niv3 == 2) { retour_mbl (); pvoie->temp1 = -2; } } void send_binary_mess (void) { long no; long seek_offset; int nb = 0; bullist *pbul; rd_list *ptemp = NULL; init_fb_mess (voiecur); incindd (); pvoie->fbb = 1; if ((no = lit_chiffre (0)) != 0) { seek_offset = 0L; if (*indd == '!') { ++indd; pvoie->fbb = 2; seek_offset = lit_chiffre (0); } if (ptemp) { ptemp->suite = (rd_list *) m_alloue (sizeof (rd_list)); ptemp = ptemp->suite; } else { pvoie->t_read = ptemp = (rd_list *) m_alloue (sizeof (rd_list)); } ptemp->pmess = &(pvoie->fb_mess[nb]); ptemp->suite = NULL; ptemp->nmess = no; ptemp->verb = 1; if ((pbul = ch_record (NULL, no, 'Y')) != NULL) { if (droit_ok (pbul, 1)) { pvoie->fb_mess[nb] = *pbul; pvoie->fb_mess[nb].taille = seek_offset; } else { ptemp->verb = 0; } } else { ptemp->verb = 0; } } mode_binaire (voiecur); pvoie->enrcur = 0L; maj_niv (N_RBIN, 0, 5); send_bin_message (); pvoie->temp1 = -2; /* Demande la suppression des messages apres envoi */ } fbb-7.04j/src/bidexms.c0100644000175100017510000001773407726646105013021 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Gestion des BID memoire EMS/XMS * */ #include static unsigned nb_record; static void tst_vbid (bullist *, int, int *); static void tst_bid (bullist *, int, int *); static int where_bid (char *bid); /* * Routines standard */ void w_bid (void) { int i; long lnb, maxbid; char *ptr; FILE *fptr; bidfwd fwbid; maxbid = maxbbid; if ((fptr = fopen (d_disque ("WFBID.SYS"), "r+b")) == NULL) { #ifdef ENGLISH if (!svoie[CONSOLE]->sta.connect) cprintf ("\r\nWarning : Creating file WFBID.SYS \r\n\n"); #else if (!svoie[CONSOLE]->sta.connect) cprintf ("\r\nWarning : Cration du fichier WFBID.SYS\r\n\n"); #endif if ((fptr = fopen (d_disque ("WFBID.SYS"), "wb")) == NULL) { #ifdef ENGLISH cprintf ("\r\nError : Impossible to open file WFBID.SYS \r\n\n"); #else cprintf ("\r\nErreur : Impossible ouvrir fichier WFBID.SYS\r\n\n"); #endif fbb_error (ERR_CREATE, d_disque ("WFBID.SYS"), 0); } ptr = (char *) &fwbid; for (i = 0; i < sizeof (bidfwd); i++) *ptr++ = '\0'; fwrite (&fwbid, sizeof (bidfwd), 1, fptr); rewind (fptr); } fread (&fwbid, sizeof (fwbid), 1, fptr); ++fwbid.numero; if ((fwbid.numero > maxbid) || (fwbid.numero < 1L)) fwbid.numero = 1L; lnb = fwbid.numero; rewind (fptr); fwrite (&fwbid, sizeof (fwbid), 1, fptr); fseek (fptr, fwbid.numero * sizeof (bidfwd), 0); fwbid.mode = ptmes->type; strncpy (fwbid.fbid, ptmes->bid, 12); fwbid.fbid[12] = '\0'; fwbid.numero = ptmes->numero; fwrite (&fwbid, sizeof (fwbid), 1, fptr); ferme (fptr, 59); --lnb; if (bid_ptr) { /* Mise a jour du tableau */ ptr = bid_ptr + (int) (BIDCOMP * lnb); memcpy (ptr, comp_bid (ptmes->bid), BIDCOMP); } else if (EMS_BID_OK ()) { write_bid ((int) lnb, comp_bid (ptmes->bid)); } } int search_bid (char *bid) { int i; char *ptr; char t_bid[BIDCOMP]; if (bid_ptr) { memcpy (t_bid, comp_bid (bid), BIDCOMP); ptr = bid_ptr; for (i = 0; i < maxbbid; i++) { if (memcmp (ptr, t_bid, BIDCOMP) == 0) { return (i + 1); } ptr += BIDCOMP; } return (0); } else if (EMS_BID_OK ()) return (where_exms_bid (bid)); else return (where_bid (bid)); } void libere_bid (void) { if (bid_ptr) { m_libere (bid_ptr, (unsigned) (BIDCOMP * maxbbid)); bid_ptr = NULL; } } void end_bids (void) { libere_bid (); } void cree_bid (void) { int i; FILE *fptr; bidfwd fwbuf; char *ptr; #if defined(__WINDOWS__) || defined(__LINUX__) char buffer[80]; #endif #ifdef __FBBDOS__ fen *fen_ptr; #endif /* bid_exms = 0; */ nb_record = 0; if ((fptr = fopen (d_disque ("WFBID.SYS"), "rb")) == NULL) return; if (fread (&fwbuf, sizeof (bidfwd), 1, fptr) == 0) return; deb_io (); #ifdef __FBBDOS__ fen_ptr = open_win (10, 5, 50, 8, INIT, "BID"); #endif if (EMS_BID_OK ()) { init_exms_bid (fptr); } else { if ((bid_ptr == NULL) && (maxbbid <= 5000) && (tot_mem > 100000L)) { bid_ptr = m_alloue ((unsigned) (BIDCOMP * maxbbid)); memset (bid_ptr, 0, (size_t) maxbbid * BIDCOMP); ptr = bid_ptr; for (i = 0; i < maxbbid; i++) { if ((i % 500) == 0) { #if defined(__WINDOWS__) || defined(__LINUX__) InitText (ltoa ((long) i, buffer, 10)); #endif #ifdef __FBBDOS__ cprintf ("\r%d BIDs", i); #endif } fread (&fwbuf, sizeof (bidfwd), 1, fptr); memcpy (ptr, comp_bid (fwbuf.fbid), BIDCOMP); ptr += BIDCOMP; } #if defined(__WINDOWS__) || defined(__LINUX__) InitText (ltoa ((long) i, buffer, 10)); #endif #ifdef __FBBDOS__ cprintf ("\r%d BIDs", i); #endif } } ferme (fptr, 71); #ifdef __FBBDOS__ sleep_ (1); close_win (fen_ptr); #endif fin_io (); } static void tst_bid (bullist * fb_mess, int nb, int *t_res) { int i, j, res; FILE *fptr; bidfwd fwbid; if ((fptr = fopen (d_disque ("WFBID.SYS"), "rb")) != NULL) { if (fread (&fwbid, sizeof (fwbid), 1, fptr) == 0) return; for (i = 0; i < maxbbid; i++) { if (fread (&fwbid, sizeof (fwbid), 1, fptr) == 0) break; res = 1; for (j = 0; j < nb; j++) /* Test si tous sont trouves */ { if ((t_res[j] == 0) && (*fb_mess[j].bid)) { res = 0; break; } } if (res) break; for (j = 0; j < nb; j++) { if (t_res[j]) continue; /* Deja trouve ? */ if (*fb_mess[j].bid == '\0') continue; if (strcmp (fwbid.fbid, fb_mess[j].bid) == 0) { t_res[j] = 1; } } } ferme (fptr, 70); } } static int where_bid (char *bid) { int i; FILE *fptr; bidfwd fwbid; if ((fptr = fopen (d_disque ("WFBID.SYS"), "rb")) != NULL) { if (fread (&fwbid, sizeof (fwbid), 1, fptr) == 0) return (0); for (i = 0; i < maxbbid; i++) { if (fread (&fwbid, sizeof (fwbid), 1, fptr) == 0) break; if (strcmp (fwbid.fbid, bid) == 0) { return (i + 1); } } ferme (fptr, 70); } return (0); } static void tst_vbid (bullist * fb_mess, int nb, int *t_res) { int i, j, res; char *ptr; char t_bid[MAX_FB][BIDCOMP]; for (i = 0; i < nb; i++) if (*fb_mess[i].bid) memcpy (t_bid[i], comp_bid (fb_mess[i].bid), BIDCOMP); ptr = bid_ptr; for (i = 0; i < maxbbid; i++) { res = 1; for (j = 0; j < nb; j++) { /* Test si tous sont trouves */ if ((t_res[j] == 0) && (*fb_mess[j].bid)) { res = 0; break; } } if (res) break; for (j = 0; j < nb; j++) { if (t_res[j]) continue; /* Deja trouve ? */ if (*fb_mess[j].bid == '\0') continue; if (strncmp (ptr, t_bid[j], BIDCOMP) == 0) { t_res[j] = 1; } } ptr += BIDCOMP; } } /* Tests divers lors de la reception d'un message Retour : 0 : Message accepte 1 : Message deja recu [ ou rejete (protocole 0) ] 2 : en cours de reception sur un autre canal 3 : 4 : Message rejete (protocole 1). 5 : Message retenu (protocole 1). */ int deja_recu (bullist * fb_mess, int nb, int *t_res) { int i, j, voie; for (i = 0; i < nb; i++) { t_res[i] = rejet (&fb_mess[i]); /* if (t_res[i] == 0) t_res[i] = retenu(&fb_mess[i]); */ } for (i = 0; i < (nb - 1); i++) { for (j = i + 1; j < nb; j++) { if (t_res[j]) continue; if (strcmp (fb_mess[i].bid, fb_mess[j].bid) == 0) { t_res[j] = 1; break; } } } if (bid_ptr) tst_vbid (fb_mess, nb, t_res); else if (EMS_BID_OK ()) tst_exms_bid (fb_mess, nb, t_res); else tst_bid (fb_mess, nb, t_res); for (i = 0; i < nb; i++) { if (t_res[i]) continue; if (*fb_mess[i].bid == '\0') continue; /* Teste si en cours de reception */ for (voie = 0; voie < NBVOIES; voie++) { if ((voie == voiecur) || (!svoie[voie]->sta.connect)) continue; if (strcmp (svoie[voie]->entmes.bid, fb_mess[i].bid) == 0) { t_res[i] = 2; break; } for (j = 0; j < MAX_FB; j++) { if (svoie[voie]->fb_mess[j].type == '\0') continue; if (strcmp (svoie[voie]->fb_mess[j].bid, fb_mess[i].bid) == 0) { t_res[i] = 2; break; } } if (t_res[i]) break; } } for (i = 0; i < nb; i++) { if (t_res[i] == 0) t_res[i] = retenu (&fb_mess[i]); } return (t_res[0]); } fbb-7.04j/src/aff_stat.c0100644000175100017510000000366607726646105013154 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* Affiche une ligne de liste message */ static char *ltitre (int mode, bullist * pbul) /* Mode = 1 pour LS */ { /* int lg = (mode) ? 80 : 36 ; */ int lg = 80; static char buf[100]; if (pvoie->typlist) { sprintf (buf, "%-12s ", pbul->bid); if (mode) strn_cpy (lg, buf + 13, pbul->titre); else n_cpy (lg, buf + 13, pbul->titre); } else { if (mode) strn_cpy (lg, buf, pbul->titre); else n_cpy (lg, buf, pbul->titre); } return (buf); } #ifndef NO_STATUS static void aff_status (bullist * ligne) { char *ptr; *ptmes = *ligne; if (*(ligne->bbsv)) sprintf (varx[0], "@%-6s", bbs_via (ligne->bbsv)); else strcpy (varx[0], " "); var_cpy (1, ltitre (0, ligne)); ptr = var_txt (langue[vlang]->plang[T_MBL + 37 - 1]); /* texte(T_MBL+37) ; */ if (strlen (ptr) > 80) { ptr[79] = '\r'; ptr[80] = '\0'; } outs (ptr, strlen (ptr)); } #endif fbb-7.04j/src/clr_user.c0100644000175100017510000000755007726646105013177 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #define ENGLISH #include #include #include #include "version.h" #define FALSE 0 #define TRUE 1 #ifdef __LINUX__ #define __a2__ __attribute__ ((packed, aligned(2))) #else #define __a2__ #endif typedef struct typindic { char call[7]; char num; } indicat; typedef struct { indicat indic ; /* 8 Callsign */ indicat relai[8] ; /* 64 Digis path */ long lastmes __a2__ ; /* 4 Last L number */ long nbcon __a2__ ; /* 4 Number of connexions */ long hcon __a2__ ; /* 4 Last connexion date */ long lastyap __a2__ ; /* 4 Last YN date */ unsigned short flags ; /* 2 Flags */ unsigned short on_base ; /* 2 ON Base number */ unsigned char nbl ; /* 1 Lines paging */ unsigned char lang ; /* 1 Language */ long newbanner __a2__; /* 4 Last Banner date */ unsigned short download ; /* 2 download size (KB) = 100 */ char free[20] ; /* 20 Reserved */ char theme ; /* 1 Current topic */ char nom[18] ; /* 18 1st Name */ char prenom[13]; /* 13 Christian name */ char adres[61] ; /* 61 Address */ char ville[31] ; /* 31 City */ char teld[13] ; /* 13 home phone */ char telp[13] ; /* 13 modem phone */ char home[41] ; /* 41 home BBS */ char qra[7] ; /* 7 Qth Locator */ char priv[13] ; /* 13 PRIV directory */ char filtre[7] ; /* 7 LC choice filter */ char pass[13] ; /* 13 Password */ char zip[9] ; /* 9 Zipcode */ } info ; /* Total : 360 bytes */ FILE *ouvre_nomenc (void); int main (int ac, char **av) { info buf; FILE *fichi; long rinfo = 0L; long tot_dw = 0L; long nb_users = 0L; long temps = time (NULL); struct tm *tm = localtime (&temps); #ifdef LETTRE fprintf (stderr, "CLR_USER V %d.%d%c\n\n", MAJEUR, MINEUR, LETTRE); #else fprintf (stderr, "CLR_USER V %d.%d\n\n", MAJEUR, MINEUR); #endif /* if (tm->tm_wday != 0) return(0); */ putchar ('\n'); puts (asctime (tm)); fichi = ouvre_nomenc (); while (fread ((char *) &buf, (int) sizeof (buf), 1, fichi)) { tot_dw += (long) buf.download; if (buf.download) { printf ("%6s : %dKB\n", buf.indic.call, buf.download); buf.download = 0; fseek (fichi, rinfo, 0); fwrite ((char *) &buf, (int) sizeof (buf), 1, fichi); } rinfo += sizeof (buf); fseek (fichi, rinfo, 0); ++nb_users; } fclose (fichi); #ifdef ENGLISH printf ("%ld callsigns ok \n", nb_users); printf ("%ld KB downloaded \n", tot_dw); #else printf ("%ld indicatifs \n", nb_users); printf ("%ld KB envoys \n", tot_dw); #endif return (0); } FILE *ouvre_nomenc (void) { FILE *fichi; if ((fichi = fopen ("inf.sys", "r+b")) == NULL) { #ifdef ENGLISH fprintf (stderr, "Cannot find inf.sys !! \n"); #else fprintf (stderr, "Erreur ouverture inf.sys !!\n"); #endif exit (1); } return (fichi); } fbb-7.04j/src/conf.c0100644000175100017510000001232207726646105012277 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE CONFERENCE */ #include static void conferenciers (void); static void send_conf (char *, int); int conference (void) { int c, port, voie; switch (pvoie->niv2) { case 0: c = toupper (*indd); switch (c) { case 'W': conferenciers (); retour_mbl (); break; case '\0': case '\r': cnf_prec = -1; text_conf (T_CNF + 3); pvoie->conf = 1; texte (T_CNF + 0); conferenciers (); ch_niv2 (1); break; default: return (1); /* sprintf(varx[0], "C%c", c) ; texte(T_ERR + 1) ; retour_mbl() ; */ /* break ; */ } break; case 1: if (*indd == '.') { switch (toupper (*(indd + 1))) { case 'Q': pvoie->conf = 0; texte (T_CNF + 4); text_conf (T_CNF + 5); retour_mbl (); break; case 'W': conferenciers (); break; case 'D': indd += 2; if (teste_espace ()) { sup_ln (strupr (indd)); if (((voie = num_voie (indd)) != -1) && (svoie[voie]->conf)) { deconnexion (voie, 1); } else { var_cpy (0, indd); texte (T_CNF + 10); } } break; case 'C': indd += 2; while_space (); if ((isdigit (*indd)) && (isspace (*(indd + 1)))) { port = *indd - '0'; ++indd; } else port = no_port (voiecur); if ((port > 0) && (port < NBPORT) && ((p_port[port].moport & 0x10) || (droits (ACCGATE))) && (p_port[port].pvalid)) { if ((p_port[port].typort == TYP_BPQ) || (p_port[port].typort == TYP_MOD) || (p_port[port].typort == TYP_TCP)) { texte (T_ERR + 14); break; } if (teste_espace ()) { if ((voie = ch_voie (port, 0)) > 0) { /* save_voie = voiecur ; */ sup_ln (indd); indd -= 2; *indd = 'C'; *(indd + 1) = ' '; /* cprintf("Envoie <%s>\r\n", indd) ; */ if (connect_station (voie, 1, strupr (indd)) == 0) { svoie[voie]->conf = 1; svoie[voie]->niv1 = N_CONF; svoie[voie]->niv2 = svoie[voie]->niv3 = 0; /* cprintf("Met %d sur la voie %d\r\n", N_CONF, voie); */ } /* selvoie(save_voie) ; */ } else texte (T_GAT + 3); } else texte (T_ERR + 2); } else texte (T_GAT + 7); break; case 'H': case '?': pvoie->niv1 = N_MBL; out_help ("C"); pvoie->niv1 = N_CONF; break; default: send_conf (indd, nb_trait); break; } } else send_conf (indd, nb_trait); break; } return (0); } static void conferenciers (void) { int voie, vide = 1; texte (T_CNF + 1); for (voie = 0; voie < NBVOIES; voie++) { if ((svoie[voie]->conf) && (svoie[voie]->sta.connect >= 1)) { var_cpy (0, svoie[voie]->sta.indicatif.call); itoa ((voie > 0) ? voie - 1 : voie, varx[1], 10); texte (T_CNF + 2); vide = 0; } } if (vide) texte (T_CNF + 7); } char *k_var (void) { int voie, vide = 1; static char buffer[257]; *buffer = '\0'; for (voie = 0; voie < NBVOIES; voie++) { if ((svoie[voie]->conf) && (svoie[voie]->sta.connect >= 1)) { if (!vide) strcat (buffer, ", "); strcat (buffer, svoie[voie]->sta.indicatif.call); vide = 0; } } if (vide) strcpy (buffer, langue[vlang]->plang[T_CNF + 7 - 1]); return (buffer); } void text_conf (int numero) { int save_voie = voiecur; int voie; var_cpy (0, pvoie->sta.indicatif.call); for (voie = 0; voie < NBVOIES; voie++) { if ((svoie[voie]->sta.connect) && (voie != save_voie) && (svoie[voie]->conf)) { selvoie (voie); texte (numero); aff_etat ('E'); send_buf (voie); } } selvoie (save_voie); } static void send_conf (char *txt_conf, int nbcar) { int save_voie = voiecur; int voie; for (voie = 0; voie < NBVOIES; voie++) { if ((voie != save_voie) && (svoie[voie]->conf)) { selvoie (voie); pvoie->lignes = -1; if (cnf_prec != save_voie) { var_cpy (0, svoie[save_voie]->sta.indicatif.call); texte (T_CNF + 6); } out (txt_conf, nbcar); aff_etat ('E'); send_buf (voie); } } selvoie (save_voie); cnf_prec = voiecur; } fbb-7.04j/src/console.c0100644000175100017510000007233407726646105013025 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Gestion de la console */ #include static int dde_cnx = 0; static int dde_trait = 0; int connect_console (void) { Svoie *vptr = svoie[CONSOLE]; if (vptr->sta.connect) { #ifdef ENGLISH cprintf ("Can't connect ! Console channel is busy. \r\n"); #else cprintf ("Connexion Impossible. Voie Console occupe.\r\n"); #endif return (0); } init_etat (); selvoie (CONSOLE); /* F2 = Connexion */ if (arret) vptr->dde_marche = TRUE; else vptr->dde_marche = FALSE; vptr->timout = time_n; init_timout (CONSOLE); /* lastaff = -1 ; */ vptr->aut_linked = 1; vptr->private_dir = 0; vptr->read_only = 0; vptr->vdisk = 2; vptr->log = 1; vptr->deconnect = FALSE; vptr->tstat = vptr->debut = time (NULL); maj_niv (0, 0, 0); vptr->tmach = 0L; vptr->nb_err = vptr->seq = vptr->stop = vptr->sr_mem = 0; vptr->maj_ok = 0; vptr->rev_param = 0; vptr->ch_mon = vptr->cross_connect = -1; vptr->msg_held = 0; vptr->binary = vptr->conf = 0; vptr->mess_recu = vptr->xferok = 1; vptr->mbl = 1; vptr->entmes.numero = 0L; vptr->entmes.theme = 0; strn_cpy (6, vptr->sta.indicatif.call, cons_call.call); vptr->sta.indicatif.num = cons_call.num; vptr->r_tete = NULL; vptr->mbl_ext = 1; vptr->prot_fwd = FWD_MBL; vptr->nb_egal = 0; *vptr->passwd = '\0'; console_on (); aff_event (CONSOLE, 1); vptr->sta.stat = vptr->sta.connect = 16; curseur (); clear_inbuf (CONSOLE); connexion (voiecur); new_om = nouveau (voiecur); /* pvoie->finf.nbl = 16 ; */ /* vptr->mode = vptr->finf.flags ; */ vptr->mode = 0; vptr->l_mess = 0L; vptr->l_yapp = 0L; if (fbb_fwd) { vptr->mode |= F_NFW; if (bin_fwd) vptr->mode |= F_BIN; } /* mbl[CONSOLE] = TRUE ; */ /* cprintf("Connecte\r\n") ; */ change_droits (voiecur); strcpy (vptr->dos_path, "\\"); aff_nbsta (); fbb_log (CONSOLE, 'C', "@ CONSOL"); dde_cnx = 1; return (TRUE); } void console_inbuf (char *data, int len) { in_buf (CONSOLE, data, len); dde_trait = 1; } void justifie (unsigned char *buffer) { unsigned char ligne[83]; unsigned char *ptr, *ptri, *ptro; int nb_sp = 0; int nb_mot = 1; int nb_car = 0; int k, sp_int, sp_rst, i_sp, j_sp, k_sp, ds_mot, nb_int; df ("justifie", 2); ptri = buffer; ptro = ligne; while ((*ptri) && (*ptri == ' ')) { ++nb_car; *ptro++ = *ptri++; } if (*ptri) { ptr = ptri; ds_mot = TRUE; while (*ptr) { ++nb_car; if (*ptr == ' ') { ++nb_sp; if (ds_mot) { ds_mot = FALSE; nb_mot++; } } else ds_mot = TRUE; ++ptr; } if (nb_mot > 1) { nb_int = nb_mot - 1; /* nb_sp += (80 - nb_car) ; */ nb_sp += (78 - nb_car); sp_int = nb_sp / nb_int; sp_rst = nb_sp % nb_int; if (sp_rst > (nb_int / 2)) { k_sp = FALSE; sp_rst = nb_int - sp_rst; i_sp = (sp_rst % 2) ? nb_int / (sp_rst + 1) : nb_int / sp_rst; } else { k_sp = TRUE; if (sp_rst) i_sp = (sp_rst % 2) ? nb_int / (sp_rst + 1) : nb_int / sp_rst; else i_sp = 0; } j_sp = 0; while (*ptri) { if (*ptri == '\r') break; if ((just) && (*ptri == ' ')) { for (k = 0; k < sp_int; k++) *ptro++ = ' '; while (*++ptri == ' ') ; if (k_sp) { if (sp_rst) { if (++j_sp == i_sp) { *ptro++ = ' '; j_sp = 0; sp_rst--; } } } else { if (sp_rst) { if (++j_sp != i_sp) { *ptro++ = ' '; } else { j_sp = 0; sp_rst--; } } else { *ptro++ = ' '; } } } else *ptro++ = *ptri++; } *ptro = '\0'; if (!just) { nb_car = strlen (ligne); while (nb_car++ < 78) { } } /* *ptro++ = '\r'; */ *ptro = '\0'; ptr = ligne; while ((*buffer++ = *ptr++) != '\0'); } } ff (); } int kb_vide (void) { return 1; } void curseur (void) { } void connect_fen (void) { } void winputs (int voie, int attr, char *ptr) { int val; int header; if (attr == -1) { attr = W_CHNI; header = 1; } else header = 0; val = (attr & 8) ? 255 : 127; window_write (voie, ptr, strlen (ptr), attr, header); } void put_nr (unsigned char *texte, int attr, int nbcar) { unsigned char chaine[400]; unsigned char *ptr = chaine; unsigned char *scan = texte; unsigned char ch; int i, nb, pcode, txt = 0; if (nbcar > 256) nbcar = 256; texte[nbcar] = '\0'; if ((*scan != 0xff) && (*scan != 0xfe)) { strcpy (ptr, "(NRom: "); ptr += 7; for (i = 0; i < 6; i++) *ptr++ = (*scan++ >> 1); while (*(ptr - 1) == ' ') --ptr; *ptr++ = '-'; ch = (*scan++ >> 1) | 0x30; if (ch > '9') { *ptr++ = '1'; ch -= 10; } *ptr++ = ch; *ptr++ = ' '; for (i = 0; i < 6; i++) *ptr++ = (*scan++ >> 1); while (*(ptr - 1) == ' ') --ptr; *ptr++ = '-'; ch = (*scan++ >> 1) | 0x30; if (ch > '9') { *ptr++ = '1'; ch -= 10; } *ptr++ = ch; *ptr++ = ' '; itoa ((int) (*scan++), ptr, 10); while (*ptr) { ++ptr; } *ptr++ = ' '; itoa ((int) (*scan++), ptr, 10); while (*ptr) { ++ptr; } *ptr++ = ' '; itoa ((int) (*scan++), ptr, 10); while (*ptr) { ++ptr; } *ptr++ = ' '; scan += 2; pcode = (int) (*scan++) & 0xf; switch (pcode) { case 0: *ptr++ = 'I'; *ptr++ = 'P'; txt = 20; break; case 1: *ptr++ = 'C'; *ptr++ = ' '; ++scan; for (i = 0; i < 6; i++) *ptr++ = (*scan++ >> 1); while (*(ptr - 1) == ' ') --ptr; *ptr++ = '-'; ch = (*scan++ >> 1) | 0x30; if (ch > '9') { *ptr++ = '1'; ch -= 10; } *ptr++ = ch; *ptr++ = ' '; for (i = 0; i < 6; i++) *ptr++ = (*scan++ >> 1); while (*(ptr - 1) == ' ') --ptr; *ptr++ = '-'; ch = (*scan++ >> 1) | 0x30; if (ch > '9') { *ptr++ = '1'; ch -= 10; } *ptr++ = ch; txt = 0; break; case 2: *ptr++ = 'C'; *ptr++ = ' '; *ptr++ = 'A'; *ptr++ = 'K'; txt = 0; break; case 3: *ptr++ = 'D'; txt = 0; break; case 4: *ptr++ = 'D'; *ptr++ = ' '; *ptr++ = 'A'; *ptr++ = 'K'; txt = 0; break; case 5: *ptr++ = 'I'; txt = 20; break; case 6: *ptr++ = 'I'; *ptr++ = ' '; *ptr++ = 'A'; *ptr++ = 'K'; txt = 0; break; default: return; } *ptr++ = ')'; *ptr = '\0'; put_ui (chaine, attr, strlen (chaine)); if (txt > 0) { scan = texte + txt; put_ui (scan, attr, nbcar - txt); } } else { scan = texte + 7; nbcar -= 7; nb = 0; ptr = chaine; while (nbcar > 0) { for (i = 0; i < 6; i++) *ptr++ = (*scan++ >> 1); *ptr++ = '-'; ch = (*scan++ >> 1) | 0x30; if (ch > '9') { *ptr++ = '1'; ch -= 10; } else *ptr++ = ' '; *ptr++ = ch; *ptr++ = ':'; for (i = 0; i < 6; i++) *ptr++ = *scan++; *ptr++ = ' '; *ptr++ = '-'; *ptr++ = '>'; *ptr++ = ' '; for (i = 0; i < 6; i++) *ptr++ = (*scan++ >> 1); *ptr++ = '-'; ch = (*scan++ >> 1) | 0x30; if (ch > '9') { *ptr++ = '1'; ch -= 10; } else *ptr++ = ' '; *ptr++ = ch; *ptr++ = ' '; sprintf (ptr, "%3d ", (int) (*scan++)); /* itoa((int)(*scan++), ptr, 10) ; */ while (*ptr) ++ptr; if (++nb == 2) { *ptr = '\0'; put_ui (chaine, attr, strlen (chaine)); ptr = chaine; /* *ptr++ = '\r' ; */ nb = 0; } else { *ptr++ = ' '; *ptr++ = ' '; *ptr++ = ' '; } nbcar -= 21; } } } int put_ui (unsigned char *texte, int attr, int nb) { unsigned char buf[600]; unsigned char *ptr = buf; unsigned char c; int pos = 0; deb_io (); /* Commence toujours par un cr */ c = '\r'; ++nb; while (nb--) { /* Le dernier CR n'est pas pris en compte */ if ((nb == 0) && (c == '\r')) break; if (c == '\r') { *ptr++ = c; *ptr = '\0'; window_write (MMONITOR, buf, strlen (buf), attr, 0); ptr = buf; pos = 0; } else { if (++pos == 80) { *ptr++ = '\r'; *ptr = '\0'; window_write (MMONITOR, buf, strlen (buf), attr, 0); ptr = buf; pos = 0; } if (c >= ' ') { *ptr++ = c; } else { *ptr++ = c + '@'; } } c = *texte++; } *ptr = '\0'; window_write (MMONITOR, buf, strlen (buf), attr, 0); return (1); } int attend_caractere (int secondes) { return (0); } int forwarding_bbs (int nobbs) { int port; Forward *pfwd; for (port = 0; port < NBPORT; port++) { if (p_port[port].pvalid) { pfwd = p_port[port].listfwd; while (pfwd) { if (pfwd->no_bbs == nobbs) return (1); pfwd = pfwd->suite; } } } return (0); } static int is_nb(char *ptr) { int val = isdigit (*ptr); while (*ptr) { if (!ISGRAPH (*ptr)) break; if (!isdigit(*ptr)) val = 0; ++ptr; } return val; } int val_fwd (char *bbs, int *port_fwd, int reverse) { Forward *pfwd; int i, port, noport; int nobbs; strupr (sup_ln (bbs)); /* if ((isdigit (*bbs)) && (!ISGRAPH (*(bbs + 1)))) */ if (is_nb(bbs)) { /* *port_fwd = noport = *bbs - '0'; */ *port_fwd = noport = atoi(bbs); if (noport == 0) { /* Lance le forward sur tous les ports */ *bbs = '\0'; for (port = 0; port < NBPORT; port++) { if (p_port[port].pvalid) { for (i = 0; i < NBMASK; i++) p_port[port].fwd[i] = '\0'; pfwd = p_port[port].listfwd; while (pfwd) { if ((pfwd->forward == 0) && (ch_voie (port, 0) != -1)) { *pfwd->fwdbbs = '\0'; pfwd->forward = -1; pfwd->fwdpos = 0; pfwd->fin_fwd = pfwd->cptif = pfwd->fwdlig = 0; pfwd->reverse = reverse; } pfwd = pfwd->suite; } } } } else if (noport > 0) { /* Selectionne un port */ *bbs = '\0'; if (p_port[noport].pvalid) { for (i = 0; i < NBMASK; i++) p_port[noport].fwd[i] = '\0'; pfwd = p_port[noport].listfwd; while (pfwd) { if ((pfwd->forward == 0) && (ch_voie (noport, 0) != -1)) { *pfwd->fwdbbs = '\0'; pfwd->forward = -1; pfwd->fwdpos = 0; pfwd->fin_fwd = pfwd->cptif = pfwd->fwdlig = 0; pfwd->reverse = reverse; } pfwd = pfwd->suite; } } } } else { nobbs = num_bbs (bbs); if (nobbs) { /* Selectionne une BBS */ if ((chercher_voie (bbs) == -1) && !forwarding_bbs (nobbs)) { if ((port = what_port (nobbs)) != -1) { *port_fwd = port; pfwd = p_port[port].listfwd; while (pfwd) { if ((pfwd->forward == 0) && (ch_voie (port, 0) != -1)) { strn_cpy (6, pfwd->fwdbbs, bbs); clr_bit_fwd (p_port[port].fwd, nobbs); pfwd->forward = -1; pfwd->fwdpos = 0; pfwd->fin_fwd = pfwd->cptif = pfwd->fwdlig = 0; pfwd->reverse = reverse; break; } pfwd = pfwd->suite; } if (pfwd == NULL) noport = -1; else noport = port; } else noport = -2; } else noport = -4; } else noport = -3; } return (noport); } int traite_console () { df ("traite_console", 0); if (dde_cnx) { dde_cnx = 0; ff (); return (1); } if (dde_trait) { dde_trait = 0; ff (); return (1); } ff (); return (0); } void free_use (void) { FbbMem (0); } int aff_etat (int lettre) { int prec; char s[20]; df ("aff_etat", 1); prec = let_prec; if (lettre != let_prec) { let_prec = lettre; switch (lettre) { #ifdef ENGLISH case 'A': sprintf (s, "Idle "); break; case 'B': sprintf (s, "Beacon "); break; case 'C': sprintf (s, "Cron "); break; case 'D': sprintf (s, "Disconn"); break; case 'E': sprintf (s, "Sending"); break; case 'F': sprintf (s, "Forward"); break; case 'G': sprintf (s, "F_send "); break; case 'I': sprintf (s, "Import "); break; case 'J': sprintf (s, "Export "); break; case 'K': sprintf (s, "WaitAck"); break; case 'L': sprintf (s, "Reading"); break; case 'M': sprintf (s, "Unproto"); break; case 'N': sprintf (s, "Inbuf "); break; case 'O': sprintf (s, ">%-6ld", ptmes->numero); let_prec = 'A'; break; case 'R': sprintf (s, "Receive"); break; case 'S': sprintf (s, "Saving "); break; case 'T': sprintf (s, "Process"); break; case 'W': sprintf (s, "H-Route"); break; case 'X': sprintf (s, "WP-Upd "); break; case 'Y': sprintf (s, "Kernel "); break; case 'Z': sprintf (s, "W-Share"); break; #else case 'A': sprintf (s, "Attend "); break; case 'B': sprintf (s, "Balise "); break; case 'C': sprintf (s, "Cron "); break; case 'D': sprintf (s, "Dconn."); break; case 'E': sprintf (s, "Envoie "); break; case 'F': sprintf (s, "Forward"); break; case 'G': sprintf (s, "F_env "); break; case 'I': sprintf (s, "Import "); break; case 'J': sprintf (s, "Export "); break; case 'K': sprintf (s, "Att.Ack"); break; case 'L': sprintf (s, "LitTnc "); break; case 'M': sprintf (s, "Monitor"); break; case 'N': sprintf (s, "Inbuf "); break; case 'O': sprintf (s, ">%-6ld", ptmes->numero); let_prec = 'A'; break; case 'R': sprintf (s, "Recoit "); break; case 'S': sprintf (s, "Sauve "); break; case 'T': sprintf (s, "Traite "); break; case 'W': sprintf (s, "H-Route"); break; case 'X': sprintf (s, "MAJ-WP "); break; case 'Y': sprintf (s, "Kernel "); break; case 'Z': sprintf (s, "W-Share"); break; #endif } win_status (s); } ff (); return (prec); } void aff_msg_cons () { unsigned num_indic; ind_noeud *noeud; int priv = -1; int hold = -1; noeud = insnoeud (cons_call.call, &num_indic); if (noeud->nbnew != msg_cons) priv = msg_cons = noeud->nbnew; if (nb_hold != hold_cons) hold = hold_cons = nb_hold; win_msg_cons (priv, hold); } enum meminfo_row { meminfo_main = 0, meminfo_swap }; enum meminfo_col { meminfo_total = 0, meminfo_used, meminfo_free, meminfo_shared, meminfo_buffers, meminfo_cached }; /* Code from linuxnode */ #define MEMINFO_FILE "/proc/meminfo" static char buf[300]; #define MAX_ROW 3 /* these are a little liberal for flexibility */ #define MAX_COL 7 unsigned **meminfo (void) { static unsigned *row[MAX_ROW + 1]; /* row pointers */ static unsigned num[MAX_ROW * MAX_COL]; /* number storage */ char *p; int i, j, k, l; static int n, fd = -1; if (fd == -1 && (fd = open (MEMINFO_FILE, O_RDONLY)) == -1) { /* node_perror(FILE, errno); */ close (fd); return 0; } lseek (fd, 0L, SEEK_SET); if ((n = read (fd, buf, sizeof buf - 1)) < 0) { close (fd); fd = -1; return 0; } buf[n] = '\0'; if (!row[0]) /* init ptrs 1st time through */ for (i = 0; i < MAX_ROW; i++) /* std column major order: */ row[i] = num + MAX_COL * i; p = buf; for (i = 0; i < MAX_ROW; i++) /* zero unassigned fields */ for (j = 0; j < MAX_COL; j++) row[i][j] = 0; for (i = 0; i < MAX_ROW && *p; i++) { /* loop over rows */ while (*p && !isdigit (*p)) p++; /* skip chars until a digit */ for (j = 0; j < MAX_COL && *p; j++) { /* scanf column-by-column */ l = sscanf (p, "%u%n", row[i] + j, &k); p += k; /* step over used buffer */ if (*p == '\n' || l < 1) /* end of line/buffer */ break; } } return row; /* NULL return ==> error */ } void free_mem (void) { unsigned **mem; if (!(mem = meminfo ()) || mem[meminfo_main][meminfo_total] == 0) { /* cannot normalize mem usage */ tot_mem = 0L; } else { tot_mem = mem[meminfo_main][meminfo_free] + mem[meminfo_main][meminfo_buffers] + mem[meminfo_total][meminfo_cached] + mem[meminfo_swap][meminfo_free]; } FbbMem (0); } void aff_forward (void) { fbb_list (FALSE); } int aff_nbsta (void) { return (fbb_list (FALSE)); } char *stat_voie (int voie) { static char s[15]; switch (svoie[voie]->sta.stat) { case 0: strcpy (s, "Disconne"); break; case 1: strcpy (s, "Link Set"); break; case 2: strcpy (s, "Fram Rej"); break; case 3: strcpy (s, "Disc Req"); break; case 4: strcpy (s, "Transfer"); break; case 5: strcpy (s, "FRej Snd"); break; case 6: if (p_port[no_port (voie)].typort == TYP_KAM) sprintf (s, "Retry %-2d", svoie[voie]->sta.ret + 1); else sprintf (s, "Retry %-2d", svoie[voie]->sta.ret); break; case 7: strcpy (s, "Dev Busy"); break; case 8: strcpy (s, "RdevBusy"); break; case 9: strcpy (s, "BdevBusy"); break; case 10: strcpy (s, "WAck Dbs"); break; case 11: strcpy (s, "WAckRbsy"); break; case 12: strcpy (s, "WAckBbsy"); break; case 13: strcpy (s, "RFrmDbsy"); break; case 14: strcpy (s, "RFrmRbsy"); break; case 15: strcpy (s, "RFrmBbsy"); break; case 16: strcpy (s, "Console "); break; case 17: strcpy (s, "Ch Busy "); break; default: strcpy (s, "Error st"); break; } return (s); } void status (int voie) { char buf[255]; char call[80]; char ret[80]; Svoie *ptvoie = svoie[voie]; if (operationnel) { if ((v_aff < 0) || (voie == v_aff)) { if (voie > 1) { sprintf (ret, "(%03d)", ptvoie->sta.mem); sprintf (buf, "Buf %03d/%03d %s %02d-%02d-%02d %s", ptvoie->sta.ack, ptvoie->maxbuf, ret, ptvoie->niv1, ptvoie->niv2, ptvoie->niv3, stat_voie (voie)); #ifdef ENGLISH sprintf (call, "Ch %02d %s-%d", virt_canal (voie), ptvoie->sta.indicatif.call, ptvoie->sta.indicatif.num); #else sprintf (call, "Vo %02d %s-%d", virt_canal (voie), ptvoie->sta.indicatif.call, ptvoie->sta.indicatif.num); #endif FbbStatus (call, buf); } free_mem (); } user_status (voie); } svoie[voie]->ch_status = 0; } int aff_yapp (int voie) { return 1; } char *yapp_str (int voie, char *s) { #define YAPPLEN 44 #define MAX_AFF 12 static char stdesc[MAX_AFF][11] = { "SendInit ", "SendInitRt", "SendHeader", "SendData ", "SendEof ", "SendEOT ", "RcvWait ", "RcvHeader ", "RcvData ", "SndABORT ", "WaitAbtAck", "RcdABORT " }; static char *yapp_name[2] = {"Yapp", "YapC"}; Svoie *pv = svoie[voie]; int i; int ok = 1; int retour = 0; int niv = pv->niv2; long offset = pv->enrcur; *s = '\0'; if (!operationnel) return (0); if (offset < 0L) offset = 0L; *s = '\0'; if (v_aff < 0) { if ((svoie[voie]->sta.connect) && (svoie[voie]->niv1 == N_YAPP)) { if ((niv > 0) && (niv < MAX_AFF)) { sprintf (s, "%s:%s %s %ld/%ld", yapp_name[pv->type_yapp], stdesc[pv->niv2], pv->appendf, offset, pv->tailm); retour = 1; } } if (retour == 0) { for (i = 0; i < NBVOIES; i++) { if ((svoie[i]->sta.connect) && (svoie[i]->niv1 == N_YAPP)) { if ((niv > 0) && (niv < MAX_AFF)) { pv = svoie[i]; sprintf (s, "%s:%s %s %ld/%ld", yapp_name[pv->type_yapp], stdesc[pv->niv2], pv->appendf, offset, pv->tailm); break; } } } } } else if (voie == v_aff) { if ((svoie[voie]->sta.connect) && (svoie[voie]->niv1 == N_YAPP)) { if ((niv > 0) && (niv < MAX_AFF)) { sprintf (s, "%s:%s %s %ld/%ld", yapp_name[pv->type_yapp], stdesc[pv->niv2], pv->appendf, offset, pv->tailm); retour = 1; } } } else ok = 0; return (s); } void aff_ind_console (void) { char s[80]; sprintf (s, "Console : %6s-%-2d\n", cons_call.call, cons_call.num); aff_chaine (DEF, 25, 1, s); } void affich_logo (int att) { char chaine[80]; #ifdef ENGLISH sprintf (chaine, "MULTICONNECT BBS F6FBB V%s", version ()); #else sprintf (chaine, "SERVEUR MULTIVOIES F6FBB V%s", version ()); #endif aff_chaine (att, 55 - strlen (version ()), 1, chaine); } void aff_date (void) { char buffer[300]; char cdate[19]; long temps; struct tm *sdate; #ifdef ENGLISH char jour[] = "SunMonTueWedThuFriSat"; #else char jour[] = "DimLunMarMerJeuVenSam"; #endif temps = time (NULL); sdate = localtime (&temps); #ifdef ENGLISH sprintf (cdate, " %02d-%02d-%02d %02d:%02d", sdate->tm_year, sdate->tm_mon + 1, sdate->tm_mday, sdate->tm_hour, sdate->tm_min); #else sprintf (cdate, " %02d/%02d/%02d %02d:%02d", sdate->tm_mday, sdate->tm_mon + 1, sdate->tm_year, sdate->tm_hour, sdate->tm_min); #endif memcpy (cdate, jour + (sdate->tm_wday * 3), 3); if (com_error) sprintf (buffer, "%s %02d", cdate, com_error); else sprintf (buffer, "%s", cdate); aff_chaine (DEF, 1, 1, buffer); } void maj_options (void) { FILE *fptr; if ((fptr = fopen (d_disque ("OPTIONS.SYS"), "wb")) != NULL) { fwrite (&bip, sizeof (short), 1, fptr); fwrite (&ok_tell, sizeof (short), 1, fptr); fwrite (&ok_aff, sizeof (short), 1, fptr); fwrite (&separe, sizeof (short), 1, fptr); fwrite (&doub_fen, sizeof (short), 1, fptr); fwrite (&gate, sizeof (short), 1, fptr); fwrite (&just, sizeof (short), 1, fptr); fwrite (&p_forward, sizeof (short), 1, fptr); fwrite (&sed, sizeof (short), 1, fptr); fwrite (&aff_inexport, sizeof (short), 1, fptr); fwrite (&aff_popsmtp, sizeof (short), 1, fptr); fclose (fptr); } maj_menu_options (); } int ind_console (int type, char *chaine) /* Type : 0 = decimal, 1 = hexa */ { int c = 0; char *ptr = chaine; while (isalnum (*ptr)) ++ptr; if (*ptr) { *ptr++ = '\0'; while ((*ptr) && (!isxdigit (*ptr))) ++ptr; } if (find (chaine)) { strcpy (cons_call.call, chaine); if (*ptr) { if (type) sscanf (ptr, "%x", &c); else sscanf (ptr, "%d", &c); if ((c < 0) || (c > 15)) return (0); } cons_call.num = c; return (1); } return (0); } void house_keeping (void) { long caltemps; save_fic = 1; set_busy (); time (&caltemps); stop_min = minute (caltemps); type_sortie = 3; } #if 0 int read_wp (unsigned record, Wp * wp) { return (0); } int write_wp (unsigned record, Wp * wp) { return (0); } unsigned search_wp_record (lcall icall, int what, unsigned first_record) { return (0xffff); } #endif void console_off (void) { CloseFbbWindow (0); } void console_on (void) { } void FbbRequestUserList (void) { bloc_indic *bptr; unsigned offset; int nb = 0; char buffer[8]; /* Envoie les indicatifs dans la ListBox */ bptr = racine; offset = 0; while (bptr) { if (*(bptr->st_ind[offset].indic) == '\0') break; if (bptr->st_ind[offset].coord != 0xffff) { if (bptr->st_ind[offset].val) { n_cpy (6, buffer, bptr->st_ind[offset].indic); AddUserList (buffer); } } if (++offset == T_BLOC_INFO) { offset = 0; bptr = bptr->suiv; } } /* Envoie les langues dans la ListBox */ for (nb = 0; nb < maxlang; nb++) { AddUserLang (nomlang + nb * LG_LANG); } } int GetUserInfos (char *callsign, info * frec) { ind_noeud *noeud; FILE *fptr; unsigned num_indic; noeud = insnoeud (callsign, &num_indic); if (noeud->coord == 0xffff) { return (0); } fptr = ouvre_nomenc (); fseek (fptr, (long) noeud->coord * sizeof (info), 0); fread (frec, sizeof (info), 1, fptr); ferme (fptr, 39); return (1); } int SetUserInfos (char *callsign, info * frec) { int voie; ind_noeud *noeud; FILE *fptr; unsigned num_indic; /* Met a jour l'utilisateur eventuellement connecte */ for (voie = 0; voie < NBVOIES; ++voie) { if (svoie[voie]->sta.connect && indcmp (svoie[voie]->sta.indicatif.call, callsign)) { svoie[voie]->finf = *frec; } } /* Met a jour le record de l'utilisateur */ noeud = insnoeud (callsign, &num_indic); if (noeud->coord == 0xffff) { return (0); } fptr = ouvre_nomenc (); fseek (fptr, (long) noeud->coord * sizeof (info), 0); fwrite (frec, sizeof (info), 1, fptr); ferme (fptr, 39); return (1); } void FbbRequestMessageList (void) { char buf[40]; unsigned offset; bloc_mess *bptr = tete_dir; ouvre_dir (); /* pvoie->typlist = 0; */ if (bptr) { /* Goto the end of the list */ while (bptr->suiv) bptr = bptr->suiv; /* Scans the list */ offset = T_BLOC_MESS; while (bptr) { --offset; if (bptr->st_mess[offset].noenr) AddMessageList (ltoa (bptr->st_mess[offset].nmess, buf, 10)); if (offset == 0) { bptr = prec_dir (bptr); offset = T_BLOC_MESS; } } } ferme_dir (); } int GetMsgInfos (bullist * plig, long numero) { mess_noeud *mptr; mptr = findmess (numero); if (mptr == NULL) return 0; ouvre_dir (); read_dir (mptr->noenr, plig); ferme_dir (); return (1); } int SetMsgInfo (bullist * plig, long numero) { mess_noeud *mptr; mptr = findmess (numero); if (mptr == NULL) return 0; ouvre_dir (); write_dir (mptr->noenr, plig); ferme_dir (); return (1); } char *MessPath (void) { return (MESSDIR); } void fwd_encours (void) { int i, priv, bull, kb; atfwd *nbmess; char ifwd[NBBBS][7]; char maxfwd[NBBBS + 1]; char typfwd[NBBBS + 1]; char typdat[NBBBS + 1]; ch_bbs (1, ifwd); fwd_value (maxfwd, typfwd, typdat); for (i = 0; i < NBBBS; i++) { nbmess = attend_fwd (i + 1, maxfwd[i + 1], 0, typfwd[i + 1], typdat[i + 1]); if (nbmess > 0) { priv = nbmess->nbpriv; bull = nbmess->nbbul; kb = nbmess->nbkb; } else priv = bull = kb = 0; AddPendingLine (ifwd[i], priv, bull, kb); } } void compress_display (int type, long value, long numero) { CompressPosition (type, (int) value, numero); } void maintenance (void) { int i; int suite; int port, voie, flag, strm; char txt[80]; char chaine[300]; FILE *fpinit; df ("maintenance", 0); InfoMessage (-1, "Halting communication", "Halt"); operationnel = FALSE; for (port = 1; port < NBPORT; port++) { if (p_port[port].pvalid) { wsprintf (txt, "Halting port %d", port); InfoMessage (-1, txt, NULL); selcanal (port); switch (p_port[port].typort) { case TYP_DED: case TYP_HST: vide (port, 0); /* Supprime le dernier ACK de sonde */ tnc_commande (port, "Y0", PORTCMD); break; case TYP_PK: tnc_commande (port, "UR1", PORTCMD); break; case TYP_MOD: /* modem_stop(port) ; */ break; case TYP_KAM: tnc_commande (port, "USERS 0/0", PORTCMD); break; case TYP_BPQ: for (voie = 1; voie < NBVOIES; voie++) { if (svoie[voie]->affport.port == port) { strm = no_canal (voie); flag = 6; cprintf ("Devalidating stream %d\r\n", strm); sta_drv (voie, SETFLG, (void *) &flag); } } break; } for (voie = 1; voie < NBVOIES; voie++) { if ((svoie[voie]->affport.port == port) && (svoie[voie]->sta.connect)) { deconnexion (voie, 1); #ifdef ENGLISH cprintf ("Disconnecting Port %d Channel %d\r\n", port, virt_canal (voie)); #else cprintf ("Deconnection du Port %d Voie %d \r\n", port, virt_canal (voie)); #endif } } if (!BPQ (port)) { sprintf (chaine, "MAINT%d.SYS", port); if ((fpinit = fopen (c_disque (chaine), "r")) != NULL) { while (fgets (chaine, 256, fpinit)) { if (*chaine == '#') continue; sup_ln (chaine); if (*chaine) tnc_commande (port, chaine, PORTCMD); } fclose (fpinit); } switch (p_port[port].typort) { case TYP_DED: case TYP_HST: suite = 0; if (DRSI (port)) { for (i = port + 1; i < NBPORT; i++) { if (DRSI (i)) suite = 1; } } if (suite == 0) { cls_drv (port); } break; case TYP_PK: tnc_commande (port, "HON", PORTCMD); break; case TYP_KAM: break; } } } } closecom (); InfoMessage (-1, NULL, NULL); port_log (0, 0, 'S', "Q *** BBS Quit"); ferme_log (); ff (); } void set_busy (void) { int port, voie, flag, strm; InfoMessage (-1, "Stopping connections", "Halt"); for (port = 1; port < NBPORT; port++) { if (p_port[port].pvalid) { selcanal (port); switch (p_port[port].typort) { case TYP_DED: case TYP_HST: tnc_commande (port, "Y0", PORTCMD); break; case TYP_PK: tnc_commande (port, "UR1", PORTCMD); break; case TYP_MOD: for (voie = 0; voie < NBVOIES; voie++) { if ((no_port (voie) == port) && (!svoie[voie]->sta.connect)) { tnc_commande (port, "ATH0=0", PORTCMD); } } break; case TYP_KAM: tnc_commande (port, "USERS 0/0", PORTCMD); break; case TYP_BPQ: for (voie = 1; voie < NBVOIES; voie++) { if (no_port (voie) == port) { flag = 0; strm = no_canal (voie); cprintf ("Devalidating stream %d (%02x)\r\n", strm, flag); sta_drv (voie, SETFLG, (void *) &flag); } } break; case TYP_SCK: case TYP_TCP: case TYP_ETH: for (voie = 1; voie < NBVOIES; voie++) { if (no_port (voie) == port) { sta_drv (voie, SETBUSY, NULL); } } break; } } } InfoMessage (-1, "Connections stopped", NULL); InfoMessage (-1, NULL, NULL); } fbb-7.04j/src/date.c0100644000175100017510000000275407726646105012277 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include char *date (void) { return (__DATE__); } char *version (void) { static char buffer[20]; #ifdef PRE #ifdef LETTRE sprintf (buffer, "%d.%02d%cpre%d", MAJEUR, MINEUR, LETTRE, PRE); #else sprintf (buffer, "%d.%02dpre%d", MAJEUR, MINEUR, PRE); #endif #else #ifdef LETTRE sprintf (buffer, "%d.%02d%c", MAJEUR, MINEUR, LETTRE); #else sprintf (buffer, "%d.%02d", MAJEUR, MINEUR); #endif #endif return (buffer); } fbb-7.04j/src/devio.c0100644000175100017510000001706307726646105012467 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Routines d'entrees-Sorties * */ #include #include #include #include #include #include static int car_tnc_linux(int port); static int closecom_linux(int com); int initcom_linux (int com); static int rec_tnc_linux (int port); static void send_tnc_linux (int port, int carac); int drsi_port (int port, int canal) { int i; df ("drsi_port", 2); for (i = 1; i < NBPORT; i++) { if (DRSI (i)) { if (p_port[i].ccanal == canal) { ff (); return (i); } } } ff (); return (port); } int hst_port (int port, int canal) { int i; for (i = 1; i < NBPORT; i++) { if (HST (i)) { if (p_port[i].ccanal == canal) { ff (); return (i); } } } return (port); } int bpq_port (int port, int canal) { int i; df ("bpq_port", 2); for (i = 1; i < NBPORT; i++) { if (BPQ (i)) { if (p_port[i].ccanal == canal) { ff (); return (i); } } } ff (); return (port); } int linux_port (int port, int canal) { return (canal); } int initcom (void) { int com, port, valid; df ("initcom", 0); #ifdef ENGLISH if (DEBUG) cprintf ("Debug valid \r\n"); #else if (DEBUG) cprintf ("Debug valide\r\n"); #endif else { for (com = 1; com < NBPORT; com++) { valid = 0; p_com[com].comfd = -1; for (port = 1; port < NBPORT; port++) { if ((p_port[port].pvalid) && (p_port[port].ccom == com)) { switch (p_port[port].typort) { case TYP_MOD : case TYP_DED : case TYP_HST : valid = 1; break; default : valid = 0; break; } break; } } if (valid) { int ret = 0; switch (p_com[com].combios) { case P_LINUX: ret = initcom_linux (com); break; } if (!ret) return(FALSE); } } } sleep_ (1); ff (); return(TRUE); } void closecom (void) { int com, port, valid; #ifdef ENGLISH if (DEBUG) cprintf ("Debug valid \r\n"); #else if (DEBUG) cprintf ("Debug valide\r\n"); #endif else { if (p_port == NULL) return; for (com = 1; com < NBPORT; com++) { valid = 0; for (port = 1; port < NBPORT; port++) { #ifdef __WINDOWS__ if ((p_port[port].pvalid) && (ETHER (port))) { free_socket (port); } #endif if ((p_port[port].pvalid) && (p_port[port].ccom == com)) { switch (p_port[port].typort) { case TYP_MOD : case TYP_DED : case TYP_HST : valid = 1; break; default : valid = 0; break; } break; } } if (valid) { switch (p_com[com].combios) { case P_LINUX: closecom_linux(com); break; } } } } sleep_ (1); return; } int car_tnc (int port) { int val; df ("car_tnc", 1); switch (BIOS (port)) { case P_LINUX: val = car_tnc_linux (port); return(val); } ff (); return (1); } int rec_tnc (int port) { int c = -1; df ("rec_tnc", 1); switch (BIOS (port)) { case P_LINUX: c = rec_tnc_linux (port); break; default: fbb_error (ERR_TNC, "RECEIVE: WRONG INTERFACE", BIOS (port)); break; } ff (); return (c); } void send_tnc (int port, int carac) { df ("send_tnc", 2); switch (BIOS (port)) { case P_LINUX: send_tnc_linux (port, carac); break; default: fbb_error (ERR_TNC, "SEND: WRONG INTERFACE", BIOS (port)); } ff (); return; } int car_tx (int port) { return (0); } #undef inportb #undef outportb void selcanal (int port) { return; } /* * Routines Entrees-Sortie ... Interface avec LINUX * */ static struct termios def_tty; int default_tty(int com) { return tcsetattr(p_com[com].comfd, TCSANOW, &def_tty); } #undef open #undef close #undef read #undef write int initcom_linux (int com) { int spd; int comfd; int newbaud; struct termios tty; /* Ferme le port si deja ouvert */ closecom_linux (com); /* sprintf(buf, "/dev/cua%d", com-1); */ printf("Init %s\n", p_com[com].name); comfd = open(p_com[com].name, O_RDWR); if (comfd == -1) { fprintf(stderr, "com%d : cannot open the device %s\n", com, p_com[com].name); return(0); } p_com[com].comfd = comfd; tcgetattr(comfd, &def_tty); tcgetattr(comfd, &tty); newbaud = (int)(p_com[com].baud >> 5); if (p_com[com].options & 0x20) newbaud += 10; printf("newbaud = %d\n", newbaud); switch(newbaud) { case 2: spd = B300; break; case 3: spd = B600; break; case 4: spd = B1200; break; case 5: spd = B2400; break; case 6: spd = B4800; break; case 7: spd = B9600; break; case 12: spd = B19200; break; case 14: spd = B38400; break; case 15: spd = B57600; break; case 16: spd = B115200; break; default: spd = -1; break; } if (spd != -1) { cfsetospeed(&tty, (speed_t)spd); cfsetispeed(&tty, (speed_t)spd); } tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8; /* Set into raw, no echo mode */ tty.c_iflag &= ~(IGNBRK | IGNCR | INLCR | ICRNL | IUCLC | IXANY | IXON | IXOFF | INPCK | ISTRIP); tty.c_iflag |= (BRKINT | IGNPAR); tty.c_oflag &= ~OPOST; tty.c_lflag = ~(ICANON | ISIG | ECHO | ECHONL | ECHOE | ECHOK); tty.c_cflag |= CREAD | CRTSCTS; /* #else Okay, this is better. XXX - Fix the above. tty.c_iflag = IGNBRK; tty.c_lflag = 0; tty.c_oflag = 0; tty.c_cflag |= CLOCAL | CREAD; #endif */ tty.c_cc[VMIN] = 1; tty.c_cc[VTIME] = 5; /* Flow control. */ /* if (!hwf) tty.c_cflag &= ~CRTSCTS; if (swf) tty.c_iflag |= IXON; */ tty.c_cflag &= ~(PARENB | PARODD); /* if (par[0] == 'E') tty.c_cflag |= PARENB; else if (par[0] == 'O') tty.c_cflag |= PARODD; */ tcsetattr(comfd, TCSANOW, &tty); tcflow(comfd, TCOON); /* { / Set RTS / int mcs; ioctl(comfd, TIOCMGET, &mcs); mcs |= TIOCM_RTS; ioctl(comfd, TIOCMSET, &mcs); } */ return (TRUE); } static int rec_tnc_linux (int port) { int chr; if (!car_tnc_linux(port)) return(-1); read(p_com[(int)p_port[port].ccom].comfd, &chr, 1); return (chr & 0xff); } static void send_tnc_linux (int port, int carac) { write(p_com[(int)p_port[port].ccom].comfd, &carac, 1); } static int car_tnc_linux(int port) { long i = 0; (void) ioctl(p_com[(int)p_port[port].ccom].comfd, FIONREAD, &i); return((int)i); } static int closecom_linux(int com) { if (p_com[com].comfd == -1) return(0) ; sleep(2); xprintf("Close com !\n"); close(p_com[com].comfd); p_com[com].comfd = -1; return(1); } /* * end of devio.c * */ fbb-7.04j/src/dos_1.c0100644000175100017510000006470207726663602012371 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include /* * Module FBBdos */ static int execute_dos(void); static int rx_file(char *, int); static void copy_file(void); static void dos_copy(void); static void edit_label(void); static void help_appel(char **); static void menu_dos(void); static void put_file(void); static void view(void); static int where_loop; /* * F_FILTER feature * * Parameters : * Callsign-SSID * Temp filename * Number of the calling process (Xmodem=11, YAPP=17) * Number of the user's record in INF.SYS * * Return value * 0 : File OK, can be recorded. * 1 : File not OK, will be discarded. * * Comments * The datas sent to stdout by F_FILTER * will be redirected to the user. */ /* return the next argument from indd and updates the indd pointer */ char *get_nextparam(void) { char *ptr; while (*indd && isspace(*indd)) ++indd; if (*indd == '"') { ptr = ++indd; while (*indd && (*indd != '"')) ++indd; if (*indd) *indd++ = '\0'; } else { ptr = indd; while (*indd && isgraph(*indd)) ++indd; if (*indd) *indd++ = '\0'; } return (*ptr) ? ptr : NULL; } int test_temp(int voie) { static int test = 1; int retour = 1; int ret; char temp[128]; char s[256]; temp_name(voie, temp); indd[80] = '\0'; if (test) { char dir[80]; char file[80]; FILE *fptr; strcpy(dir, "X:\\"); /* fill string with form of response: X:\ */ dir[0] = 'A' + getdisk(); /* replace X with current drive letter */ getcurdir(0, dir + 3); /* fill rest of string with current directory */ sprintf(file, "%s\\f_filter.%02d", dir, voiecur); #ifdef __LINUX__ strcpy(file, back2slash(file)); #endif if ((fptr = fopen(file, "wt")) == NULL) return (-1); fprintf(fptr, "#\n# Downloaded File information\n#\n"); #ifdef __LINUX__ fprintf(fptr, "TempName = %s\n", back2slash(temp)); fprintf(fptr, "FileName = %s\n", back2slash(pvoie->sr_fic)); #else fprintf(fptr, "TempName = %s\n", temp); fprintf(fptr, "FileName = %s\n", pvoie->sr_fic); #endif fprintf(fptr, "Label = %s\n", pvoie->label); fprintf(fptr, "#\n"); fclose(fptr); { char buffer[1024]; *buffer = '\0'; #ifdef __LINUX__ sprintf(s, "%sf_filter %s-%d %d %u %s", FILTDIR, pvoie->sta.indicatif.call, pvoie->sta.indicatif.num, pvoie->niv1, pvoie->ncur->coord, file); ret = filter(s, buffer, sizeof(buffer), NULL, FILTDIR); #else sprintf(s, "f_filter %s-%d %d %u %s", pvoie->sta.indicatif.call, pvoie->sta.indicatif.num, pvoie->niv1, pvoie->ncur->coord, file); ret = filter(s, buffer, sizeof(buffer), NULL, NULL); #endif buffer[1023] = '\0'; if (*buffer) out(buffer, strlen(buffer)); } unlink(file); switch (ret) { case -1: test = 0; clear_outbuf(voiecur); break; case 1: retour = 0; break; default: break; } } return (retour); } int user_ok(void) { if (droits(MODLABEL | SUPFIC | ACCESDOS)) return (1); if (*pvoie->finf.priv) return (1); if (P_MODM(voiecur)) { if (max_mod == 0) return (1); if (pvoie->finf.download > max_mod) return (0); } else { if (max_yapp == 0) { return (1); } if (pvoie->finf.download > max_yapp) { return (0); } } return (1); } void retour_dos(void) { retour_niveau(); prompt(pvoie->finf.flags, pvoie->niv1); } char *local_path(char *chaine) { int size, lg; static char temp[256]; strcpy(temp, chaine); size = lg = strlen(temp); if ((lg > 2) && (temp[1] == ':')) size = lg - 2; if (size > 1) if (temp[lg - 1] == '\\') temp[lg - 1] = '\0'; return (temp); } int tst_point(char *chaine) { char *ptr; char vdisk; if ((voiecur != CONSOLE) && (pvoie->kiss != -2) && ((ptr = strchr(chaine, ':')) != NULL)) { --ptr; vdisk = toupper(*ptr) - 'A'; if (vdisk == 15) { if (*pvoie->finf.priv == '\0') { texte(T_ERR + 29); return (FALSE); } } else if ((vdisk > 7) || (PATH[(int) vdisk][0] == '\0')) { texte(T_ERR + 29); return (FALSE); } } if (!droits(ACCESDOS)) { if (strstr(chaine, "..") || strstr(chaine, "~")) { texte(T_ERR + 15); return (FALSE); } } return (TRUE); } #if 0 /* * Attend une structure tm en entree * Retourne le nombre de secondes depuis 1-1-1970 */ static long date_to_second(struct tm *dat) { static char Days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; long x; register int i; register int days; int hours; x = 24L * 60L * 60L * 3652L + timezone; /* Convertit de 1980 a 1970 */ i = dat->tm_year; if (i > 1900) i -= 1900; x += (i >> 2) * (1461L * 24L * 60L * 60L); x += (i & 3) * (24L * 60L * 60L * 365L); if (i & 3) x += 24L * 3600L; days = 0; i = dat->tm_mon - 1; while (i > 0) { i--; days += Days[i]; } days += dat->tm_mday - 1; if (dat->tm_mon > 2 && (dat->tm_year & 3) == 0) days++; /* bissextile */ hours = days * 24 + dat->tm_hour; /* Heures */ x += hours * 3600L; x += 60L * dat->tm_min + dat->tm_sec; return (x); } #endif void send_file(int type) { int fin, retour; char *ptr; struct stat bufstat; switch (pvoie->niv3) { case 0: if (!user_ok()) { texte(T_ERR + 18); retour_dos(); break; } fin = 0; if (type) pvoie->lignes = -1; get_nextparam(); if ((ptr = get_nextparam()) == NULL) fin = T_ERR + 20; else if (tst_point(ptr)) { strcpy(pvoie->sr_fic, tot_path(ch_slash(ptr), pvoie->dos_path)); retour = stat(pvoie->sr_fic, &bufstat); strcpy(pvoie->appendf, ptr); if ((retour == -1) || ((bufstat.st_mode & S_IFREG) == 0)) { fin = T_ERR + 11; } else { pvoie->enrcur = 0L; pvoie->size_trans = 0L; pvoie->temp2 = type; if (senddata(0)) { fin = -1; pvoie->finf.download += (int) (pvoie->size_trans / 1024L); } else ch_niv3(1); } } if (fin) { if (type) ctrl_z(); if (fin > 0) texte(fin); retour_dos(); } break; case 1: if (senddata(0)) { if (pvoie->temp2) ctrl_z(); pvoie->finf.download += (int) (pvoie->size_trans / 1024L); retour_dos(); } break; } } void put_file(void) { FILE *fptr; obuf *msgtemp; char temp[128]; if ((fptr = fopen(temp_name(voiecur, temp), "at")) != NULL) { while ((msgtemp = pvoie->msgtete) != NULL) { fwrite(msgtemp->buffer, msgtemp->nb_car, 1, fptr); pvoie->memoc -= msgtemp->nb_car; pvoie->msgtete = msgtemp->suiv; m_libere((char *) msgtemp, sizeof(*msgtemp)); } fclose(fptr); } libere(voiecur); } static int rx_file(char *ptr, int nbcar) { int ncars; obuf *msgtemp; char *ptcur; if ((msgtemp = pvoie->msgtete) != NULL) { while (msgtemp->suiv) msgtemp = msgtemp->suiv; } else { msgtemp = (obuf *) m_alloue(sizeof(obuf)); pvoie->msgtete = msgtemp; msgtemp->nb_car = msgtemp->no_car = 0; msgtemp->suiv = NULL; } ncars = msgtemp->nb_car; ptcur = msgtemp->buffer + ncars; while (nbcar--) { if (*ptr == '\32') { msgtemp->nb_car = ncars; put_file(); ltoa(pvoie->tailm, varx[0], 10); texte(T_DOS + 5); return (FALSE); } ++pvoie->tailm; if (*ptr == '\r') { ++pvoie->tailm; *ptr = '\n'; } ++pvoie->memoc; *ptcur++ = *ptr++; if (++ncars == 250) { msgtemp->nb_car = ncars; msgtemp->suiv = (obuf *) m_alloue(sizeof(obuf)); msgtemp = msgtemp->suiv; msgtemp->nb_car = msgtemp->no_car = ncars = 0; msgtemp->suiv = NULL; ptcur = msgtemp->buffer; } } msgtemp->nb_car = ncars; if (pvoie->memoc > MAXMEM) put_file(); return (TRUE); } void receive_file(void) { char *ptr; struct stat bufstat; switch (pvoie->niv3) { case 0: if (read_only()) { retour_dos(); break; } get_nextparam(); if ((ptr = get_nextparam()) == NULL) { texte(T_ERR + 20); retour_dos(); break; } if ((!tst_point(ptr)) || (!aut_ecr(ch_slash(ptr), 1))) { retour_dos(); break; } entete_saisie(); pvoie->tailm = 0L; n_cpy(40, pvoie->appendf, ptr); strcpy(pvoie->sr_fic, tot_path(ch_slash(pvoie->appendf), pvoie->dos_path)); if (stat(pvoie->sr_fic, &bufstat) == -1) { del_temp(voiecur); /* unlink(pvoie->sr_fic) ; */ pvoie->xferok = 0; texte(T_YAP + 3); maj_niv(9, 3, 2); } else { texte(T_ERR + 23); retour_dos(); } break; case 1: if (rx_file(indd, nb_trait) == 0) { pvoie->xferok = 1; if (test_temp(voiecur)) { rename_temp(voiecur, pvoie->sr_fic); wr_dir(pvoie->sr_fic, pvoie->sta.indicatif.call); } retour_dos(); } break; case 2: new_label(); texte(T_DOS + 6); maj_niv(9, 3, 1); break; } } void dos_copy(void) { struct stat bufstat; int fd_orig, fd_dest; long nb_oct; Rlabel rlabel; FILE *fptr; char *ptri, *ptro, *ptr; char orig[80]; int r; get_nextparam(); if ((ptri = get_nextparam()) == NULL) { texte(T_ERR + 20); return; } if ((ptro = get_nextparam()) == NULL) { texte(T_ERR + 21); return; } if (strcmpi(ptri, ptro) == 0) { texte(T_ERR + 23); return; } if (!tst_point(ptri)) return; if (!tst_point(ptro)) return; strcpy(orig, tot_path(ch_slash(ptri), pvoie->dos_path)); stat(orig, &bufstat); strcpy(pvoie->appendf, ptri); if ((bufstat.st_mode & S_IFREG) == 0) { texte(T_ERR + 11); return; } if ((fd_orig = open(orig, O_RDONLY | O_BINARY)) == EOF) { texte(T_ERR + 11); return; } if (!aut_ecr(ch_slash(ptro), 1)) { close(fd_orig); return; } strcpy(pvoie->appendf, ptro); strcpy(pvoie->sr_fic, tot_path(ch_slash(ptro), pvoie->dos_path)); r = stat(pvoie->sr_fic, &bufstat); if ((r == 0 && (bufstat.st_mode & S_IFREG) == 0) || errno != ENOENT) { texte(T_ERR + 11); return; } if ((fd_dest = open(pvoie->sr_fic, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IREAD | S_IWRITE)) == EOF) { texte(T_ERR + 30); close(fd_orig); return; } nb_oct = copy_fic(fd_orig, fd_dest, NULL); close(fd_orig); close(fd_dest); wr_dir(pvoie->sr_fic, pvoie->sta.indicatif.call); *rlabel.label = '\0'; ptr = vir_path(orig); fptr = NULL; if ((ptr) && ((fptr = fopen(d_disque("YAPPLBL.DAT"), "rb")) != NULL)) { while (fread(&rlabel, sizeof(Rlabel), 1, fptr)) { if (strcmp(ptr, rlabel.nomfic) == 0) { fclose(fptr); fptr = NULL; w_label(pvoie->sr_fic, rlabel.label); break; } } } if (fptr) fclose(fptr); ltoa(nb_oct, varx[0], 10); texte(T_DOS + 7); return; } void copy_file(void) { if (!read_only()) dos_copy(); prompt_dos(); } void del_file(void) { char *ptr; if (!read_only()) { get_nextparam(); if ((ptr = get_nextparam()) == NULL) { texte(T_ERR + 20); } else { if (tst_point(ptr)) { if (aut_ecr(ch_slash(ptr), 1)) { strcpy(pvoie->appendf, ptr); if (unlink(tot_path(ptr, pvoie->dos_path)) == 0) texte(T_DOS + 10); else texte(T_ERR + 11); } } } } retour_dos(); } static void edit_label(void) { char *ptr; switch (pvoie->niv3) { case 0: if (droits(MODLABEL)) { struct stat st; get_nextparam(); if ((ptr = get_nextparam()) == NULL) { texte(T_ERR + 20); retour_dos(); break; } if (!tst_point(ptr) || !aut_ecr(ptr, 0)) { retour_dos(); break; } n_cpy(40, pvoie->appendf, ptr); strcpy(pvoie->sr_fic, tot_path(ch_slash(pvoie->appendf), pvoie->dos_path)); if (stat(pvoie->sr_fic, &st) == -1) { texte(T_ERR + 11); retour_dos(); break; } texte(T_YAP + 3); ch_niv3(1); } else { texte(T_ERR + 1); retour_dos(); } break; case 1: while ((*indd) && (!ISPRINT(*indd))) ++indd; if (ISGRAPH(*indd)) { w_label(pvoie->sr_fic, sup_ln(indd)); cr(); dir_yapp(pvoie->appendf); } retour_dos(); break; } } void help_appel(char *appel[]) { char s[80]; int i = 0; texte(T_DOS + 8); texte(T_DOS + 9); while (1) { if (*appel[i] == '\0') break; sprintf(s, "%-10s", appel[i]); outs(s, strlen(s)); if ((++i % 6) == 0) outs("\n", 1); } outs("\n\n", 2); } #ifdef __WINDOWS__ static int execute_dos(void) { char buf[80]; char cmd[256]; int disk; int i; int ret; char cur_dir[MAXPATH]; char fbbdos_dir[MAXPATH]; while (isalnum(*indd)) ++indd; while_space(); if (*indd) { /* recupere disque et repertoire courants */ disk = getdisk(); strcpy(cur_dir, "X:\\"); cur_dir[0] = 'A' + disk; getcurdir(0, cur_dir + 3); strcpy(fbbdos_dir, tot_path("", pvoie->dos_path)); if ((i = strlen(fbbdos_dir)) > 3) fbbdos_dir[i - 1] = '\0'; operationnel = 2; { char deroute[80]; wsprintf(deroute, "%sexecute.$$$", MBINDIR); ret = call_nbdos(&indd, 1, REPORT_MODE, deroute, fbbdos_dir, NULL); if (ret != -1) outfichs(deroute); unlink(deroute); } operationnel = 1; if (ret == -1) texte(T_ERR + 8); else if (ret != 0) { texte(T_ERR + 8); wsprintf(buf, "Errorlevel = %d", ret); outln(buf, strlen(buf)); } } else { texte(T_ERR + 20); } prompt_dos(); return (1); } #endif #ifdef __LINUX__ static int execute_dos(void) { char buf[256]; int ret; /* run a task under linux. This task is blocking ... */ /* Skip DOS command */ while (isalnum(*indd)) ++indd; while_space(); operationnel = 2; { char deroute[80]; char fbbdos_dir[256]; char *ptr; int i; strcpy(fbbdos_dir, tot_path("", pvoie->dos_path)); if ((i = strlen(fbbdos_dir)) > 3) fbbdos_dir[i - 1] = '\0'; sprintf(deroute, "%sexecute.xxx", MBINDIR); ptr = indd; /* Look for a semi-column or pipe command */ while (*ptr) { if (*ptr == ';' || *ptr == '|') { *ptr = '\0'; break; } ptr++; } ret = call_nbdos(&indd, 1, REPORT_MODE, deroute, fbbdos_dir, NULL); if (ret != -1) outfichs(deroute); unlink(deroute); } operationnel = 1; if (ret == -1) texte(T_ERR + 8); else if (ret != 0) { texte(T_ERR + 8); sprintf(buf, "Errorlevel = %d", ret); outln(buf, strlen(buf)); } prompt_dos(); return (1); } #endif #ifdef __FBBDOS__ static int execute_dos(void) { int retour = 1; static char slash_c[] = "/C"; char *arg[20]; char *ptr; char log[80]; int i = 0; int disk; int ofst; int duplic, oldstdout, oldstderr; char deroute[80]; char cur_dir[MAXPATH]; char fbbdos_dir[MAXPATH]; sprintf(deroute, "%s\\EXECUTE.$$$", getcwd(log, 80)); strtok(indd, " "); arg[i++] = getenv("COMSPEC"); arg[i++] = slash_c; while ((arg[i] = strtok(NULL, " ")) != NULL) ++i; if (i == 2) { retour = -1; texte(T_ERR + 20); } else { ofst = 2; ptr = strrchr(arg[2], '.'); if (ptr) { if (strcmp(strupr(ptr + 1), "BAT") == 0) ofst = 0; } deb_io(); /* redirige stdout et stderr sur le fichier EXECUTE.$$$ */ duplic = open(deroute, O_CREAT | O_RDWR, S_IWRITE | S_IREAD); oldstdout = dup(1); oldstderr = dup(2); dup2(duplic, 1); dup2(duplic, 2); close(duplic); /* recupere disque et repertoire courants */ disk = getdisk(); strcpy(cur_dir, "X:\\"); cur_dir[0] = 'A' + disk; getcurdir(0, cur_dir + 3); strcpy(fbbdos_dir, tot_path("", pvoie->dos_path)); setdisk(fbbdos_dir[0] - 'A'); if ((i = strlen(fbbdos_dir)) > 3) fbbdos_dir[i - 1] = '\0'; chdir(fbbdos_dir); operationnel = 2; break_ok(); retour = spawnvp(P_WAIT, arg[ofst], arg + ofst); if (retour == -1) { ofst = 0; retour = spawnvp(P_WAIT, arg[ofst], arg + ofst); } break_stop(); operationnel = 1; /* remet disque et repertoire courants */ setdisk(disk); chdir(cur_dir); /* Supprime les redirections */ dup2(oldstdout, 1); dup2(oldstderr, 2); close(oldstdout); close(oldstderr); fin_io(); outfich(deroute); unlink(deroute); if (retour == -1) texte(T_ERR + 8); else if (retour != 0) { texte(T_ERR + 8); sprintf(log, "Errorlevel = %d", retour); outln(log, strlen(log)); } } prompt_dos(); return (retour); } #endif static void view(void) { char *ptr; char temp[256]; get_nextparam(); ptr = get_nextparam(); if ((ptr) && (strchr(ptr, '/') == NULL)) { #ifdef __LINUX__ { static char *fbb_view = "fbb_view"; char *vptr = getenv("FBB_VIEW"); if (vptr == NULL) vptr = fbb_view; sprintf(temp, "DOS %s %s", vptr, back2slash(ptr)); } #else sprintf(temp, "DOS FV %s", ptr); #endif indd = temp; maj_niv(9, 99, 0); execute_dos(); cr(); } else { texte(T_ERR + 20); prompt_dos(); } } static int where(int lg, char *path, char *pattern) { struct ffblk ffblk; char rech[80]; char temp[128]; int done = 1; int premier = 1; int retour = 0; strcpy(rech, path); #ifdef __LINUX__ strcat(rech, "*"); #else strcat(rech, "*.*"); #endif ++where_loop; done = findfirst(rech, &ffblk, FA_DIREC); while (!done) { if (*ffblk.ff_name != '.') { if (ffblk.ff_attrib & FA_DIREC) { strcpy(temp, path); strcat(temp, ffblk.ff_name); strcat(temp, "\\"); if ((strncmp(temp + 1, ":\\PROC\\", 7) != 0) && (where_loop < 16)) { if (where(lg, temp, pattern)) retour = 1; } premier = 1; } else { if (strmatch(ffblk.ff_name, pattern)) { if (premier) { char v; if (pvoie->vdisk == 8) v = 'P'; else v = 'A' + pvoie->vdisk; sprintf(temp, "%c:%s :", v, path + lg); outln(temp, strlen(temp)); premier = 0; } *varx[4] = *varx[5] = *varx[6] = *varx[7] = '\0'; sprintf(varx[0], " %-13s", ffblk.ff_name); var_cpy(2, dir_date(ffblk.ff_fdate)); *varx[3] = '\0'; if ((ffblk.ff_attrib & FA_DIREC) != 0) { var_cpy(1, " "); } else { sprintf(varx[1], "%6ld", ffblk.ff_fsize); } texte(T_DOS + 3); retour = 1; if (pvoie->memoc >= MAXMEM) break; } } } done = findnext(&ffblk); } --where_loop; return (retour); } static void where_file(void) { int lg; int retour = 0; char *ptr; get_nextparam(); pvoie->noenr_menu = 0L; ptr = get_nextparam(); if (ptr == NULL) { texte(T_ERR + 20); retour_dos(); return; } if (tst_point(ptr)) { char cur_dir[80]; int sav_vdisk = pvoie->vdisk; for (pvoie->vdisk = 0; pvoie->vdisk < 9; ++pvoie->vdisk) { if (*PATH[pvoie->vdisk] == '\0') continue; if ((pvoie->vdisk == 8) && (*pvoie->finf.priv == '\0')) continue; /* strcpy (cur_dir, tot_path ("\0", "\\")); */ strcpy(cur_dir, PATH[pvoie->vdisk]); lg = strlen(cur_dir); where_loop = 0; if (where(lg - 1, cur_dir, ptr)) retour = 1; } pvoie->vdisk = sav_vdisk; } if (pvoie->memoc >= MAXMEM) outln("....", 4); else if (!retour) texte(T_DOS + 2); retour_dos(); } void menu_dos(void) { int i, error = 0; int vdisk; char *iptr, *optr, commande[80]; static char *appel[] = { "HELP", "?", "O", "DIR", "EDIT", "GET", "PUT", "CD", "MD", "MKDIR", "COPY", "DEL", "RD", "RMDIR", "TYPE", "DU", "YGET", "YPUT", "XGET", "XPUT", "LIST", "VIEW", "NEW", "LABEL", "WHERE", "X1GET", "ZGET", "ZPUT", "BGET", "BPUT", "EXIT", "QUIT", "F", "B", "\0" }; char com[80]; char temp[80]; limite_commande(); while (*indd && (!ISGRAPH(*indd))) indd++; strn_cpy(70, com, indd); sup_ln(indd); if (*indd == '\0') { prompt_dos(); return; } if (strncmp(com, "PRIV", 4) == 0) { fbb_log(voiecur, 'D', com); if (*pvoie->finf.priv) { pvoie->vdisk = 8; strcpy(pvoie->dos_path, "\\"); } else texte(T_ERR + 29); prompt_dos(); return; } if ((droits(EXEDOS)) && (strncmp(com, "DOS", 3) == 0)) { fbb_log(voiecur, 'D', com); maj_niv(9, 99, 0); execute_dos(); return; } if ((com[1] == ':') && (!ISGRAPH(com[2]))) { #ifdef __LINUX__ if (voiecur == CONSOLE) { static char *txt = "Cannot select a virtual disk in console mode"; outln(txt, strlen(txt)); prompt_dos(); return; } #endif vdisk = toupper(com[0]) - 'A'; if (vdisk == 15) { vdisk = 8; } strcat(com, "\\"); if ((voiecur == CONSOLE) && (is_dir(com))) { pvoie->vdisk = vdisk; strcpy(pvoie->dos_path, "\\"); } else if ((voiecur != CONSOLE) && (vdisk < 8) && (*PATH[vdisk])) { pvoie->vdisk = vdisk; strcpy(pvoie->dos_path, "\\"); } else if ((vdisk == 8) && (*pvoie->finf.priv)) { pvoie->vdisk = vdisk; strcpy(pvoie->dos_path, "\\"); } else texte(T_ERR + 29); prompt_dos(); return; } if ((strncmp(com, "HELP", 4) == 0) || (*com == '?') || (*com == 'H')) { if (*com == '?') ++indd; else { while (ISGRAPH(*indd)) ++indd; } while_space(); if (*indd == '\0') *--indd = '?'; if (!out_help(indd)) help_appel(appel); *indd = '\0'; } if ((strncmp(com, "CD", 2) == 0) && (ISGRAPH(*(com + 2)))) { sprintf(temp, "CD %s", com + 2); indd = temp; } if (*indd) { iptr = indd; optr = commande; while (ISGRAPH(*iptr)) { *optr = (islower(*iptr)) ? toupper(*iptr) : *iptr; iptr++; optr++; } *optr = '\0'; if (*commande == 'O') commande[1] = '\0'; i = 0; while (1) { optr = commande; var_cpy(0, optr); if (*appel[i] == '\0') { texte(T_ERR + 1); prompt_dos(); return; } if (strncmp(appel[i], optr, 3) == 0) break; ++i; } pvoie->temp1 = N_DOS; switch (i) { case 0: case 1: /* help_appel(appel) ; */ break; case 2: indd = com + 1; mbl_options(); retour_dos(); break; case 3: maj_niv(9, 1, 0); dir(); break; case 4: maj_niv(9, 9, 0); edit(); break; case 5: maj_niv(9, 2, 0); send_file(1); break; case 6: if (!is_room()) { outln("*** Disk full !", 15); error = 4; break; } maj_niv(9, 3, 0); receive_file(); break; case 7: maj_niv(9, 4, 0); change_dir(); break; case 8: case 9: maj_niv(9, 5, 0); make_dir(); break; case 10: if (!is_room()) { outln("*** Disk full !", 15); error = 4; break; } maj_niv(9, 6, 0); copy_file(); break; case 11: maj_niv(9, 7, 0); del_file(); break; case 12: case 13: maj_niv(9, 8, 0); remove_dir(); break; case 14: maj_niv(9, 2, 0); send_file(0); break; case 15: du(); break; case 16: if (!user_ok()) { error = 3; } else { if (P_MODM(voiecur)) { var_cpy(0, "YMODEM"); maj_niv(N_MOD, 4, XS_INIT); pvoie->type_yapp = 2; xmodem(); } else { indd += 3; *indd = 'D'; maj_niv(N_YAPP, 0, 0); menu_yapp(); } } break; case 17: if (!is_room()) { outln("*** Disk full !", 15); error = 4; break; } if (P_MODM(voiecur)) { #if defined(__WINDOWS__) || defined(__LINUX__) var_cpy(0, "YMODEM"); maj_niv(N_MOD, 4, XR_INIT); pvoie->type_yapp = 2; xmodem(); #else var_cpy(0, "YMODEM"); pvoie->type_yapp = 2; error = 2; #endif } else { indd += 3; *indd = 'U'; maj_niv(N_YAPP, 0, 0); menu_yapp(); } break; case 18: var_cpy(0, "XMODEM"); if (P_MODM(voiecur)) { if (!user_ok()) error = 3; else { maj_niv(N_MOD, 4, XS_INIT); pvoie->type_yapp = 0; xmodem(); } } else error = 2; break; case 19: if (!is_room()) { outln("*** Disk full !", 15); error = 4; break; } var_cpy(0, "XMODEM"); if (P_MODM(voiecur)) { maj_niv(N_MOD, 4, XR_INIT); pvoie->type_yapp = 0; xmodem(); } else error = 2; break; case 20: maj_niv(9, 10, 0); list(); break; case 21: maj_niv(9, 11, 0); view(); break; case 22: maj_niv(9, 12, 0); dir_new(); break; case 23: maj_niv(9, 14, 0); edit_label(); break; case 24: maj_niv(9, 16, 0); where_file(); break; case 25: var_cpy(0, "1K-XMODEM"); if (P_MODM(voiecur)) { if (!user_ok()) error = 3; else { maj_niv(N_MOD, 4, XS_INIT); pvoie->type_yapp = 1; xmodem(); } } else error = 2; break; case 26: var_cpy(0, "ZMODEM"); if (P_MODM(voiecur)) { if (!user_ok()) error = 3; else { maj_niv(N_MOD, 4, XS_INIT); pvoie->type_yapp = 3; xmodem(); } } else error = 2; break; case 27: if (!is_room()) { outln("*** Disk full !", 15); error = 4; break; } var_cpy(0, "ZMODEM"); if ((P_MODM(voiecur)) && ((BIOS(no_port(voiecur)) == P_WINDOWS) || (BIOS(no_port(voiecur)) == P_LINUX))) { if (!user_ok()) error = 3; else { maj_niv(N_MOD, 4, XR_INIT); pvoie->type_yapp = 3; xmodem(); } } else error = 2; break; case 28: if (!user_ok()) { error = 3; } else { maj_niv(N_BIN, 0, 0); bin_transfer(); } break; case 29: if (!is_room()) { outln("*** Disk full !", 15); error = 4; break; } maj_niv(N_BIN, 0, 4); bin_transfer(); break; case 30: case 31: case 32: error = 1; retour_mbl(); break; case 33: indd = com + 1; if (bye()) { error = 1; maj_niv(N_MENU, 0, 0); sortie(); } break; default: error = 1; retour_mbl(); break; } switch (error) { case 2: texte(T_YAP + 2); prompt_dos(); break; case 3: texte(T_ERR + 18); prompt_dos(); break; case 4: prompt_dos(); break; case 0: fbb_log(voiecur, 'D', com); break; } } else prompt_dos(); } void dos(void) { switch (pvoie->niv2) { case 0: menu_dos(); break; case 1: dir(); break; case 2: send_file(0); break; case 3: receive_file(); break; case 4: change_dir(); break; case 5: make_dir(); break; case 6: copy_file(); break; case 7: del_file(); break; case 8: remove_dir(); break; case 9: edit(); break; case 10: list(); break; case 11: view(); break; case 12: dir_new(); break; case 14: edit_label(); break; case 15: bin_transfer(); break; case 16: where_file(); break; case 99: execute_dos(); break; default: fbb_error(ERR_NIVEAU, "FBBDOS", pvoie->niv2); break; } } fbb-7.04j/src/dos_dir.c0100644000175100017510000003641707726663712013013 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #ifdef __LINUX__ #include #endif static int dir_time (char *); static long parcours (char, char *); int is_dir (char *chaine) { #ifdef __LINUX__ struct stat st; int ret; if ((strlen (chaine) > 2) && (chaine[1] == ':')) chaine += 2; ret = stat (back2slash (chaine), &st); if (ret == -1) return (0); return (S_ISDIR (st.st_mode)); #endif #if defined(__FBBDOS__) || defined (__WINDOWS__) int hand; struct dfree dtable; /* Teste la racine car NOVELL ne reconnait pas C:\ comme repertoire !!! */ if ((isalpha (chaine[0])) && (chaine[1] == ':') && (chaine[2] == '\\') && (!chaine[3])) { getdfree (toupper (chaine[0]) - '@', &dtable); if (dtable.df_sclus == 0xffff) { /* Disque non valide ? */ return (0); } else return (1); } /* Fin du rajout NOVELL */ if (access (chaine, 0) == 0) { hand = open (chaine, O_RDONLY); /* Repertoire ou fichier ? */ if (hand == -1) { return (1); } else { close (hand); return (0); } } return (0); #endif } void prompt_dos (void) { char *scan; char *ptr = local_path (pvoie->dos_path); if ((scan = strchr (ptr, ':')) != NULL) ptr = scan + 1; var_cpy (0, ptr); texte (T_DOS + 0); maj_niv (9, 0, 0); } static int dir_time (char *indic) { int lg = strlen (indic); int pos; int c[3]; for (pos = 0; pos < 3; c[pos++] = '\0') ; pos = 0; while (lg--) { if (isalpha (indic[lg])) c[pos++] = (int) (indic[lg] - 'A'); if (pos == 3) break; } return (c[0] | (c[1] << 5) | (c[2] << 10)); } void wr_dir (char *fichier, char *indic) { #if defined(__FBBDOS__) || defined(__WINDOWS__) int fd; int dt = dir_time (indic); long temps = time (NULL); struct tm *sdate; struct ftime dirtime; sdate = localtime (&temps); dirtime.ft_year = sdate->tm_year - 80; dirtime.ft_day = sdate->tm_mday; dirtime.ft_month = sdate->tm_mon + 1; dirtime.ft_hour = dt >> 11; dirtime.ft_min = (dt >> 5) & 0x3f; dirtime.ft_tsec = dt & 0x1f; if ((fd = open (fichier, O_RDONLY)) != -1) { setftime (fd, &dirtime); close (fd); } #endif #ifdef __LINUX__ struct utimbuf buf; long temps = time (NULL); struct tm *sdate; int dt = dir_time (indic); int heure = dt >> 11; int minute = (dt >> 5) & 0x3f; int seconde = (dt & 0x1f) << 1; sdate = localtime (&temps); sdate->tm_hour = heure; sdate->tm_min = minute; sdate->tm_sec = seconde; /* printf("Ecrit : heure=%d min=%d sec=%d\n", sdate->tm_hour, sdate->tm_min, sdate->tm_sec); */ buf.actime = buf.modtime = mktime (sdate); if (utime (back2slash (fichier), &buf) != 0) perror ("utime"); #endif } int aut_dir (char *fichier, char *indic) { if (droits (SUPFIC)) { return (1); } else { #if defined(__FBBDOS__) || defined(__WINDOWS__) union { struct ftime dirtime; struct { int time; int date; } dtime; } utime; int fd; if ((fd = open (fichier, O_RDONLY)) == -1) return (1); getftime (fd, &(utime.dirtime)); close (fd); return (utime.dtime.time == dir_time (indic)); #endif #ifdef __LINUX__ int fd; struct stat buf; time_t temps; struct tm *sdate; int dt; if ((fd = open (fichier, O_RDONLY)) == -1) return (1); fstat (fd, &buf); temps = buf.st_mtime; close (fd); sdate = localtime (&temps); dt = (sdate->tm_hour << 11) + (sdate->tm_min << 5) + (sdate->tm_sec >> 1); return (dt == dir_time (indic)); #endif } } static int protected_dir(char *file) { int protected = 0; char nomfich[256]; FILE *fptr; char *ptr, *scan; char ligne[81]; #ifdef __FBBDOS__ if ((fptr = fopen (c_disque ("prot_d.sys"), "r")) == NULL) #endif #ifdef __WINDOWS__ if ((fptr = fopen (c_disque ("prot_w.sys"), "r")) == NULL) #endif #ifdef __LINUX__ if ((fptr = fopen (c_disque ("prot_l.sys"), "r")) == NULL) #endif { fptr = fopen (c_disque ("protect.sys"), "r"); } if (fptr) { while (fgets (ligne, 80, fptr)) { ptr = scan = ligne; while ((*scan) && (!ISGRAPH (*scan))) ++scan; while (ISGRAPH (*scan)) *ptr++ = *scan++; *ptr = '\0'; if (*ligne == '#' || *ligne == '\0') continue; strcpy (nomfich, tot_path (file, pvoie->dos_path)); ptr = strrchr (nomfich, '\\'); if (ptr == nomfich) strcpy (nomfich, "\\"); else *ptr = '\0'; #ifdef __LINUX__ ptr = slash2back(ligne); scan = nomfich; if (ptr[1] != ':' && nomfich[1] == ':') scan += 2; #else ptr = ligne; scan = nomfich; #endif if (strncmpi (ptr, scan, strlen(ptr)) == 0) { protected = 1; break; } } ferme (fptr, 77); } return protected; } int aut_ecr (char *fichier, int check_dir) { int supp = TRUE; char *ptr, *scan; char nomfich[256]; if (droits (ACCESDOS) && droits (SUPFIC) && (*fichier == '+')) { if (*fichier == '+') { /* Deletes the '+' character */ ptr = scan = fichier; ++scan; while ((*ptr++ = *scan++) != '\0') ; } } else { if (check_dir) supp = !protected_dir(fichier); if ((supp) && (!droits (ACCESDOS))) { strcpy (nomfich, tot_path (fichier, pvoie->dos_path)); supp = aut_dir (nomfich, pvoie->sta.indicatif.call); } } if (!supp) { strcpy (pvoie->appendf, fichier); texte (T_ERR + 23); } return (supp); } /* static int exist(char*file) { return (access(local_path(tot_path(file, pvoie->dos_path)), 0) == 0) ; } */ void remove_dir (void) { char *ptr; get_nextparam(); if ((ptr = get_nextparam()) == NULL) { texte (T_ERR + 25); } else { if (tst_point (ptr)) { if (aut_ecr (ch_slash (ptr), 1)) { var_cpy (0, ptr); #ifdef __LINUX__ if (fbb_rmdir (tot_path (ptr, pvoie->dos_path)) == 0) #else if (rmdir (tot_path (ptr, pvoie->dos_path)) == 0) #endif texte (T_DOS + 1); else texte (T_ERR + 24); } } } prompt_dos (); } void make_dir (void) { char *ptr, *path; get_nextparam(); if ((ptr = get_nextparam()) == NULL) { texte (T_ERR + 25); } else { ch_slash (ptr); #ifdef __LINUX__ path = tot_path (ptr, pvoie->dos_path); if (fbb_mkdir (path, 0777) != 0) { var_cpy (0, ptr); texte (T_ERR + 26); } else { wr_dir (path, pvoie->sta.indicatif.call); } #endif #if defined(__FBBDOS__) || defined(__WINDOWS__) if (mkdir (tot_path (ptr, pvoie->dos_path)) != 0) { var_cpy (0, ptr); texte (T_ERR + 26); } #endif } prompt_dos (); } static void teste_file_name (char *ptr) { /* int ok; int lg = 0; int max = 8; char *ptro = ptr; while (*ptr) { ok = 1; if (*ptr == '.') { lg = 0; max = 3; } else if (*ptr == '\\') { lg = 0; max = 8; } else if (++lg > max) { ok = 0; } if (ok) *ptro++ = *ptr; ++ptr; } *ptro = '\0'; */ } void change_dir (void) { int nb; char local_dir[256], *ptr, *scan, *cur_dir; strcpy (local_dir, pvoie->dos_path); get_nextparam(); if ((ptr = get_nextparam()) == NULL) { nb = strlen (local_dir); if (nb > 1) { --nb; local_dir[nb] = '\0'; } outln (local_dir, nb); } else { ch_slash (ptr); teste_file_name (ptr); if (*ptr == '\\') { if (tst_point (ptr)) { strcpy (local_dir, ptr); if (strlen (local_dir) > 1) strcat (local_dir, "\\"); } } else { if ((scan = strtok (ptr, "\\\r")) != NULL) { do { if (strcmp (scan, ".") == 0) continue; if (strncmp (scan, "..", 2) == 0) { cur_dir = strrchr (local_dir, '\\'); if (cur_dir != local_dir) { do { *cur_dir-- = '\0'; } while (*cur_dir != '\\'); } } else if (*scan != '~') { strcat (local_dir, scan); strcat (local_dir, "\\"); } } while ((scan = strtok (NULL, "\\\r")) != NULL); } } if (strlen (local_dir) > 40) texte (T_ERR + 28); else { char ldir[256]; char *ptr; strcpy(ldir, tot_path ("\0", local_dir)); ptr = long_filename(NULL, ldir); if (is_dir (local_path (ptr)) > 0) strcpy (pvoie->dos_path, ptr + strlen(ptr) - strlen(local_dir)); else texte (T_ERR + 29); } } prompt_dos (); } char *dir_date (int date) { int jour, mois, annee; static char ch_date[11]; jour = date & 0x1f; mois = (date >> 5) & 0x0f; annee = 80 + ((date >> 9) & 0x3f); sprintf (ch_date, "%02d-%02d-%02d", jour, mois, annee % 100); return (ch_date); } int dir_suite (char *masque) { int n; char chaine[257]; char temp[257]; if (masque) { strcpy (temp, tot_path (ch_slash (masque), pvoie->dos_path)); n = strlen (temp); if ((n > 3) && (temp[n - 1] == '\\')) temp[n - 1] = '\0'; if (is_dir (temp)) { if ((strlen (masque) == 3) && (masque[2] == '\\')) masque[2] = '\0'; #ifdef __LINUX__ sprintf (chaine, "%s/*", masque); #else sprintf (chaine, "%s/*.*", masque); #endif masque = chaine; } if (findfirst (tot_path (ch_slash (masque), pvoie->dos_path), &(pvoie->dirblk), FA_DIREC)) { texte (T_DOS + 2); return (FALSE); } if (*pvoie->dirblk.ff_name == '.') { findnext (&(pvoie->dirblk)); if (findnext (&(pvoie->dirblk))) { texte (T_DOS + 2); return (FALSE); } } var_cpy (3, pvoie->dirblk.ff_name); var_cpy (2, dir_date (pvoie->dirblk.ff_fdate)); *varx[0] = '\0'; *varx[4] = *varx[5] = *varx[6] = *varx[7] = '\0'; if ((pvoie->dirblk.ff_attrib & FA_DIREC) != 0) { var_cpy (1, " "); } else { long size = pvoie->dirblk.ff_fsize; if (size > (99999 * 1024)) sprintf (varx[1], "%5ld M", size / (1024 * 1024)); else if (size > 999999) sprintf (varx[1], "%5ld K", size / 1024); else sprintf (varx[1], "%7ld", size); } /* if (findnext (&(pvoie->dirblk))) { *varx[4] = *varx[5] = *varx[6] = *varx[7] = '\0'; texte (T_DOS + 3); return (FALSE); } sprintf (varx[4], "%-13s", pvoie->dirblk.ff_name); var_cpy (6, dir_date (pvoie->dirblk.ff_fdate)); *varx[7] = '\0'; if ((pvoie->dirblk.ff_attrib & FA_DIREC) != 0) { var_cpy (5, " "); } else { sprintf (varx[5], "%7ld", pvoie->dirblk.ff_fsize); }*/ texte (T_DOS + 3); } while (1) { if (findnext (&(pvoie->dirblk))) return (FALSE); /* sprintf (varx[0], "%-13s", pvoie->dirblk.ff_name); */ var_cpy (3, pvoie->dirblk.ff_name); var_cpy (2, dir_date (pvoie->dirblk.ff_fdate)); *varx[0] = '\0'; *varx[4] = *varx[5] = *varx[6] = *varx[7] = '\0'; if ((pvoie->dirblk.ff_attrib & FA_DIREC) != 0) { var_cpy (1, " "); } else { long size = pvoie->dirblk.ff_fsize; if (size > (99999 * 1024)) sprintf (varx[1], "%5ld M", size / (1024 * 1024)); else if (size > 999999) sprintf (varx[1], "%5ld K", size / 1024); else sprintf (varx[1], "%7ld", size); } /* if (findnext (&(pvoie->dirblk))) { *varx[4] = *varx[5] = *varx[6] = *varx[7] = '\0'; texte (T_DOS + 3); return (FALSE); } sprintf (varx[4], "%-13s", pvoie->dirblk.ff_name); var_cpy (6, dir_date (pvoie->dirblk.ff_fdate)); *varx[7] = '\0'; if ((pvoie->dirblk.ff_attrib & FA_DIREC) != 0) { var_cpy (5, " "); } else { sprintf (varx[5], "%7ld", pvoie->dirblk.ff_fsize); }*/ texte (T_DOS + 3); } /* return(TRUE) ; */ } void retour_dir (char vdisk) { int disk; if (vdisk == 8) disk = (pvoie->finf.priv[1] == ':') ? pvoie->finf.priv[0] - '@' : getdisk () + 1; else if ((voiecur == CONSOLE) || (pvoie->niv1 == N_YAPP)) disk = vdisk + 1; else #ifdef __LINUX__ disk = vdisk + 1; #else disk = PATH[vdisk][0] - '@'; #endif ultoa (free_disk (disk) * 1024UL, varx[0], 10); texte (T_DOS + 11); retour_dos (); } void dir (void) { char vdisk; char *ptr; #ifdef __LINUX__ char temp[] = "X:*"; #else char temp[] = "X:*.*"; #endif get_nextparam(); pvoie->noenr_menu = 0L; ptr = get_nextparam(); if (ptr == NULL) { temp[0] = (pvoie->vdisk == 8) ? 'P' : pvoie->vdisk + 'A'; ptr = temp; } vdisk = pvoie->vdisk; if ((*(ptr + 1) == ':') && (*(ptr + 2) == '\0')) { temp[0] = *ptr; vdisk = *ptr - 'A'; if (vdisk == 15) vdisk = 8; ptr = temp; } if (!tst_point (ptr)) retour_dos (); else if (dir_suite (ptr)) { texte (T_TRT + 11); maj_niv (9, 1, 1); } else retour_dir (vdisk); } void list (void) { char vdisk; char *ptr; #ifdef __LINUX__ char temp[] = "X:*"; #else char temp[] = "X:*.*"; #endif get_nextparam(); ptr = get_nextparam(); if (ptr == NULL) { temp[0] = (pvoie->vdisk == 8) ? 'P' : pvoie->vdisk + 'A'; ptr = temp; } vdisk = pvoie->vdisk; if ((*(ptr + 1) == ':') && (*(ptr + 2) == '\0')) { temp[0] = *ptr; vdisk = *ptr - 'A'; if (vdisk == 13) vdisk = 8; ptr = temp; } #if 0 if ((ptr = strtok (NULL, " \r")) == NULL) { ptr = temp; } liste_label (); if (!tst_point (ptr)) retour_dos (); if (dir_yapp (ptr)) { texte (T_TRT + 11); ch_niv3 (1); } else { pvoie->noenr_menu = 0L; libere_label (voiecur); retour_dir (); } #endif if (tst_point (ptr)) { dir_yapp (ptr); retour_dir (vdisk); } else retour_dos (); } static long parcours (char vdisk, char *path) { struct ffblk ffblk; long total = 0L; long local = 0L; char rech[80]; char temp[128]; int done = 1; int pos; strcpy (rech, path); #ifdef __LINUX__ strcat (rech, "*"); #else strcat (rech, "*.*"); #endif if (voiecur == CONSOLE) pos = 0; else { char *ptr = PATH[(int)vdisk]; pos = strlen (ptr) - 1; if (ptr[1] == ':') pos -= 2; } done = findfirst (rech, &ffblk, FA_DIREC); while (!done) { if (*ffblk.ff_name != '.') { #ifdef __LINUX__ if ((ffblk.ff_attrib & FA_DIREC) && ((ffblk.ff_attrib & FA_LINK) == 0)) #else if (ffblk.ff_attrib & FA_DIREC) #endif { strcpy (temp, path); strcat (temp, ffblk.ff_name); strcat (temp, "\\"); if (strncmp (temp + 1, ":\\PROC\\", 7) != 0) { total += parcours (vdisk, temp); } } else { local += ffblk.ff_fsize; } } done = findnext (&ffblk); } total += local; sprintf (temp, "%8ld KB %8ld KB %s", (total + 1023)/1024, (local + 1023)/1024, path + pos); outln (temp, strlen (temp)); return (total); } void du (void) { char vdisk; char *ptr; char temp[] = "X:"; char path[256]; get_nextparam(); ptr = get_nextparam(); if (ptr == NULL) { temp[0] = (pvoie->vdisk == 8) ? 'P' : pvoie->vdisk + 'A'; ptr = temp; } vdisk = pvoie->vdisk; if ((*(ptr + 1) == ':') && (*(ptr + 2) == '\0')) { temp[0] = *ptr; vdisk = *ptr - 'A'; if (vdisk == 13) vdisk = 8; ptr = temp; } if (tst_point (ptr)) { strcpy (path, tot_path (ch_slash (ptr), pvoie->dos_path)); parcours (vdisk, path); retour_dir (vdisk); } else retour_dos (); } fbb-7.04j/src/driver.c0100644000175100017510000002654707726660244012663 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include typedef int (*sta_)(int, int, int, void *); typedef int (*snd_)(int, int, int, char *, int, Beacon *); typedef int (*rcv_)(int *, int *, int *, char *, int *, ui_header *); typedef int (*opn_)(int, int); typedef int (*cls_)(int); typedef struct { sta_ sta; snd_ snd; rcv_ rcv; opn_ opn; cls_ cls; } DrvFct; /* I don't know how to avoid this warning... */ static DrvFct drv_fct[NB_TYP] = { /* STA_DRV SND_DRV RCV_DRV */ { sta_ded, snd_ded, rcv_ded, opn_ded, cls_ded } , /* TYP_DED */ { sta_aea, snd_aea, rcv_aea, NULL, NULL } , /* TYP_PK */ { sta_mod, snd_mod, NULL, NULL, NULL } , /* TYP_MOD */ { sta_kam, snd_kam, rcv_kam, NULL, NULL } , /* TYP_KAM */ #if !defined(__WIN32__) && (defined(__WINDOWS__) || defined(__FBBDOS__)) { sta_bpq, snd_bpq, rcv_bpq, NULL, NULL } , /* TYP_BPQ */ #else { NULL, NULL, NULL, NULL, NULL } , /* TYP_BPQ */ #endif #if defined(__WINDOWS__) { sta_tcp, snd_tcp, NULL, NULL, NULL } , /* TYP_TCP */ #elif defined(__LINUX__) { sta_tcp, snd_tcp, rcv_tcp, opn_tcp, cls_tcp } , /* TYP_TCP */ #else { NULL, NULL, NULL, NULL, NULL } , /* TYP_TCP */ #endif #if defined(__LINUX__) { sta_sck, snd_sck, rcv_sck, opn_sck, cls_sck } , /* TYP_SOCK */ #else { NULL, NULL, NULL, NULL, NULL } , /* TYP_SOCK */ #endif #if defined(__WINDOWS__) { sta_agw, snd_agw, rcv_agw, opn_agw, cls_agw } , /* TYP_AGW */ #else { NULL, NULL, NULL, NULL, NULL } , /* TYP_AGW */ #endif #if defined(__WINDOWS__) { sta_tcp, snd_tcp, rcv_tcp, NULL, NULL } , /* TYP_ETH */ #elif defined(__LINUX__) { sta_tcp, snd_tcp, rcv_tcp, opn_tcp, cls_tcp } , /* TYP_ETH */ #else { NULL, NULL, NULL, NULL, NULL } , /* TYP_ETH */ #endif { sta_hst, snd_hst, rcv_hst, opn_hst, cls_hst } , /* TYP_HST */ #if defined(__WINDOWS__) || defined(__FBBDOS__) { sta_flx, snd_flx, rcv_flx, opn_flx, cls_flx } , /* TYP_FLX */ #else { NULL, NULL, NULL, NULL, NULL } , /* TYP_FLX */ #endif #if defined(__LINUX__) { sta_pop, snd_pop, rcv_pop, opn_pop, cls_pop } , /* TYP_POP */ #else { NULL, NULL, NULL, NULL, NULL } , /* TYP_POP */ #endif }; void clear_queue (int voie) { if (P_TOR (voie)) { sta_drv (voie, TOR, "%C"); } } void tor_end (int voie) { } void tor_start (int voie) { if (P_TOR (voie)) { sta_drv (voie, TOR, "%I"); } } void tor_stop (int voie) { if (P_TOR (voie)) { sta_drv (voie, TOR, "%O"); } } void tor_disc (int voie) { } /******************************************* * * Status d'une voie * * Retourne le status demande dans *ptr * *******************************************/ int sta_drv (int voie, int cmd, void *ptr) { int canal; int val = 0; int port = no_port (voie); int p; if (DEBUG) return (0); df ("sta_drv", 4); if ((voie == CONSOLE) || (voie == INEXPORT)) { ff (); return (0); } p = p_port[port].typort; if (drv_fct[p].sta) { canal = svoie[voie]->affport.canal; val = (drv_fct[p].sta) (port, canal, cmd, ptr); } ff (); return (val); } /******************************************* / / Lecture d'une voie / / cmd retourne le type de donnees lues / buf retourne les donnees lues / len retourne longueur des donnees lues / ptr retourne l'info monitoring (ou NULL) / ********************************************/ int rcv_drv (int *port, int *voie, int *cmd, char *buf, int *len, ui_header * ptr) { int val = 0; int canal = 0; int p; if (DEBUG) return (0); df ("rcv_drv", 12); if ((*voie == CONSOLE) || (*voie == INEXPORT)) { ff (); return (0); } p = p_port[*port].typort; if (drv_fct[p].rcv) { val = (drv_fct[p].rcv) (port, &canal, cmd, buf, len, ptr); if (val) { if (val == 1) { /* Active le flag de processing */ is_idle = 0; } val = 1; /* Reponse a une commande */ if ((*cmd == ECHOCMD) || (*cmd == ERRCMD)) { #ifdef __WINDOWS__ SendEchoCmd (buf, *len); #endif *len = 0; *cmd = NOCMD; ff (); return (0); } /* Recherche la voie correspondant au canal */ if ((*cmd != UNPROTO) && (*cmd != NBBUF)) { *voie = no_voie (*port, canal); if (*voie == -1) { ff (); return (0); } #ifdef __LINUX__ if ((!HST (*port)) && (!DRSI (*port)) && (!BPQ (*port)) && (!S_LINUX (*port))) #else if ((!HST (*port)) && (!DRSI (*port)) && (!BPQ (*port)) && (!AGW (*port))) #endif { svoie[*voie]->affport.port = *port; } } } } ff (); return (val); } /******************************************* / / Ecriture d'une voie / / cmd contient le type de donnees lues / buf contient les donnees envoyees / len contient la longueur des donnees lues / ptr contient l'info monitoring (ou NULL) / ********************************************/ int snd_drv (int voie, int cmd, char *buffer, int len, Beacon * ptr) { int val = 0; int canal; int port; int p; /* Recherche du port */ if (cmd == UNPROTO) port = voie; else port = no_port (voie); p = p_port[port].typort; if ((DEBUG) || (!p_port[port].pvalid)) { return (1); } if ((cmd != UNPROTO) && ((voie == CONSOLE) || (voie == INEXPORT))) return (0); df ("snd_drv", 7); if (drv_fct[p].snd) { if (cmd == UNPROTO) { { val = (drv_fct[p].snd) (port, 0, cmd, buffer, len, ptr); ptr = ptr->next; } } else { canal = svoie[voie]->affport.canal; val = (drv_fct[p].snd) (port, canal, cmd, buffer, len, ptr); if ((cmd == DATA) && (svoie[voie]->sta.mem)) --svoie[voie]->sta.mem; } } if (val) { is_idle = 0; } ff (); return (val); } /******************************************* / / Ouverture d'un port / ********************************************/ int opn_drv (int port, int nb) { int p; int val = 0; if (DEBUG) return (0); p = p_port[port].typort; if (drv_fct[p].opn) { val = (drv_fct[p].opn) (port, nb); } return (val); } /******************************************* / / Fermeture d'un port / ********************************************/ int cls_drv (int port) { int p; int val = 0; if (DEBUG) return (0); p = p_port[port].typort; if (drv_fct[p].cls) { val = (drv_fct[p].cls) (port); } return (val); } /* * Fonctions diverses */ int no_voie (int port, int canal) { int i; df ("no_voie", 2); #ifdef __LINUX__ if (S_LINUX (port)) { for (i = 1; i < NBVOIES; i++) { if ((S_LINUX ((int)svoie[i]->affport.port)) && (canal == svoie[i]->affport.canal)) { ff (); return (i); } } } else #endif if (HST (port)) { for (i = 1; i < NBVOIES; i++) { if ((port == svoie[i]->affport.port) && (canal == 1) && (P_TOR (i))) { /* Port pactor */ ff (); return (i); } if ((HST ((int)svoie[i]->affport.port)) && (canal == svoie[i]->affport.canal)) { ff (); return (i); } } } else if (BPQ (port)) { for (i = 1; i < NBVOIES; i++) { if ((BPQ ((int)svoie[i]->affport.port)) && (canal == svoie[i]->affport.canal)) { ff (); return (i); } } } else if (DRSI (port)) { for (i = 1; i < NBVOIES; i++) { if ((DRSI ((int)svoie[i]->affport.port)) && (canal == svoie[i]->affport.canal)) { ff (); return (i); } } } else if (AGW (port)) { for (i = 1; i < NBVOIES; i++) { if ((AGW ((int)svoie[i]->affport.port)) && (canal == svoie[i]->affport.canal)) { ff (); return (i); } } } else { for (i = 1; i < NBVOIES; i++) { if ((port == svoie[i]->affport.port) && (canal == svoie[i]->affport.canal)) { ff (); return (i); } } } ff (); return (-1); } int is_pactor (void) { int port; for (port = 1; port < NBPORT; port++) if (IS_PACTOR (port)) return (port); return (0); } void not_allowed (char *buffer) { #ifdef ENGLISH sprintf (buffer, "Not an allowed command !"); #else sprintf (buffer, "Commande impossible ! "); #endif } void paclen_change (int port, int canal, char *buffer) { int voie = 0; int pac; int *p_ptr; char *ptr = buffer; if (canal) voie = no_voie (port, canal); do { ++ptr; } while (isspace (*ptr)); if (canal) { p_ptr = &(svoie[voie]->paclen); } else { p_ptr = &(p_port[port].pk_t); } if (isdigit (*ptr)) { pac = atoi (ptr); *buffer = '\0'; if ((pac >= 30) && (pac <= 250)) *p_ptr = pac; else sprintf (buffer, "INVALID VALUE : %d\r\n", pac); } else sprintf (buffer, "%d\r\n", *p_ptr); } char *mot (char *chaine) { static char ch_retour[20]; char *ptr = ch_retour; while (isalnum (*chaine)) *ptr++ = *chaine++; *ptr = '\0'; return (ch_retour); } void env_date (void) { struct tm *sdate; int port; long temps = time (NULL); char buffer[300]; sdate = localtime (&temps); for (port = 1; port < NBPORT; port++) { if (p_port[port].pvalid) { deb_io (); switch (p_port[port].typort) { case TYP_DED: sprintf (buffer, "K %02d:%02d:%02d", sdate->tm_hour, sdate->tm_min, sdate->tm_sec); tnc_commande (port, buffer, PORTCMD); sprintf (buffer, "K %02d/%02d/%02d", sdate->tm_mon + 1, sdate->tm_mday, sdate->tm_year % 100); tnc_commande (port, buffer, PORTCMD); break; case TYP_PK: sprintf (buffer, "DA%02d%02d%02d%02d%02d", sdate->tm_year % 100, sdate->tm_mon + 1, sdate->tm_mday, sdate->tm_hour, sdate->tm_min); selcanal (port); tnc_commande (port, buffer, PORTCMD); break; } fin_io (); } } } #define CESC 0x1f void set_binary (int voie, int val) { svoie[voie]->binary = val; sta_drv (voie, BINCMD, &val); } void set_bs (int voie, int val) { sta_drv (voie, BSCMD, &val); } #ifdef __LINUX__ #ifdef OLD_AX25 #include #include #include #else #include #include #include #endif /* Une seule initialisation quelque soit le driver */ int fbb_ax25_config_load_ports (void) { static int init_ok = 0; if (init_ok) return (1); init_ok = 1; return (ax25_config_load_ports ()); } /* Une seule initialisation quelque soit le driver */ int fbb_nr_config_load_ports (void) { static int init_ok = 0; if (init_ok) return (1); init_ok = 1; return (nr_config_load_ports ()); } /* Une seule initialisation quelque soit le driver */ int fbb_rs_config_load_ports (void) { static int init_ok = 0; if (init_ok) return (1); init_ok = 1; return (rs_config_load_ports ()); } #endif fbb-7.04j/src/drv_aea.c0100644000175100017510000002637107726646105012764 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include static void pk_check (int port); static int pk_inbuf (int *port, int *canal, int *cmd, char *buffer, int *len, ui_header * ptr); static int pk_read (int port, char *buffer); static int pk_send (int port, int canal, int type, char *chaine, int len); static int pk_send_ok (int port, int canal, int type, char *buffer, int len); static int pk_send_ui (int port, char *buffer, int len, Beacon * beacon); static int pk_stat (int port, int canal, stat_ch * ptr); static void pk_get_ui (int port, char *buffer, ui_header * ui); int sta_aea (int port, int canal, int cmd, void *ptr) { switch (cmd) { case TNCSTAT: return (pk_stat (port, canal, (stat_ch *) ptr)); case SNDCMD: case ECHOCMD: return (pk_send (port, canal, 1, (char *) ptr, strlen (ptr))); case PORTCMD: return (pk_send (port, 0xf, 1, ptr, strlen (ptr))); } return (0); } int rcv_aea (int *port, int *canal, int *cmd, char *buffer, int *len, ui_header * ptr) { int val; val = pk_inbuf (port, canal, cmd, buffer, len, ptr); return (val); } int snd_aea (int port, int canal, int cmd, char *buffer, int len, Beacon * ptr) { int ret = 0; switch (cmd) { case COMMAND: ret = pk_send (port, canal, 1, buffer, len); break; case DATA: ret = pk_send (port, canal, 2, buffer, len); break; case UNPROTO: ret = pk_send_ui (port, buffer, len, ptr); break; } return (ret); } static int pk_stat (int port, int canal, stat_ch * ptr) { static long last_call = 0L; char buf[80]; long temps; /* Demande les stats courantes */ if (ptr) { temps = time (NULL); if (temps == last_call) return 1; last_call = temps; } /* Refait une demande de stats sur le canal */ if (canal != 0xf) canal = canal - 1; sprintf (buf, "\001%cCO\027", 0x40 + canal); tncstr (port, buf, 0); return 1; } static int pk_send (int port, int canal, int type, char *buffer, int len) { if (p_port[port].polling == 0) { /* Rien en cours, On envoie directement... */ p_port[port].polling = 1; return (pk_send_ok (port, canal, type, buffer, len)); } else { /* Bufferise la requete */ PortData *cmd = p_port[port].cmd; if (cmd) { /* Rajoute la commande en fin de queue */ while (cmd->next) cmd = cmd->next; cmd->next = (PortData *) m_alloue (sizeof (PortData)); cmd = cmd->next; } else cmd = p_port[port].cmd = (PortData *) m_alloue (sizeof (PortData)); cmd->next = NULL; cmd->canal = canal; cmd->cmd = type; cmd->len = len > 256 ? 256 : len; memcpy (cmd->buf, buffer, cmd->len); } return 1; } static void pk_check (int port) { if (p_port[port].cmd) { PortData *cmd = p_port[port].cmd; p_port[port].cur_can = cmd->canal; pk_send_ok (port, cmd->canal, cmd->cmd, cmd->buf, cmd->len); p_port[port].cmd = cmd->next; m_libere (cmd, sizeof (PortData)); p_port[port].last_cmde = '\0'; } else p_port[port].polling = 0; } static int pk_send_ok (int port, int canal, int type, char *buffer, int len) { /* Le premier canal est 1 dans FBB, 0 sur PK232 */ if (canal != 0xf) --canal; switch (type) { case 0: /* Unproto */ send_tnc (port, 0x1); send_tnc (port, 0x29); break; case 1: /* Commande */ send_tnc (port, 0x1); send_tnc (port, 0x40 + canal); break; case 2: /* Data */ send_tnc (port, 0x1); send_tnc (port, 0x20 + canal); break; default: return (0); } while (len) { if ((*buffer == '\027') || (*buffer == '\020') || (*buffer == '\001')) send_tnc (port, '\020'); send_tnc (port, *buffer++); --len; } send_tnc (port, '\027'); sleep_ (1); if (type == 2) pk_stat (port, (canal == 0xf) ? canal : canal + 1, NULL); sleep_ (1); return (1); } static int pk_inbuf (int *port, int *canal, int *cmd, char *buffer, int *len, ui_header * ui) { int commande, nbcar, can, nb, nback = 0; char *ptr; static char buf[600]; int valid = 0; int offset = 1; if ((nbcar = pk_read (*port, buf)) < 2) return (0); *buffer = '\0'; commande = *buf & 0xf0; can = *buf & 0x0f; switch (commande) { case 0x30: if ((can == 0xf) || (can == 0xd)) { ptr = buf; nb = 0; if (buf[1] == 'p') { *port = (int) (*(buf + 2) - '0'); offset += 3; } while (nbcar) { if ((*ptr == ':') || ((*ptr == '\r') && (isdigit (*(ptr - 1))))) { *ptr++ = '\0'; --nbcar; break; } ++ptr; --nbcar; } pk_get_ui (*port, buf + offset, ui); if (nbcar > 0) { sprintf (ui->txt, " (%d)", nbcar); memcpy (buffer, ptr, nbcar); } else nbcar = 0; valid = 1; *cmd = UNPROTO; *canal = can; *len = nbcar; } else { /* First channel of TNC must be 1 */ can = can + 1; memcpy (buffer, buf + 1, nbcar - 1); valid = 1; *cmd = DATA; *canal = can; *len = nbcar - 1; } break; case 0x40: if (can == 0xf) { memcpy (buffer, buf + 1, 3); switch (buffer[2]) { case 0: strcpy (buffer + 3, "OK\r"); break; case 1: strcpy (buffer + 3, "bad\r"); break; case 2: strcpy (buffer + 3, "too many\r"); break; case 3: strcpy (buffer + 3, "not enough\r"); break; case 4: strcpy (buffer + 3, "too long\r"); break; case 5: strcpy (buffer + 3, "range\r"); break; case 6: strcpy (buffer + 3, "callsign\r"); break; case 7: strcpy (buffer + 3, "unknown command\r"); break; case 8: strcpy (buffer + 3, "need VIA\r"); break; case 9: strcpy (buffer + 3, "not while connected\r"); break; case 10: strcpy (buffer + 3, "need MYCALL\r"); break; case 11: strcpy (buffer + 3, "need MYSELCAL\r"); break; case 12: strcpy (buffer + 3, "already connected\r"); break; case 13: strcpy (buffer + 3, "not while disconnected\r"); break; case 14: strcpy (buffer + 3, "different connectees\r"); break; case 15: strcpy (buffer + 3, "too many packets outstanding\r"); break; case 16: strcpy (buffer + 3, "clock not set\r"); break; case 17: strcpy (buffer + 3, "need ALL/NONE/YES/NO\r"); break; case 21: strcpy (buffer + 3, "not in this mode\r"); break; default: memcpy (buffer + 3, buf + 3, nbcar - 3); buffer[nbcar] = '\r'; buffer[nbcar + 1] = '\0'; break; } buffer[2] = ':'; commande = 0; valid = 1; *cmd = ECHOCMD; *canal = 0; *len = strlen (buffer); } else { int voie = no_voie (*port, can + 1); buf[nbcar] = '\0'; if ((buf[1] == 'C') && (buf[2] == 'O')) { stat_ch sta; memset (&sta, 0, sizeof (sta)); sta.ack = nback = buf[5] - '0'; sta.ret = buf[6] - '0'; sta.stat = buf[3] - '0'; if (sta.stat == 0) { sta.ack = sta.ret = 0; } memcpy (buffer, &sta, sizeof (sta)); valid = 1; *cmd = STATS; *canal = can + 1; *len = 0; } if ((nback > 14) && (svoie[voie]->ch_mon >= 0)) svoie[voie]->ch_mon = -1; } break; case 0x50: if (can == 0xf) { } else { char stemp[80]; char *ptr = buf + 1; buf[nbcar] = '\0'; /* First channel of TNC must be 1 */ can = can + 1; switch (*ptr) { case 'C': if (ptr[1] == 'O') { valid = 1; sscanf (ptr, "%*s %*s %s", stemp); sprintf (buffer, "(%d) CONNECTED to %s", can, stemp); } break; case 'D': valid = 1; sprintf (buffer, "(%d) DISCONNECTED fm PK", can); break; case 'R': valid = 1; sprintf (buffer, "(%d) LINK FAILURE with PK", can); break; default: valid = 0; break; } *cmd = COMMAND; *canal = can; *len = strlen (buffer); } break; default: break; } pk_check (*port); ff (); return (valid); } static int pk_read (int port, char *buffer) { int c; int nb = 0; if ((!car_tnc (port)) || ((c = rcv_tnc (port)) != 1)) return (0); for (;;) { c = rec_tnc (port); if (c == -1) continue; if (c == '\027') break; if (c == '\020') c = rcv_tnc (port); *buffer++ = c; ++nb; } return (nb); } static int pk_send_ui (int port, char *buffer, int len, Beacon * beacon) { char buf[600]; char s[80]; int i; int via = 1; sprintf (buf, "UN%s-%d", mot (beacon->desti.call), beacon->desti.num); for (i = 0; i < 8; i++) { if (*beacon->digi[i].call) { if (via) { strcat (buf, " VIA "); via = 0; } else { strcat (buf, ","); } sprintf (s, "%s-%d", mot (beacon->digi[i].call), beacon->digi[i].num); strcat (buf, s); } } pk_send (port, 0xf, 1, buf, strlen (buf)); pk_send (port, 0xf, 0, buffer, len); return (1); } static char *ccopy (char *dst, char *src) { int nb = 11; while ((isalnum (*src)) || (*src == '-') || (*src == '*')) { *dst++ = *src++; if (--nb == 0) break; } *dst = '\0'; return (src); } static void pk_get_ui (int port, char *buffer, ui_header * ui) { char *ptr; char *sptr; memset (ui, 0, sizeof (ui_header)); ui->port = port; ui->pid = 0xf0; ui->ui = 1; strcpy (ui->ctl, "??"); ptr = buffer; ptr = ccopy (ui->from, ptr); sptr = strchr (ui->from, '*'); if (sptr) *sptr = '\0'; if (*ptr++ != '>') return; ptr = ccopy (ui->to, ptr); while (*ptr == '>') { ++ptr; strcat (ui->via, ui->to); strcat (ui->via, " "); ptr = ccopy (ui->to, ptr); } if (*ptr == ' ') ++ptr; sptr = ptr; while ((*sptr) && (*sptr != ')') && (*sptr != '>') && (*ptr != ']')) ++sptr; *sptr = '\0'; /* controle */ *ui->ctl = '\0'; ui->pid = 0; if ((*ptr == '(') || (*ptr == '<') || (*ptr == '[')) { int pos = 0; int reponse = 0; ++ptr; sptr = ptr; if (*sptr == 'F') { pos = 4; } else if (*sptr == 'U') { pos = 2; if (sptr[1] == 'A') reponse = 1; else ui->pid = 0xf0; } else if (*sptr == 'C') { strcpy (ptr, "SABM"); pos = 4; } else if (*sptr == 'D') { strcpy (ptr, "DISC"); pos = 4; } else if (*sptr == 'I') { sptr[1] = sptr[2]; sptr[2] = sptr[4]; pos = 3; ui->pid = 0xf0; } else { if (sptr[1] == 'R') { if (sptr[3] == 'P') { sptr[2] = sptr[5]; pos = 3; reponse = 0; } else if (sptr[3] == 'F') { sptr[2] = sptr[5]; pos = 3; reponse = 1; } else { sptr[2] = sptr[3]; pos = 3; } } } if (reponse) sptr[pos] = '-'; else sptr[pos] = '+'; sptr[pos + 1] = '\0'; n_cpy (4, ui->ctl, ptr); } ui->ui = (strncmp (ui->ctl, "UI", 2) == 0); } fbb-7.04j/src/drv_ded.c0100644000175100017510000005004207726646105012762 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include static int ded_end_host (int); static int ded_send_data (int, int, char *, int); static int ded_send_dt (int, int, char *, int); static int ded_send_ui (int, char *, int, Beacon *); static int ded_sndcmd (int, int, char *, int); static int nb_waiting (int); static int recv_ded (int, int, int *, char *); static void ded_get_ui (int, char *, ui_header *); static void ded_sonde (int, int); static void send_ded (int, int, char, char *); /* * Fonctions gnriques du driver */ int rcv_ded (int *port, int *canal, int *cmd, char *buffer, int *len, ui_header * ui) { int lgbuf; int can = p_port[*port].cur_can & 0xff; int code; int valid; int next = 1; /* Header provisoire */ static ui_header loc_ui[NBPORT]; *cmd = INVCMD; /* Test si c'est le port correspondant au MUX ... */ if ((operationnel) && (*port != p_com[(int)p_port[*port].ccom].mult_sel)) return (-1); if (p_port[*port].polling == 0) { ded_sonde (*port, next); return (0); } valid = 0; deb_io (); code = recv_ded (*port, can, &lgbuf, buffer); fin_io (); switch (code) { case 0: *cmd = NOCMD; *len = 0; p_port[*port].polling = 0; if (p_port[*port].last_cmde == 'G') { p_port[*port].wait[can] = 0; } break; case 1: switch (p_port[*port].last_cmde) { case 'L': { /* Retour de statistiques */ stat_ch sta; int nbmes, nbtra, nbatt, nback, nbret, con; valid = 2; *cmd = STATS; *canal = can; *len = 0; sscanf (buffer, "%d%d%d%d%d%d", &nbmes, &nbtra, &nbatt, &nback, &nbret, &con); memset (&sta, 0, sizeof (sta)); sta.stat = con; sta.ret = nbret; p_port[*port].wait[can] = nbmes + nbtra; sta.ack = nbatt + nback + nb_waiting (*port); memcpy (buffer, &sta, sizeof (sta)); if (p_port[*port].wait[can]) next = 0; } break; case 'B': { valid = 2; *cmd = NBBUF; *len = 0; *((int *) buffer) = atoi (buffer); break; } default: valid = 2; *len = lgbuf; *cmd = ECHOCMD; break; } p_port[*port].polling = 0; break; case 2: valid = 2; *len = lgbuf; *cmd = ERRCMD; p_port[*port].polling = 0; if (p_port[*port].wait[can]) --p_port[*port].wait[can]; break; case 3: valid = 2; *cmd = COMMAND; *canal = can; *len = lgbuf; p_port[*port].polling = 0; if (p_port[*port].wait[can]) --p_port[*port].wait[can]; break; case 4: ded_get_ui (*port, buffer, ui); valid = 1; *cmd = UNPROTO; *canal = can; *len = 0; p_port[*port].idem = 1; p_port[*port].polling = 0; if (p_port[*port].wait[can]) --p_port[*port].wait[can]; break; case 5: ded_get_ui (*port, buffer, ui); /* Sauvegarde l'UI */ loc_ui[*port] = *ui; valid = 0; next = 0; p_port[*port].polling = 0; break; case 6: /* Recupere l'UI du coup precedant */ *ui = loc_ui[*port]; sprintf (ui->txt, " (%d)", lgbuf); valid = 1; *cmd = UNPROTO; *canal = can; *len = lgbuf; p_port[*port].idem = 1; p_port[*port].polling = 0; if (p_port[*port].wait[can]) --p_port[*port].wait[can]; break; case 7: valid = 1; *cmd = DATA; *canal = can; *len = lgbuf; p_port[*port].idem = 1; p_port[*port].polling = 0; if (p_port[*port].wait[can]) --p_port[*port].wait[can]; break; } /* Poll du TNC pour la prochaine fois */ if (code != -1) { if (p_port[*port].wait[can]) next = 0; ded_sonde (*port, next); } return (valid); } int opn_ded (int port, int nb) { long bt; int reset = 4; int nb_can; int i; int ok; char s[80]; selcanal (port); while (reset) { ok = 0; sprintf (s, "Init PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); #if defined(__WINDOWS__) || defined(__LINUX__) InitText (s); #else cprintf ("%s\r\n", s); #endif if (p_port[port].moport & 0x80) { sprintf (s, "Init PORT %d COM%d-%d PTCII", port, p_port[port].ccom, p_port[port].ccanal); #if defined(__WINDOWS__) || defined(__LINUX__) InitText (s); #else cprintf ("%s\r\n", s); #endif tncstr (port, "\r", 0); sleep_ (10); tncstr (port, "PTC 31\r", 0); } else { tncstr (port, "\030\033JHOST\r\033MN\r", 0); } bt = btime () + 20; do { if (rec_tnc (port) < 0) { ok = 1; break; } } while (btime () < bt); if (ok == 1) break; #ifdef ENGLISH cprintf ("Reset sent ... Please wait. \r\n"); #else cprintf ("Reset envoy... Patientez S.V.P.\r\n"); #endif sprintf (s, "Resync PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); #if defined(__WINDOWS__) || defined(__LINUX__) InitText (s); #else cprintf ("%s\r\n", s); #endif ded_end_host (port); --reset; } sprintf (s, "Clear PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); #if defined(__WINDOWS__) || defined(__LINUX__) InitText (s); #else cprintf ("%s\r\n", s); #endif tncstr (port, "\033JHOST1\r", 0); sprintf (s, "Prog PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); vide (port, 1); #if defined(__WINDOWS__) || defined(__LINUX__) InitText (s); #else cprintf ("%s\r\n", s); #endif /* Parametres par defaut */ sprintf (s, "I %s-%d", mycall, myssid); ded_sndcmd (port, 0, (char *) s, 1); ded_sndcmd (port, 0, (char *) s, 1); if (DRSI (port)) { nb_can = 0; for (i = 1; i < NBPORT; i++) { if (p_port[i].ccom == p_port[port].ccom) { nb_can += p_port[i].nb_voies; } } } else { nb_can = p_port[port].nb_voies; } sprintf (s, "Y %d", nb_can); ded_sndcmd (port, 0, (char *) s, 1); if (!DRSI (port)) { sprintf (s, "O %d", p_port[port].frame); ded_sndcmd (port, 0, (char *) s, 1); } return (ok); } int cls_ded (int port) { /* Vide la file des commandes en attente */ selcanal (port); while (p_port[port].cmd) { PortData *cmd = p_port[port].cmd; p_port[port].cur_can = cmd->canal; switch (cmd->cmd) { case COMMAND: send_ded (port, (int) cmd->canal, 1, cmd->buf); break; default: break; } p_port[port].cmd = cmd->next; m_libere (cmd, sizeof (PortData)); p_port[port].last_cmde = '\0'; } /* Fin du mode host */ ded_end_host (port); return (1); } int sta_ded (int port, int canal, int cmd, void *ptr) { switch (cmd) { case TOR: return (ded_sndcmd (port, canal, (char *) ptr, 0) != -1); case SNDCMD: return (ded_sndcmd (port, canal, (char *) ptr, 0) != -1); case ECHOCMD: return (ded_sndcmd (port, canal, (char *) ptr, 1) != -1); case PORTCMD: return (ded_sndcmd (port, 0, (char *) ptr, 1) != -1); case PACLEN: *((int *) ptr) = 250; return (1); } return (0); } int snd_ded (int port, int canal, int cmd, char *buffer, int len, Beacon * ptr) { int ret = 0; df ("snd_ded", 8); if (p_port[port].synchro > 256) return (0); switch (cmd) { case COMMAND: break; case DATA: ret = ded_send_dt (port, canal, buffer, len); break; case UNPROTO: ret = ded_send_ui (port, buffer, len, ptr); break; } ff (); return (ret); } /* Fonctions locales */ static int ded_end_host (int port) { static char *mn = "MN"; static char *jhost0 = "JHOST0"; char *ptr; int nb; long bt; int retry = 4; while (retry) { /* Envoie le MN (pas de monitoring) */ send_tnc (port, 0); send_tnc (port, 1); send_tnc (port, strlen (mn) - 1); ptr = mn; while (*ptr) send_tnc (port, *ptr++); bt = btime () + 20; /* Verifie la reception de la reponse */ do { if (rec_tnc (port) >= 0) { /* Envoie le JHOST0 */ send_tnc (port, 0); send_tnc (port, 1); send_tnc (port, strlen (jhost0) - 1); ptr = jhost0; while (*ptr) send_tnc (port, *ptr++); return (1); } } while (btime () < bt); /* Rien recu, on passe en resynchro */ for (nb = 0; nb < 256; nb++) { send_tnc (port, 1); bt = btime () + 5; #if defined(__WINDOWS__) || defined(__LINUX__) DisplayResync (port, nb + 1); #endif while (btime () < bt); if (rec_tnc (port) >= 0) { #if defined(__WINDOWS__) || defined(__LINUX__) DisplayResync (port, 0); #else ++com_error; aff_date (); #endif break; } } /* La resynchro n'a rien donne ... On jette l'eponge ! */ if (nb == 256) return (0); vide (port, 0); --retry; } return (0); } static void warning (unsigned numero, char *texte) { } static void ded_sonde (int pp, int next) { static int cptr[NBPORT]; static int first = 1; if ((pp < 0) || (pp >= NBPORT)) return; if (first) { /* Initializes static variables */ int i; for (i = 0; i < NBPORT; i++) { cptr[i] = 0; } first = 0; } if (p_port[pp].cur_can == 0xff) p_port[pp].cur_can = 0; if (p_port[pp].polling) { return; } if (next == 0) { send_ded (pp, p_port[pp].cur_can, 1, "G"); p_port[pp].last_cmde = 'G'; } else if (p_port[pp].cmd) { PortData *cmd = p_port[pp].cmd; p_port[pp].cur_can = cmd->canal; switch (cmd->cmd) { case COMMAND: send_ded (pp, (int) cmd->canal, 1, cmd->buf); break; case DATA: case UNPROTO: ded_send_data (pp, cmd->canal, cmd->buf, cmd->len); cptr[pp] = 0; break; default: break; } p_port[pp].cmd = cmd->next; m_libere (cmd, sizeof (PortData)); p_port[pp].last_cmde = '\0'; } else if (operationnel == 1) { if (cptr[pp] == 0) { send_ded (pp, p_port[pp].cur_can, 1, "@B"); p_port[pp].last_cmde = 'B'; cptr[pp] = 50; } else { /* Passe au canal suivant */ if (p_port[pp].idem == 0) { ++(p_port[pp].cur_can); if (p_port[pp].cur_can > p_port[pp].tt_can) { int mux_ch; int i; int com; int first_mux; int last_mux; /* Passe eventuellement au PORT/MUX suivant */ mux_ch = p_port[pp].ccanal; com = p_port[pp].ccom; first_mux = (DRSI (pp)) ? 0 : 1; last_mux = (DRSI (pp)) ? 7 : 4; for (i = first_mux; i < last_mux; i++) { ++mux_ch; if (mux_ch > last_mux) mux_ch = first_mux; if (p_com[com].multi[mux_ch]) { pp = p_com[com].multi[mux_ch]; p_com[com].mult_sel = pp; break; } } p_port[pp].cur_can = 0; if (DRSI (pp)) { /* Fait la somme des canaux deja balayes (1 seul TNC !!) */ for (i = 1; i < pp; i++) { if (DRSI (i)) p_port[pp].cur_can += p_port[i].nb_voies; } } selcanal (pp); } } else p_port[pp].idem = 0; send_ded (pp, p_port[pp].cur_can, 1, "L"); p_port[pp].last_cmde = 'L'; if (cptr[pp]) --cptr[pp]; } } p_port[pp].polling = 1; p_com[(int)p_port[pp].ccom].delai = 0; } /* int rcv_ded(int *port, int *canal, int *cmd, char *buffer, int *len, ui_header *ptr) { int val; df("snd_ded", 12); val = ded_inbuf(port, canal, cmd, buffer, len, ptr); ff(); return(val); } */ /* * Fonctions locales */ static int ded_sndcmd (int port, int canal, char *buffer, int retour) { PortData *cmd = p_port[port].cmd; if (cmd) { /* Rajoute la commande en fin de queue */ while (cmd->next) cmd = cmd->next; cmd->next = (PortData *) m_alloue (sizeof (PortData)); cmd = cmd->next; } else cmd = p_port[port].cmd = (PortData *) m_alloue (sizeof (PortData)); cmd->next = NULL; cmd->canal = canal; cmd->cmd = COMMAND; strcpy (cmd->buf, buffer); return (1); } static int ded_send_dt (int port, int canal, char *buffer, int len) { PortData *cmd = p_port[port].cmd; if (len <= 0) return (0); if (cmd) { /* Rajoute la commande en fin de queue */ while (cmd->next) cmd = cmd->next; cmd->next = (PortData *) m_alloue (sizeof (PortData)); cmd = cmd->next; } else cmd = p_port[port].cmd = (PortData *) m_alloue (sizeof (PortData)); cmd->next = NULL; cmd->canal = canal; cmd->cmd = DATA; cmd->len = len > 256 ? 256 : len; memcpy (cmd->buf, buffer, cmd->len); return (1); } static int ded_send_ui (int port, char *buffer, int len, Beacon * beacon) { char commande[300]; char s[80]; int i; int via = 1; PortData *cmd = p_port[port].cmd; if (DRSI (port)) { sprintf (commande, "C %d:%s-%d", p_port[port].ccanal, beacon->desti.call, beacon->desti.num); } else { sprintf (commande, "C %s-%d", beacon->desti.call, beacon->desti.num); } for (i = 0; i < 8; i++) { if (*beacon->digi[i].call) { if (via) { strcat (commande, " VIA "); via = 0; } else { strcat (commande, ","); } sprintf (s, "%s-%d", beacon->digi[i].call, beacon->digi[i].num); strcat (commande, s); } } if (cmd) { /* Rajoute la commande en fin de queue */ while (cmd->next) cmd = cmd->next; cmd->next = (PortData *) m_alloue (sizeof (PortData)); cmd = cmd->next; } else cmd = p_port[port].cmd = (PortData *) m_alloue (sizeof (PortData)); cmd->canal = 0; cmd->cmd = COMMAND; cmd->len = 0; strcpy (cmd->buf, commande); cmd->next = (PortData *) m_alloue (sizeof (PortData)); cmd = cmd->next; cmd->next = NULL; cmd->canal = 0; cmd->cmd = UNPROTO; cmd->len = len > 256 ? 256 : len; memcpy (cmd->buf, buffer, cmd->len); return (1); } static int ded_send_data (int port, int canal, char *buffer, int len) { int i; if (p_port[port].synchro > 256) return (1); selcanal (port); send_tnc (port, canal); send_tnc (port, 0); send_tnc (port, len - 1); for (i = 0; i < len; i++) send_tnc (port, *buffer++); return (1); } static void send_ded (int port, int canal, char type, char *chaine) { if (p_port[port].synchro > 256) return; if (strcmp (chaine, "%O") == 0) sleep_ (1); /* type = 0 : texte. type = 1 : commande */ selcanal (port); send_tnc (port, canal); send_tnc (port, type); send_tnc (port, strlen (chaine) - 1); while (*chaine) send_tnc (port, *chaine++); ff (); } static void resync_port (int port) { long nt = btime (); static int first = 1; static long delai[NBPORT]; if ((port < 0) || (port >= NBPORT)) return; if (first) { /* Initializes static variables */ int i; for (i = 0; i < NBPORT; i++) { delai[i] = 0L; } first = 0; } if ((p_port[port].synchro < 256) && (delai[port] < nt)) { ++p_port[port].synchro; p_port[port].cur_can = 1; send_tnc (port, '\001'); delai[port] = nt + 4L; #if defined(__WINDOWS__) || defined(__LINUX__) DisplayResync (port, p_port[port].synchro); #else { char s[40]; sprintf (s, "Port %d Resync %-4d", port, p_port[port].synchro); aff_chaine (W_DEFL, 1, 1, s); } #endif } if (p_port[port].synchro == 256) { char txt[80]; sprintf (txt, "Port %d was not resynchronized. Stopped. Error =", port); warning (4, txt); ++p_port[port].synchro; } } static int recv_ded (int port, int canal, int *lgbuf, char *buffer) { int r_canal, code = 0, nb, lg; int c; /* Implementation polling */ int valid = 0; char *ptr = p_port[port].portbuf; int index = p_port[port].portind; while ((c = rec_tnc (port)) >= 0) { if (index == 300) { /* Erreur : Vider le buffer et resynchroniser ? */ vide (port, 0); index = 0; break; } /* Ajoute les caracteres dans le buffer */ ptr[index++] = c; } p_port[port].portind = index; /* Tester si la trame est complete */ if (index >= 2) { /* La trame doit faire au moins 2 octets : canal et code */ /* On tente le decodage ... */ r_canal = *ptr++; code = *ptr++; index -= 2; *lgbuf = 0; if (canal == 0xff) canal = r_canal; if ((r_canal != canal) && (p_port[port].synchro == 0)) { if ((!svoie[CONSOLE]->sta.connect) && (p_port[port].synchro == 0)) { char txt[80]; #ifdef ENGLISH sprintf (txt, "Receive : Error channel number: sent %d - received %d - Error =", canal, r_canal); #else sprintf (txt, "Recoit : Erreur Numero de canal: envoye %d - recu %d - Erreur =", canal, r_canal); #endif warning (1, txt); } if (nb_error++ == 10) fbb_error (ERR_TNC, "DED RCV DATA", port); vide (port, 0); return (-1); } lg = 0; switch (code) { case 0: *buffer = '\0'; valid = 1; break; case 1: case 2: case 3: case 4: case 5: while (index) { *buffer = *ptr++; ++lg; --index; /* Le caractere doit etre un NULL pour finir le paquet */ if ((index == 0) && (*buffer == '\0')) { valid = 1; *buffer = '\n'; *++buffer = '\0'; } ++buffer; } break; case 6: case 7: nb = lg = 1 + (0xff & *ptr++); --index; if (nb == index) { /* Tous les caracteres sont recus */ while (nb--) { *buffer++ = *ptr++; } valid = 1; } break; default: if ((!svoie[CONSOLE]->sta.connect) && (p_port[port].synchro == 0)) { char txt[80]; sprintf (txt, "Erreur code trame = %d. Erreur =", code); warning (2, txt); } if (p_port[port].synchro == 0) { vide (port, 0); p_port[port].portind = 0; } else if ((r_canal == '^') && (code == 'A')) { /* TNC reinitialise en mode normal ??? */ valid = 1; #ifdef __WINDOWS__ if (operationnel) { fbb_quit (0); *lgbuf = 0; return (-1); } #endif } break; } *lgbuf = lg; } if (valid) { /* Une trame complete a ete recue */ if (p_port[port].synchro) { #if defined(__WINDOWS__) || defined(__LINUX__) char txt[80]; sprintf (txt, "Ending resynchronization on port %d - Error =", port); warning (5, txt); DisplayResync (port, 0); #else ++com_error; aff_date (); #endif } p_port[port].portind = 0; p_port[port].synchro = 0; p_com[(int)p_port[port].ccom].delai = 0; } else code = -1; if (!valid) { /* Rien n'a ete recu... Tester le temps (15 secondes d'attente) */ if (p_com[(int)p_port[port].ccom].delai > 15) { /* Lancer la procedure de resynchronisation */ if (p_port[port].synchro == 0) { char txt[80]; sprintf (txt, "Starting resynchronization on port %d - Error =", port); warning (3, txt); vide (port, 0); } resync_port (port); } } return (code); } static void ded_get_ui (int port, char *buffer, ui_header * ui) { char *ptr; char *scan; memset (ui, 0, sizeof (ui_header)); ui->port = port; scan = buffer; if ((isdigit (scan[0])) && (scan[1] == ':')) { /* port DRSI */ ui->port = drsi_port (port, scan[0] - '0'); scan += 2; if (*scan == ' ') { /* bug TFPCX ... */ ++scan; } } ptr = strtok (scan, " "); /* fm */ if (ptr == NULL) return; ptr = strtok (NULL, " "); /* exped */ if (ptr == NULL) return; n_cpy (11, ui->from, ptr); ptr = strtok (NULL, " "); /* to */ if (ptr == NULL) return; ptr = strtok (NULL, " "); /* desti */ if (ptr == NULL) return; n_cpy (11, ui->to, ptr); ptr = strtok (NULL, " "); /* via ou ctl */ if (ptr == NULL) return; if (strcmp (ptr, "via") == 0) { for (;;) { if (*ui->via) strcat (ui->via, " "); ptr = strtok (NULL, " "); /* digis */ if (ptr == NULL) return; if (strcmp (ptr, "ctl") == 0) break; strncat (ui->via, ptr, 12); } } ptr = strtok (NULL, " "); /* controle */ if (ptr == NULL) return; strn_cpy (11, ui->ctl, ptr); ui->ui = (strncmp (ptr, "UI", 2) == 0); ptr = strtok (NULL, " "); /* pid */ if (ptr == NULL) return; ptr = strtok (NULL, " "); /* pid */ if (ptr == NULL) return; sscanf (ptr, "%x", &ui->pid); } static int nb_waiting (int port) { /* Donne le nombre de trames DATA en attente d'envoi vers le TNC */ int nb = 0; PortData *cmd = p_port[port].cmd; while (cmd) { if (cmd->cmd == DATA) ++nb; cmd = cmd->next; } return (nb); } fbb-7.04j/src/drv_hst.c0100644000175100017510000010573607726646105013037 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * PTC-II HostMode interface * * It has two ports + 1 pactor channel * * Pactor channel is renumbered to 31, other ports are limited to 30 channels */ #include #include /* Caractere de header */ #define HST_CHAR 170 #define PACTOR_ST 254 /* #define DEBUG_HST */ #define STATUS(p) (p_com[(int)p_port[p].ccom].pactor_st) static char pactor[5]; static int hst_end_host (int); static int hst_send_data (int); static int hst_send_dt (int, int, char *, int); static int hst_send_ui (int, char *, int, Beacon *); static int hst_sndcmd (int, int, char *, int); static int nb_waiting (int); static int recv_hst (int, int, int *, char *); static int hst_busy (int port, int *canal, int force); static void hst_get_ui (int, char *, ui_header *); static void hst_sonde (int, int); static int hst_compteur (int); static unsigned short *crctab; #define updcrc(cp, crc) (((crc >> 8) & 0xff) ^ crctab[((crc ^ (cp & 0xff)) & 0xff)]) static int DebugCh = 0; static void DebugCmd (int port) { int type = (p_port[port].last->cmd == COMMAND) ? 1 : 0; if (DebugCh) { type |= p_port[port].last->compteur; } } #ifdef DEBUG_HST static void dump_data (FILE * fptr, char *ptr, int nb) { int i; int j; for (i = 0; i < nb; i += 16) { fprintf (fptr, "%03d ", i); for (j = 0; j < 16; j++) { if ((i + j) < nb) fprintf (fptr, "%02x ", ptr[i + j] & 0xff); else fprintf (fptr, " "); } for (j = 0; j < 16; j++) { char c = ptr[i + j] & 0xff; if ((i + j) < nb) putc (isprint (c) ? c : '.', fptr); else putc (' ', fptr); } putc ('\n', fptr); } } static void bin_recv (char *ptr, int nb) { FILE *fptr = fopen ("/tmp/debug.hst", "a+b"); long temps = time (NULL); if (fptr == NULL) return; fprintf (fptr, "\nRX=%-3d %s", nb, asctime (localtime (&temps))); dump_data (fptr, ptr, nb); fclose (fptr); } static void bin_send (char *ptr, int nb) { FILE *fptr = fopen ("/tmp/debug.hst", "a+b"); long temps = time (NULL); if (fptr == NULL) return; fprintf (fptr, "\nTX=%-3d %s", nb, asctime (localtime (&temps))); dump_data (fptr, ptr, nb); fclose (fptr); } #endif static void initcrc (void) { unsigned int i, j; unsigned short accu, data; crctab = malloc (256 * sizeof (unsigned short)); for (i = 0; i < 256; i++) { accu = 0; data = i; for (j = 0; j < 8; j++) { if ((data ^ accu) & 1) accu = (accu >> 1) ^ 0x8408; else accu = accu >> 1; data >>= 1; } crctab[i] = accu; } } int hst_vide (int port, int echo) { int c, nb = 0; df ("vide", 2); if ((DEBUG) || (!p_port[port].pvalid)) { deb_io (); cprintf ("Erreur port %d!\n", port); fin_io (); ff (); return (0); } p_port[port].portind = 0; tempo = 20; deb_io (); while (tempo) { if ((c = rec_tnc (port)) >= 0) { if (echo) { #ifdef __FBBDOS__ putch (c); if (c == '\r') putch ('\n'); #endif } tempo = 20; ++nb; } #ifdef __WINDOWS__ else { BWinSleep (100); if (tempo > 0) --tempo; } #endif #ifdef __LINUX__ else { usleep (100000); if (tempo > 0) --tempo; } #endif } fin_io (); ff (); return (nb); } /* * Fonctions gnriques du driver */ int opn_hst (int port, int nb) { static int init = 0; long bt; int reset = 4; int nb_can; int i; int ok; char s[80]; /* Only one INIT on this tnc */ p_port[port].last = NULL; while (reset) { ok = 0; sprintf (s, "Init PORT %d COM%d-%d PTCII", port, p_port[port].ccom, p_port[port].ccanal); #if defined(__WINDOWS__) || defined(__LINUX__) InitText (s); #else cprintf ("%s\r\n", s); #endif if (init) { sleep_ (1); return (1); } init = 1; initcrc (); sprintf (s, "Init PORT %d COM%d-%d PTCII", port, p_port[port].ccom, p_port[port].ccanal); #if defined(__WINDOWS__) || defined(__LINUX__) InitText (s); #else cprintf ("%s\r\n", s); #endif /* sleep_(1); */ tncstr (port, "\r\033\rRESTART\r", 0); bt = btime () + 100; do { if (rec_tnc (port) < 0) { ok = 1; break; } } while (btime () < bt); hst_vide (port, 1); sprintf (s, "\r\033\rPTC %d\r", PACTOR_CH); tncstr (port, s, 0); sprintf (pactor, "(%d)", PACTOR_CH); bt = btime () + 20; do { if (rec_tnc (port) < 0) { ok = 1; break; } } while (btime () < bt); if (ok == 1) break; --reset; } sprintf (s, "Clear PORT %d COM%d-%d PTCII", port, p_port[port].ccom, p_port[port].ccanal); #if defined(__WINDOWS__) || defined(__LINUX__) InitText (s); #else cprintf ("%s\r\n", s); #endif tncstr (port, "\033JHOST4\r", 0); sprintf (s, "Prog PORT %d COM%d-%d PTCII", port, p_port[port].ccom, p_port[port].ccanal); hst_vide (port, 1); #if defined(__WINDOWS__) || defined(__LINUX__) InitText (s); #else cprintf ("%s\r\n", s); #endif /* Parametres par defaut */ /* sprintf (s, "#PTC %d\r", PACTOR_CH); hst_sndcmd (port, 0, (char *) s, 1); hst_sndcmd (port, 0, (char *) s, 1); */ /* All channels callsign */ sprintf (s, "I %s-%d", mycall, myssid); hst_sndcmd (port, 0, (char *) s, 1); hst_sndcmd (port, 0, (char *) s, 1); /* Port pactor */ sprintf (s, "I %s", mycall); hst_sndcmd (port, PACTOR_CH, (char *) s, 1); if (DRSI (port)) { nb_can = 0; for (i = 1; i < NBPORT; i++) { if (p_port[i].ccom == p_port[port].ccom) { nb_can += p_port[i].nb_voies; } } } else { nb_can = p_port[port].nb_voies; } sprintf (s, "Y %d", nb_can); hst_sndcmd (port, 0, (char *) s, 1); sprintf (s, "O %d", p_port[port].frame); hst_sndcmd (port, 0, (char *) s, 1); sprintf (s, "%%L 0"); hst_sndcmd (port, 0, (char *) s, 1); sprintf (s, "#PD 0"); hst_sndcmd (port, PACTOR_CH, (char *) s, 1); sprintf (s, "#UML 0"); hst_sndcmd (port, PACTOR_CH, (char *) s, 1); sprintf (s, "#BOX 0"); hst_sndcmd (port, PACTOR_CH, (char *) s, 1); sprintf (s, "#REM 0"); hst_sndcmd (port, PACTOR_CH, (char *) s, 1); sprintf (s, "#MA 0"); hst_sndcmd (port, PACTOR_CH, (char *) s, 1); sprintf (s, "#CMSG 0"); hst_sndcmd (port, PACTOR_CH, (char *) s, 1); return (ok); } void debug_state (int port) { } static void FAR hst_iss (int port, void *userdata) { /* Automatic break_in */ hst_sndcmd (port, PACTOR_CH, "%I", 2); p_port[port].t_iss = NULL; } static int is_data (int port) { PortData *cmd = p_port[port].cmd; while (cmd) { if (cmd->cmd == DATA) { return (1); } cmd = cmd->next; } return (0); } static void test_timings (int port) { if (!ONLINE (port) || (p_port[port].ccanal != 0)) return; if (!ISS (port) && (is_data (port))) { if (!p_port[port].t_iss) { p_port[port].t_iss = add_timer (10, port, (void FAR *) hst_iss, NULL); } } else { del_timer (p_port[port].t_iss); p_port[port].t_iss = NULL; } } int rcv_hst (int *port, int *canal, int *cmd, char *buffer, int *len, ui_header * ui) { int lgbuf; int can = p_port[*port].cur_can & 0xff; int code; int valid; int next = 1; char *ptr; /* Header provisoire */ static ui_header loc_ui[NBPORT]; *cmd = INVCMD; if ((BUSY (*port)) && (hst_busy (*port, canal, FALSE))) { *cmd = COMMAND; sprintf (buffer, "(%d) FREQ-BUSY fm PACTOR", *canal); *len = strlen (buffer); return (1); } /* Test si c'est le port correspondant au MUX ... */ if ((operationnel) && (*port != p_com[(int)p_port[*port].ccom].mult_sel)) return (-1); if ((p_port[*port].polling == 0) && (p_port[*port].last == NULL)) { hst_sonde (*port, next); return (0); } valid = 0; deb_io (); code = recv_hst (*port, can, &lgbuf, buffer); fin_io (); switch (code) { case 0: *cmd = NOCMD; *len = 0; p_port[*port].polling = 0; if (p_port[*port].last_cmde == 'G') { p_port[*port].wait[can] = 0; } break; case 1: switch (p_port[*port].last_cmde) { case 'L': { /* Retour de statistiques */ stat_ch sta; int nbmes, nbtra, nbatt, nback, nbret, con; valid = 2; *cmd = STATS; *canal = can; *len = 0; sscanf (buffer, "%d%d%d%d%d%d", &nbmes, &nbtra, &nbatt, &nback, &nbret, &con); memset (&sta, 0, sizeof (sta)); sta.stat = con; sta.ret = nbret; p_port[*port].wait[can] = nbmes + nbtra; sta.ack = nbatt + nback + nb_waiting (*port); memcpy (buffer, &sta, sizeof (sta)); if (p_port[*port].wait[can]) next = 0; } break; case 'B': { valid = 2; *cmd = NBBUF; *len = 0; *((int *) buffer) = atoi (buffer); break; } case 'T': { valid = 2; *cmd = NBCHR; *len = 0; *canal = PACTOR_CH; *((long *) buffer) = atol (buffer); break; } default: valid = 2; *len = lgbuf; *cmd = ECHOCMD; break; } p_port[*port].polling = 0; break; case 2: valid = 2; *len = lgbuf; *cmd = ERRCMD; p_port[*port].polling = 0; if (p_port[*port].wait[can]) --p_port[*port].wait[can]; break; case 3: valid = 2; *cmd = COMMAND; *canal = can; *len = lgbuf; p_port[*port].polling = 0; if (strncmp (buffer, pactor, strlen (pactor)) == 0) { char *scan; scan = strchr (buffer, ':'); if (scan && (scan != buffer)) { --scan; *scan = '0'; } } ptr = strstr (buffer, " CONNECTED"); if (ptr && (p_port[*port].ccanal == 0)) { /* Connexion sur le pactor. Forcer le statut ! */ int com = p_port[*port].ccom; p_com[com].pactor_st = 0xa2; debug_state (*port); } if ((ptr) && (hst_busy (*port, canal, TRUE))) { memcpy (ptr, " RECONNECT", 10); } if (p_port[*port].wait[can]) --p_port[*port].wait[can]; break; case 4: hst_get_ui (*port, buffer, ui); valid = 1; *cmd = UNPROTO; *canal = can; *len = 0; p_port[*port].idem = 1; p_port[*port].polling = 0; if (p_port[*port].wait[can]) --p_port[*port].wait[can]; break; case 5: hst_get_ui (*port, buffer, ui); /* Sauvegarde l'UI */ loc_ui[*port] = *ui; valid = 0; next = 0; p_port[*port].polling = 0; break; case 6: /* Recupere l'UI du coup precedant */ *ui = loc_ui[*port]; sprintf (ui->txt, " (%d)", lgbuf); valid = 1; *cmd = UNPROTO; *canal = can; *len = lgbuf; p_port[*port].idem = 1; p_port[*port].polling = 0; if (p_port[*port].wait[can]) --p_port[*port].wait[can]; break; case 7: if (can == PACTOR_ST) { int com = p_port[*port].ccom; p_com[com].pactor_st = *buffer; debug_state (*port); test_timings (*port); p_port[*port].polling = 0; hst_sonde (*port, next); return (0); } valid = 1; *cmd = DATA; { int res = ONLINE (*port); if ((can != PACTOR_CH) || (res)) { *cmd = DATA; } else { *cmd = UNPROTO; memset (ui, 0, sizeof (ui_header)); ui->port = *port; strn_cpy (11, ui->from, "PACTOR"); ui->ui = 1; } } *canal = can; *len = lgbuf; p_port[*port].idem = 1; p_port[*port].polling = 0; if (p_port[*port].wait[can]) --p_port[*port].wait[can]; break; } /* Poll du TNC pour la prochaine fois */ if (code != -1) { if (p_port[*port].wait[can]) next = 0; hst_sonde (*port, next); } return (valid); } int cls_hst (int port) { int i; /* Vide la file des commandes en attente pour tous les ports du TNC */ for (i = 1; i < NBPORT; i++) { if ((HST (i)) && (p_port[port].ccom == p_port[i].ccom)) { while (p_port[i].cmd) { PortData *cmd = p_port[i].cmd; p_port[i].cur_can = cmd->canal; switch (cmd->cmd) { case COMMAND: p_port[i].last = cmd; p_port[i].last->compteur = 0xc0; hst_send_data (i); /* Attend la reponse 1 seconde */ sleep_ (1); /* Vide le buffer */ while (rec_tnc (port) != -1); /* La reponse a ete lue et ignoree ... */ break; default: break; } p_port[i].cmd = cmd->next; m_libere (cmd, sizeof (PortData)); p_port[i].last_cmde = '\0'; } } } /* Fin du mode host */ hst_end_host (port); return (1); } int sta_hst (int port, int canal, int cmd, void *ptr) { int val; /* Pactor port */ if (p_port[port].moport & 0x80) canal = PACTOR_CH; switch (cmd) { /* case TNCSTAT : return(lit_stat_hst(port, canal, (stat_ch *)ptr)); */ case TOR: canal = PACTOR_CH; val = (hst_sndcmd (port, canal, (char *) ptr, 0) != -1); return (val); case SNDCMD: return (hst_sndcmd (port, canal, (char *) ptr, 0) != -1); case ECHOCMD: return (hst_sndcmd (port, canal, (char *) ptr, 1) != -1); case PORTCMD: return (hst_sndcmd (port, 0, (char *) ptr, 1) != -1); case PACLEN: *((int *) ptr) = 250; return (1); } return (0); } int snd_hst (int port, int canal, int cmd, char *buffer, int len, Beacon * ptr) { int ret = 0; df ("snd_hst", 8); if (p_port[port].synchro > 256) return (0); /* Pactor port */ if (p_port[port].moport & 0x80) canal = PACTOR_CH; switch (cmd) { case COMMAND: break; case DATA: ret = hst_send_dt (port, canal, buffer, len); break; case UNPROTO: ret = hst_send_ui (port, buffer, len, ptr); break; } ff (); return (ret); } /* Fonctions locales */ static int hst_end_host (int port) { PortData *cmd; static int done = 0; if (done) return (1); done = 1; cmd = (PortData *) m_alloue (sizeof (PortData)); cmd->canal = 0; cmd->cmd = COMMAND; cmd->len = 2; strcpy (cmd->buf, "MN"); p_port[port].last = cmd; p_port[port].last->compteur = hst_compteur (port); hst_send_data (port); m_libere (p_port[port].last, sizeof (PortData)); cmd = (PortData *) m_alloue (sizeof (PortData)); cmd->canal = 0; cmd->cmd = COMMAND; cmd->len = 6; strcpy (cmd->buf, "JHOST0"); p_port[port].last = cmd; p_port[port].last->compteur = hst_compteur (port); hst_send_data (port); m_libere (p_port[port].last, sizeof (PortData)); p_port[port].last = NULL; return (1); } /* * Fonctions locales */ static int hst_compteur (int port) { static int val = 2; int com = p_port[port].ccom; if (val == 2) { p_com[com].compteur = 0xc0; } else { p_com[com].compteur = (val) ? 0x80 : 0; } val = !val; return p_com[com].compteur; } static void warning (unsigned numero, char *texte) { } /* Retourne le port logique correspondant au lport physique d'un TNC static int global_port(int com, int lport) { int p; for (p = 1 ; p < NBPORT ; p++) { if ((p_port[p].ccom == com) && (p_port[p].ccanal == lport)) { return (p); } } return(1); } */ static int iss (int port) { return (ISS (port)); } static int online (int port) { return (ONLINE (port)); } static PortData *get_cmd (int port) { PortData *prc = NULL; PortData *cmd = p_port[port].cmd; /* On envoie les data ou le CHO uniquement si le PACTOR est en ISS */ if (p_port[port].ccanal == 0) { /* Canal PACTOR */ while (cmd) { if ((!online (port)) || (iss (port)) || ((cmd->cmd == COMMAND) && (strcmp (cmd->buf, "%O") != 0))) { if (prc) prc->next = cmd->next; else p_port[port].cmd = cmd->next; return (cmd); } prc = cmd; cmd = cmd->next; } return (NULL); } else if (cmd) { p_port[port].cmd = cmd->next; } return (cmd); } static void hst_sonde (int pp, int next) { static int cptr[NBPORT]; static int first = 1; static int debug_cmd = 50; PortData *cmd = NULL; if ((pp < 0) || (pp >= NBPORT)) return; if (first) { /* Initializes static variables */ int i; for (i = 0; i < NBPORT; i++) { cptr[i] = 0; } first = 0; } /* if (p_port[pp].cur_can == 0xff) p_port[pp].cur_can = 0xfe; */ if (p_port[pp].last) { return; } if (next == 0) { cmd = (PortData *) m_alloue (sizeof (PortData)); cmd->canal = p_port[pp].cur_can; cmd->cmd = COMMAND; cmd->len = 1; strcpy (cmd->buf, "G"); p_port[pp].last = cmd; p_port[pp].last_cmde = 'G'; } else if ((cmd = get_cmd (pp)) != NULL) { /* Il y a une commande a envoyer */ if (cmd->cmd != COMMAND) cptr[pp] = 0; p_port[pp].last = cmd; if (strcmp (cmd->buf, "%T") == 0) p_port[pp].last_cmde = 'T'; else p_port[pp].last_cmde = '\0'; } else if (operationnel == 1) { if ((cptr[pp] == 0) && (p_port[pp].cur_can != PACTOR_ST)) { cmd = (PortData *) m_alloue (sizeof (PortData)); cmd->canal = p_port[pp].cur_can; cmd->cmd = COMMAND; cmd->len = 2; strcpy (cmd->buf, "@B"); p_port[pp].last = cmd; p_port[pp].last_cmde = 'B'; cptr[pp] = 50; } else if (p_port[pp].cur_can == PACTOR_CH) { /* Status */ cmd = (PortData *) m_alloue (sizeof (PortData)); p_port[pp].cur_can = PACTOR_ST; cmd->canal = p_port[pp].cur_can; cmd->cmd = COMMAND; cmd->len = 1; strcpy (cmd->buf, "G"); p_port[pp].last = cmd; p_port[pp].last_cmde = 'G'; } else { cmd = (PortData *) m_alloue (sizeof (PortData)); /* Passe au canal suivant */ if ((p_port[pp].idem == 0) || (p_port[pp].cur_can == PACTOR_ST)) { int max; if (p_port[pp].moport & 0x80) max = 1; else { max = p_port[pp].tt_can; } ++(p_port[pp].cur_can); if (p_port[pp].cur_can > max) { int mux_ch; int i; int com; int first_mux; int last_mux; /* Passe eventuellement au PORT/MUX suivant */ mux_ch = p_port[pp].ccanal; com = p_port[pp].ccom; /* first_mux = (DRSI (pp)) ? 0 : 1; last_mux = (DRSI (pp)) ? 7 : 4; */ first_mux = 0; last_mux = 2; for (i = first_mux; i < last_mux; i++) { ++mux_ch; if (mux_ch > last_mux) mux_ch = first_mux; if (p_com[com].multi[mux_ch]) { pp = p_com[com].multi[mux_ch]; p_com[com].mult_sel = pp; break; } } p_port[pp].cur_can = 0; /* Fait la somme des canaux deja balayes (1 seul TNC !!) */ if (p_port[pp].ccanal == 0) { /* Inclut le monitoring */ p_port[pp].cur_can = 0; } else { p_port[pp].cur_can = 1; for (i = 1; i < pp; i++) { if ((HST (i)) && (!IS_PACTOR (i)) && (p_port[i].ccom == p_port[pp].ccom)) { p_port[pp].cur_can += p_port[i].nb_voies; } } } } if ((p_port[pp].cur_can == 1) && (p_port[pp].moport & 0x80)) p_port[pp].cur_can = PACTOR_CH; } else p_port[pp].idem = 0; cmd->canal = p_port[pp].cur_can; cmd->cmd = COMMAND; cmd->len = 1; strcpy (cmd->buf, "L"); p_port[pp].last = cmd; p_port[pp].last_cmde = 'L'; if (cptr[pp]) --cptr[pp]; } } DebugCh = 0; if (debug_cmd > 0) { DebugCh = 1; --debug_cmd; } p_port[pp].last->compteur = hst_compteur (pp); hst_send_data (pp); } static int hst_busy (int port, int *canal, int force) { if (p_port[port].ccanal != 0) return (0); *canal = PACTOR_CH; if (p_port[port].t_busy) { m_libere (p_port[port].t_busy->userdata, sizeof (PortData)); del_timer (p_port[port].t_busy); p_port[port].t_busy = NULL; return (1); } else if (force && (p_port[port].t_wait)) { /* Supprimer le timer wait */ m_libere (p_port[port].t_wait->userdata, sizeof (PortData)); del_timer (p_port[port].t_wait); p_port[port].t_wait = NULL; return (1); } return (0); } static void FAR hst_startscan (int port, PortData * command) { PortData *cmd = p_port[port].cmd; if (ISS (port)) { /* Still sending - postpone the command */ add_timer (1, port, (void FAR *) hst_startscan, command); return; } /* Insert the command in top of queue */ command->next = cmd; p_port[port].cmd = command; pactor_scan[port] = 1; } static void FAR hst_connect (int port, PortData * command) { PortData *cmd = p_port[port].cmd; p_port[port].t_busy = NULL; if (cmd) { /* Rajoute la commande en fin de queue */ while (cmd->next) cmd = cmd->next; cmd->next = command; } else /*cmd = */ p_port[port].cmd = command; aff_forward (); } static void FAR hst_wait (int port, PortData * command) { p_port[port].t_wait = NULL; if (p_port[port].t_busy) { m_libere (p_port[port].t_busy->userdata, sizeof (PortData)); del_timer (p_port[port].t_busy); } p_port[port].t_busy = add_timer (10, port, (void FAR *) hst_connect, command); aff_forward (); } static int hst_sndcmd (int port, int canal, char *buffer, int retour) { PortData *cmd = p_port[port].cmd; int nb; char cmde[80]; char scan[80]; char val[80]; char temp[80]; /* if (p_port[port].ccanal == 0) canal = PACTOR_CH; */ if (strlen (buffer) == 0) return (0); /* Demande de connexion du canal pactor : verifier d'abord le status */ if (*buffer == 'C') { if (canal == PACTOR_CH) { /* Armer le timer = 10 secondes */ cmd = (PortData *) m_alloue (sizeof (PortData)); cmd->next = NULL; cmd->canal = canal; cmd->cmd = COMMAND; cmd->len = strlen (buffer); strcpy (cmd->buf, buffer); if (p_port[port].t_wait) { m_libere (p_port[port].t_wait->userdata, sizeof (PortData)); del_timer (p_port[port].t_wait); } p_port[port].t_wait = add_timer (7, port, (void FAR *) hst_wait, cmd); return (1); } else if (strchr (buffer, ':') == NULL) { /* Selectionner le bon port */ ++buffer; while (isspace (*buffer)) ++buffer; sprintf (temp, "C %d:%s", p_port[port].ccanal, buffer); buffer = temp; } } *scan = '\0'; *val = '\0'; nb = sscanf (buffer, "%s %s %s", cmde, scan, val); if (cmde[0] == '!') cmde[0] = '#'; if ((nb == 3) && (strcmpi (cmde, "#TRX") == 0) && (strncmpi (scan, "SCAN", strlen (scan)) == 0)) { if (isdigit (*val)) { if (atoi (val) > 0) { cmd = (PortData *) m_alloue (sizeof (PortData)); cmd->next = NULL; cmd->canal = canal; cmd->cmd = COMMAND; cmd->len = strlen (buffer); strcpy (cmd->buf, buffer); hst_startscan (port, cmd); return 1; } pactor_scan[port] = 0; } } if (strcmp (cmde, "%O") == 0) { /* Un seul change-over en queue ! Enleve le precedent ... */ PortData *pr = NULL; cmd = p_port[port].cmd; while (cmd) { if (strcmp (cmd->buf, "%O") == 0) { if (pr) { pr->next = cmd->next; } else { p_port[port].cmd = cmd->next; } /* Libere la structure */ m_libere (cmd, sizeof (PortData)); break; } pr = cmd; cmd = cmd->next; } } cmd = p_port[port].cmd; if (cmd) { /* Rajoute la commande en fin de queue */ while (cmd->next) cmd = cmd->next; cmd->next = (PortData *) m_alloue (sizeof (PortData)); cmd = cmd->next; } else { p_port[port].cmd = (PortData *) m_alloue (sizeof (PortData)); cmd = p_port[port].cmd; } strcpy (cmd->buf, buffer); if (cmd->buf[0] == '!') cmd->buf[0] = '#'; if ((nb == 2) && (strncmpi (cmde, "#MYPAC", 6) == 0)) { sprintf(cmd->buf, "I%s", scan); canal = PACTOR_CH; } cmd->next = NULL; cmd->canal = canal; cmd->cmd = COMMAND; cmd->len = strlen (cmd->buf); return 1; } static int hst_send_dt (int port, int canal, char *buffer, int len) { PortData *cmd = p_port[port].cmd; if (len <= 0) return (0); if (cmd) { /* Rajoute la commande en fin de queue */ while (cmd->next) cmd = cmd->next; cmd->next = (PortData *) m_alloue (sizeof (PortData)); cmd = cmd->next; } else cmd = p_port[port].cmd = (PortData *) m_alloue (sizeof (PortData)); cmd->next = NULL; cmd->canal = canal; cmd->cmd = DATA; cmd->len = len > 256 ? 256 : len; memcpy (cmd->buf, buffer, cmd->len); return (1); } static int hst_send_ui (int port, char *buffer, int len, Beacon * beacon) { char commande[300]; char s[80]; int i; int ptport; int canal; PortData *cmd; if (len <= 0) return (0); if (p_port[port].ccanal == 0) { /* No beacon on pactor port ! */ return (1); } else { ptport = p_port[port].ccanal; canal = 0; } /* Selection du port */ sprintf (commande, "%%P%d", ptport); cmd = p_port[port].cmd; if (cmd) { /* Rajoute la commande en fin de queue */ while (cmd->next) cmd = cmd->next; cmd->next = (PortData *) m_alloue (sizeof (PortData)); cmd = cmd->next; } else cmd = p_port[port].cmd = (PortData *) m_alloue (sizeof (PortData)); cmd->canal = canal; cmd->cmd = COMMAND; cmd->next = NULL; cmd->len = strlen (commande); strcpy (cmd->buf, commande); sprintf (commande, "C %d:%s-%d", ptport, beacon->desti.call, beacon->desti.num); for (i = 0; i < 8; i++) { if (*beacon->digi[i].call) { if (i == 0) { strcat (commande, " VIA"); } sprintf (s, " %s-%d", beacon->digi[i].call, beacon->digi[i].num); strcat (commande, s); } } cmd->next = (PortData *) m_alloue (sizeof (PortData)); cmd = cmd->next; cmd->next = NULL; cmd->canal = canal; cmd->cmd = COMMAND; cmd->len = strlen (commande); strcpy (cmd->buf, commande); cmd->next = (PortData *) m_alloue (sizeof (PortData)); cmd = cmd->next; cmd->next = NULL; cmd->canal = canal; cmd->cmd = UNPROTO; cmd->len = len > 256 ? 256 : len; memcpy (cmd->buf, buffer, cmd->len); return (1); } /* static int hst_send_data (int port, int canal, int type, char *buffer, int len) */ static int hst_send_data (int port) { int i; int c; int canal, type, len; char *buffer; char debug_buf[300]; char *pdb = debug_buf; int dlen = 0; unsigned short crc = 0xffff; if (p_port[port].last == NULL) return (0); DebugCmd (port); canal = p_port[port].last->canal; type = (p_port[port].last->cmd == COMMAND) ? 1 : 0; type |= p_port[port].last->compteur; len = p_port[port].last->len; buffer = p_port[port].last->buf; send_tnc (port, HST_CHAR); *pdb++ = HST_CHAR; ++dlen; send_tnc (port, HST_CHAR); *pdb++ = HST_CHAR; ++dlen; crc = updcrc (canal, crc); send_tnc (port, canal); *pdb++ = canal; ++dlen; crc = updcrc (type, crc); send_tnc (port, type); *pdb++ = type; ++dlen; c = len - 1; crc = updcrc (c, crc); send_tnc (port, c); *pdb++ = c; ++dlen; if (c == HST_CHAR) { send_tnc (port, 0); *pdb++ = 0; ++dlen; } for (i = 0; i < len; i++) { c = *buffer++; crc = updcrc (c, crc); send_tnc (port, c); *pdb++ = c; ++dlen; if (c == HST_CHAR) { send_tnc (port, 0); *pdb++ = 0; ++dlen; } } crc = ~crc; /* Send crc */ c = crc & 0xff; send_tnc (port, c); *pdb++ = c; ++dlen; if (c == HST_CHAR) { send_tnc (port, 0); *pdb++ = 0; ++dlen; } c = crc >> 8; send_tnc (port, c); *pdb++ = c; ++dlen; if (c == HST_CHAR) { send_tnc (port, 0); *pdb++ = 0; ++dlen; } #ifdef DEBUG_HST /* if (p_port[port].last->cmd == COMMAND) */ bin_send (debug_buf, dlen); #endif p_port[port].polling = 1; p_com[(int)p_port[port].ccom].delai = 0; return (1); } static void resync_port (int port) { long nt = btime (); static int first = 1; static long delai[NBPORT]; if ((port < 0) || (port >= NBPORT)) return; if (first) { /* Initializes static variables */ int i; for (i = 0; i < NBPORT; i++) { delai[i] = 0L; } first = 0; } if ((p_port[port].synchro < 256) && (delai[port] < nt)) { ++p_port[port].synchro; /* Retry du dernier paquet */ hst_send_data (port); delai[port] = nt + 20L; #if defined(__WINDOWS__) || defined(__LINUX__) DisplayResync (port, p_port[port].synchro); #else { char s[40]; sprintf (s, "Port %d Resync %-4d", port, p_port[port].synchro); aff_chaine (W_DEFL, 1, 1, s); } #endif } if (p_port[port].synchro == 256) { char txt[80]; sprintf (txt, "Port %d was not resynchronized. Stopped. Error =", port); warning (4, txt); ++p_port[port].synchro; } } static int crc_check (char *ptr, int len) { int i; unsigned short crc = 0xffff; for (i = 0; i < len; i++) { crc = updcrc (*ptr, crc); ++ptr; } return (crc == 0xf0b8); } static int recv_hst (int port, int canal, int *lgbuf, char *buffer) { int crc_ok; int r_canal, code = 0, nb, lg; int i, pos, c, hst; int last = -1; char buf[300]; char *debbuf = buffer; /* Implementation polling */ int valid = 0; char *ptr = p_port[port].portbuf; int index = p_port[port].portind; while ((c = rec_tnc (port)) >= 0) { if (index == 300) { /* Erreur : Vider le buffer et resynchroniser ? */ vide (port, 0); index = 0; break; } /* Ajoute les caracteres dans le buffer */ ptr[index++] = c; } p_port[port].portind = index; /* Tester si la trame est complete */ if (index >= 6) { /* La trame doit faire au moins 6 octets : header + canal et code + crc16 */ /* Verifier que les deux premiers octets sont HST_CHAR */ if ((ptr[0] != HST_CHAR) || (ptr[1] != HST_CHAR)) { /* Le paquet n'est pas bon. Jeter le 1er octet */ for (i = 1; i < index; i++) { ptr[i - 1] = ptr[i]; } --p_port[port].portind; return (-1); /* Modifie de 0 a -1 le 05/04/98 */ } /* Sauter le header - supprimer les 0x00 apres les HST_CHAR et recopie dans buf */ for (i = 2, pos = 0, hst = 0; i < index; i++) { if (hst) { if (ptr[i] == 0) hst = 0; else { p_port[port].portind = 0; /* Demande la repetition du paquet */ hst_send_data (port); return (-1); } } else buf[pos++] = ptr[i]; if (ptr[i] == HST_CHAR) { hst = 1; } } /* Verifie que les caracteres HST_CHAR sont bien suivis de leur 0 */ pos -= hst; /* Nouvelle longueur du paquet */ ptr = buf; index = pos; crc_ok = crc_check (ptr, index); /* On tente le decodage ... */ index -= 2; /* enlever le crc */ r_canal = *ptr++; code = *ptr++; index -= 2; *lgbuf = 0; if (canal == 0xff) canal = r_canal; lg = 0; switch (code) { case 0: if (pos >= 4) { if (!crc_ok) { /* La trame est erronnee */ /* Jette la trame recue */ p_port[port].portind = 0; /* Demande la repetition du paquet */ hst_send_data (port); return (-1); } #ifdef DEBUG_HST if (r_canal != PACTOR_ST) { char buf_debug[300]; buf_debug[0] = 0xaa; buf_debug[1] = 0xaa; memcpy (buf_debug + 2, buf, pos); bin_recv (buf_debug, pos + 2); } #endif *buffer = '\0'; valid = 1; } break; case 1: case 2: case 3: case 4: case 5: while (index) { last = *ptr++; *buffer++ = last; ++lg; --index; } /* Le caractere doit etre un NULL pour finir le paquet */ if (last == '\0') { if (!crc_ok) { /* La trame est erronnee */ /* Jette la trame recue */ p_port[port].portind = 0; /* Demande la repetition du paquet */ hst_send_data (port); return (-1); } #ifdef DEBUG_HST if (r_canal != PACTOR_ST) { char buf_debug[300]; buf_debug[0] = 0xaa; buf_debug[1] = 0xaa; memcpy (buf_debug + 2, buf, pos); bin_recv (buf_debug, pos + 2); } #endif valid = 1; *buffer = '\n'; *++buffer = '\0'; } break; case 6: case 7: nb = lg = 1 + (0xff & *ptr++); --index; if (nb == index) { if (!crc_ok) { /* La trame est erronnee */ /* Jette la trame recue */ p_port[port].portind = 0; /* Demande la repetition du paquet */ hst_send_data (port); return (-1); } /* Tous les caracteres sont recus */ #ifdef DEBUG_HST if (r_canal != PACTOR_ST) { char buf_debug[300]; buf_debug[0] = 0xaa; buf_debug[1] = 0xaa; memcpy (buf_debug + 2, buf, pos); bin_recv (buf_debug, pos + 2); } #endif while (nb--) { *buffer++ = *ptr++; } valid = 1; } break; default: if ((!svoie[CONSOLE]->sta.connect) && (p_port[port].synchro == 0)) { char txt[80]; if (!crc_ok) { /* La trame est erronnee */ /* Jette la trame recue */ p_port[port].portind = 0; /* Demande la repetition du paquet */ hst_send_data (port); return (-1); } sprintf (txt, "Erreur code trame = %d. Erreur =", code); warning (2, txt); } if (p_port[port].synchro == 0) { vide (port, 0); p_port[port].portind = 0; } else if ((r_canal == '^') && (code == 'A')) { /* TNC reinitialise en mode normal ??? */ valid = 1; #ifdef __WINDOWS__ if (operationnel) { fbb_quit (0); *lgbuf = 0; return (-1); } #endif } break; } *lgbuf = lg; } if (valid) { /* La trame a ete acceptee... On libere la donnee */ m_libere (p_port[port].last, sizeof (PortData)); p_port[port].last = NULL; if ((DebugCh) || (code == 2)) { int len = *lgbuf; char buf[300]; strcpy (buf, debbuf); len = *lgbuf; if (code == 1) { --len; buf[len] = '\0'; } } /* Une trame complete a ete recue */ if (p_port[port].synchro) { #if defined(__WINDOWS__) || defined(__LINUX__) char txt[80]; sprintf (txt, "Ending resynchronization on port %d - Error =", port); warning (5, txt); DisplayResync (port, 0); #else ++com_error; aff_date (); #endif } p_port[port].portind = 0; p_port[port].synchro = 0; p_com[(int)p_port[port].ccom].delai = 0; } else { code = -1; /* Rien n'a ete recu... Tester le temps (2 secondes d'attente) */ if (p_com[(int)p_port[port].ccom].delai > 10) { /* Lancer la procedure de resynchronisation */ if (p_port[port].synchro == 0) { char txt[80]; sprintf (txt, "Starting resynchronization on port %d - Error =", port); warning (3, txt); /* vide (port, 0); */ } p_port[port].portind = 0; resync_port (port); } } return (code); } static void hst_get_ui (int port, char *buffer, ui_header * ui) { char *ptr; char *scan; memset (ui, 0, sizeof (ui_header)); ui->port = port; scan = buffer; if ((isdigit (scan[0])) && (scan[1] == ':')) { /* port HST */ ui->port = hst_port (port, scan[0] - '0'); scan += 2; if (*scan == ' ') { /* bug TFPCX ... */ ++scan; } } ptr = strtok (scan, " "); /* fm */ if (ptr == NULL) return; ptr = strtok (NULL, " "); /* exped */ if (ptr == NULL) return; n_cpy (11, ui->from, ptr); ptr = strtok (NULL, " "); /* to */ if (ptr == NULL) return; ptr = strtok (NULL, " "); /* desti */ if (ptr == NULL) return; n_cpy (11, ui->to, ptr); ptr = strtok (NULL, " "); /* via ou ctl */ if (ptr == NULL) return; if (strcmp (ptr, "via") == 0) { for (;;) { if (*ui->via) strcat (ui->via, " "); ptr = strtok (NULL, " "); /* digis */ if (ptr == NULL) return; if (strcmp (ptr, "ctl") == 0) break; strncat (ui->via, ptr, 12); } } ptr = strtok (NULL, " "); /* controle */ if (ptr == NULL) return; strn_cpy (11, ui->ctl, ptr); ui->ui = (strncmp (ptr, "UI", 2) == 0); ptr = strtok (NULL, " "); /* pid */ if (ptr == NULL) return; ptr = strtok (NULL, " "); /* pid */ if (ptr == NULL) return; sscanf (ptr, "%x", &ui->pid); } static int nb_waiting (int port) { /* Donne le nombre de trames DATA en attente d'envoi vers le TNC */ int nb = 0; PortData *cmd = p_port[port].cmd; while (cmd) { if (cmd->cmd == DATA) ++nb; cmd = cmd->next; } return (nb); } fbb-7.04j/src/drv_kam.c0100644000175100017510000003637207726646105013010 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include typedef struct { char port; char stream; } KamTries; typedef struct { char canal; char *cmd; } KamCmd; KamTries kam_try[NBPORT]; KamCmd kam_cmd[NBPORT]; static int lit_stat_kam (int port, int canal, stat_ch * ptr); static int kam_send (int port, int canal, int type, char *chaine, int len); static int kam_tor (int port, char *chaine, int len); static int kam_send_dt (int port, int canal, char *buffer, int len); static int kam_send_ui (int port, char *buffer, int len, Beacon * beacon); static int kam_inbuf (int *port, int *canal, int *cmd, char *buffer, int *len, ui_header * ui); /* * Fonctions gnriques du driver */ int sta_kam (int port, int canal, int cmd, void *ptr) { char command[256]; char *cptr = (char *) ptr; if ((kam_cmd[port].cmd) && (p_port[port].stop == 0)) { int len = strlen (kam_cmd[port].cmd); kam_send (port, kam_cmd[port].canal, 1, kam_cmd[port].cmd, len); m_libere (kam_cmd[port].cmd, len + 1); kam_cmd[port].cmd = NULL; } switch (cmd) { case TNCSTAT: return (lit_stat_kam (port, canal, (stat_ch *) ptr)); case SNDCMD: /* Teste la commande de connexion delayee */ if ((*cptr == 'C') && (*(cptr + 1) == ' ') && (p_port[port].stop)) { kam_cmd[port].cmd = m_alloue (strlen (cptr) + 1); strcpy (kam_cmd[port].cmd, cptr); kam_cmd[port].canal = canal; return (1); } return (kam_send (port, canal, 1, cptr, strlen (ptr))); case ECHOCMD: return (1); case PORTCMD: strcpy (command, (char *) ptr); return (kam_send (port, 0, 1, command, strlen (command))); } return (0); } int snd_kam (int port, int canal, int cmd, char *buffer, int len, Beacon * ptr) { int ret = 0; switch (cmd) { case COMMAND: ret = kam_send (port, 0, 1, buffer, len); break; case TOR: ret = kam_tor (port, buffer, len); break; case DATA: ret = kam_send_dt (port, canal, buffer, len); break; case UNPROTO: ret = kam_send_ui (port, buffer, len, ptr); break; } return (ret); } int rcv_kam (int *port, int *canal, int *cmd, char *buffer, int *len, ui_header * ptr) { int val; val = kam_inbuf (port, canal, cmd, buffer, len, ptr); return (val); } /*************** Driver KAM ************/ static int kam_tor (int port, char *chaine, int len) { int c; df ("kam_tor", 6); while (car_tx (port)) ; /* attend que le buffer d'emission soit vide */ send_tnc (port, 0xc0); while (len--) { c = *chaine++; if (c == 0xc0) { send_tnc (port, 0xdb); c = 0xdc; } else if (c == 0xdb) { send_tnc (port, 0xdb); c = 0xdd; } send_tnc (port, c); } send_tnc (port, 0xc0); ff (); return (1); } static int kam_read (int port, char *buffer) { int c, nb; char *ptr = buffer; df ("kam_read", 3); nb = 0; if (!car_tnc (port)) { ff (); return (0); } if (rec_tnc (port) != 0xc0) { ++com_error; ff (); return (0); } for (;;) { c = rec_tnc (port); if (c == -1) { continue; } if (c == 0xdb) { while ((c = rec_tnc (port)) == -1); switch (c) { case 0xdc: *ptr++ = 0xc0; break; case 0xdd: *ptr++ = 0xdb; break; } ++nb; } else if (c == 0xc0) { if (nb) break; else nb = -1; } else if (nb < 300) { *ptr++ = c; ++nb; } } ff (); return (nb); } static int kam_send (int port, int canal, int type, char *chaine, int len) { int c; int c_port = 0; int c_voie = 0; int c_mode = 0; int tor = 0; df ("kam_send", 4); while (car_tx (port)) ; /* attend que le buffer d'emission soit vide */ /* Envoi dans stream 0 en TOR */ if ((tor) && (type == 2)) type = 0; switch (type) { case 0: /* Unproto */ c_mode = 'D'; c_port = p_port[port].ccanal + '0'; c_voie = '0'; break; case 1: /* Commande */ c_mode = 'C'; c_port = p_port[port].ccanal + '0'; if (canal == 0) c_voie = '0'; else c_voie = 'A' + canal - 1; break; case 2: /* Data */ c_mode = 'D'; c_port = p_port[port].ccanal + '0'; c_voie = 'A' + canal - 1; break; } send_tnc (port, 0xc0); send_tnc (port, c_mode); send_tnc (port, c_port); send_tnc (port, c_voie); while (len--) { c = *chaine++; if (c == 0xc0) { send_tnc (port, 0xdb); c = 0xdc; } else if (c == 0xdb) { send_tnc (port, 0xdb); c = 0xdd; } send_tnc (port, c); } send_tnc (port, 0xc0); ff (); return (1); } static int kam_send_dt (int port, int canal, char *buffer, int len) { int retour = 1; if (len <= 0) return (0); df ("kam_send_dt", 5); retour = kam_send (port, canal, 2, buffer, len); ff (); return (retour); } static int kam_send_ui (int port, char *buffer, int len, Beacon * beacon) { char commande[300]; char s[80]; int i; int via = 1; df ("kam_send_ui", 5); sprintf (commande, "U %s-%d", mot (beacon->desti.call), beacon->desti.num); for (i = 0; i < 8; i++) { if (*beacon->digi[i].call) { if (via) { strcat (commande, " VIA "); via = 0; } else { strcat (commande, ","); } sprintf (s, "%s-%d", mot (beacon->digi[i].call), beacon->digi[i].num); strcat (commande, s); } } kam_send (port, 0, 1, commande, strlen (commande)); kam_send (port, 0, 0, buffer, len); ff (); return (1); } static void lit_kam_tries (int port, int canal, char *ptr, stat_ch * sta) { int ret; df ("lit_kam_tries", 2); sscanf (ptr, "%*s %d", &ret); sta->ret = ret; sta->stat = -1; sta->connect = -1; sta->ack = -1; sta->mem = -1; ff (); return; } static void lit_kam_status (int port, char *ptr, stat_ch * sta) { #define NB_KAM_STAT 13 static struct { int lg; char *txt; } kam_stat[NB_KAM_STAT] = { { 9, "DISCONNEC" } , { 9, "CONNECT i" } , { 9, "FRMR in p" } , { 9, "DISC in p" } , { 9, "CONNECTED" } , { 1, "x" } , { 9, "Waiting a" } , { 9, "Device bu" } , { 9, "Remote de" } , { 9, "Both devi" } , { 17, "Waiting ACK and d" } , { 17, "Waiting ACK and r" } , { 17, "Waiting ACK and b" } , }; int i; int mod; int voie; int stat = 0; int ack = 0; int kam_port = 0; int stream = 0; int st_kam[MAXVOIES]; char *scan; df ("lit_kam_status", 3); sta->ret = -1; sta->stat = -1; sta->connect = -1; sta->ack = -1; sta->mem = -1; for (i = 0; i < MAXVOIES; i++) { if ((i < NBVOIES) && (svoie[i]->affport.port == port)) st_kam[i] = 0; else st_kam[i] = -1; } scan = strtok (ptr, "\r"); if (scan == NULL) { ff (); return; } sscanf (scan, "%*s %*s %d", &p_port[port].mem); while ((scan = strtok (NULL, "\r")) != NULL) { if (scan[1] != '/') continue; stream = scan[0] - '@'; kam_port = (scan[2] == 'V') ? 1 : 2; if (kam_port == 0) continue; mod = 0; if (p_port[port].ccanal != kam_port) { /* Recherche l'autre port du TNC */ for (i = 1; i < NBPORT; i++) { if (i == port) continue; if (p_port[i].ccom == p_port[port].ccom) { port = i; break; } } } voie = no_voie (port, stream); if (voie == -1) continue; scan += 4; if (*scan == '#') { while ((*scan) && (*scan != '(')) ++scan; ++scan; ack = 0; while (isdigit (*scan)) { ack *= 10; ack += (*scan - '0'); ++scan; } scan += 2; } else { ack = 0; } stat = 20; for (i = 0; i < NB_KAM_STAT; i++) { if (strncmp (kam_stat[i].txt, scan, kam_stat[i].lg) == 0) { stat = i; st_kam[voie] = i; } } if ((P_TOR (voie)) && (p_port[no_port (voie)].transmit)) stat = 18; if (stat == 0) { ack = 0; sta->ret = 0; } if (sta->ack != ack) { sta->ack = ack; mod = 1; } if (sta->stat != stat) { sta->stat = stat; mod = 1; } if (mod) status (voie); } for (voie = 0; voie < MAXVOIES; voie++) { if (st_kam[voie] == 0) { mod = 0; if (sta->ack != 0) { sta->ack = 0; mod = 1; } if (sta->ret != 0) { sta->ret = 0; mod = 1; } if (sta->stat != 0) { sta->stat = 0; mod = 1; } if (mod) status (voie); } } ff (); return; } static int lit_stat_kam (int port, int canal, stat_ch * ptr) { static long last_call = 0L; long temps; if (ptr) { temps = time (NULL); if (temps == last_call) return (0); last_call = temps; } df ("lit_stat_kam", 1); if (kam_try[(int)p_port[port].ccom].port == 0) { kam_try[(int)p_port[port].ccom].port = (char) port; kam_try[(int)p_port[port].ccom].stream = (char) canal; kam_send (port, 0, 1, "STATUS", 6); kam_send (port, canal, 1, "TRIES", 5); } ff (); return (0); } static void kam_get_ui (int port, char *buffer, ui_header * ui) { char *ptr; char *sptr; memset (ui, 0, sizeof (ui_header)); ui->port = port; ptr = strtok (buffer, ">"); /* exped */ if (ptr == NULL) return; n_cpy (11, ui->from, ptr); ptr = strtok (NULL, ":,"); /* desti */ if (ptr == NULL) return; n_cpy (11, ui->to, ptr); ptr = strtok (NULL, ":,"); /* digis */ if (ptr == NULL) return; if (*ptr != ' ') { for (;;) { strncat (ui->via, ptr, 12); strcat (ui->via, " "); ptr = strtok (NULL, ":,"); /* digis */ if (ptr == NULL) return; if ((*ptr == '\0') || (*ptr == ' ')) break; } } ++ptr; sptr = ptr; while ((*sptr) && (*sptr != '>')) ++sptr; *sptr = '\0'; /* controle */ *ui->ctl = '\0'; if (ptr[0] == '<') { int pos = 0; int version = 1; int reponse = 0; ++ptr; if (ptr[0] == '<') { version = 2; /* AX25 Version 2 */ ++ptr; } sptr = ptr; if (*sptr == 'F') { pos = 4; } else if (*sptr == 'U') { pos = 2; if (sptr[1] == 'A') reponse = 1; } else if (*sptr == 'C') { strcpy (ptr, "SABM"); pos = 4; } else if (*sptr == 'D') { strcpy (ptr, "DISC"); pos = 4; } else if (*sptr == 'I') { pos = 3; } else { if (*sptr == 'r') { strupr (sptr); reponse = 1; } if (sptr[1] == 'R') pos = 3; else pos = 4; } if (version == 1) { if (reponse) sptr[pos] = '\0'; else sptr[pos] = '!'; } else { if (reponse) sptr[pos] = '-'; else sptr[pos] = '+'; } sptr[pos + 1] = '\0'; n_cpy (4, ui->ctl, ptr); } ui->ui = (strncmp (ui->ctl, "UI", 2) == 0); ui->pid = 0xf0; } static int kam_inbuf (int *port, int *canal, int *cmd, char *buffer, int *len, ui_header * ui) { int nbcar, can; int type; int i, lport; int valid = 0; int deja; char stemp[80]; static char buf[600]; char *ptr; df ("lit_txt_kam", 1); if ((nbcar = kam_read (*port, buf)) >= 3) { lport = (int) (*(buf + 1) - '0'); if (p_port[*port].ccanal != lport) { /* Recherche l'autre port du TNC */ for (i = 1; i < NBPORT; i++) { if (i == *port) continue; if (p_port[i].ccom == p_port[*port].ccom) { *port = i; break; } } } type = (int) *buf; can = (int) (*(buf + 2) - 'A') + 1; switch (type) { case 'M': ptr = buf + 3; nbcar -= 3; deja = 0; while ((*ptr) && (nbcar)) { --nbcar; if (*ptr++ == ':') { if (deja) { break; } deja = 1; } } kam_get_ui (*port, buf + 3, ui); if (nbcar > 0) { ++ptr; --nbcar; memcpy (buffer, ptr, nbcar); sprintf (ui->txt, " (%d)", nbcar); } else nbcar = 0; valid = 1; *cmd = UNPROTO; *canal = can; *len = nbcar; break; case 'S': nbcar -= 3; ptr = buf + 3; ptr[nbcar] = '\0'; *buffer = '\0'; *len = 0; /* TOR modes ... */ if (strncmp (ptr, "') stemp[strlen (stemp) - 1] = '\0'; sprintf (buffer, "(%d) CONNECTED to %s", can, stemp); valid = 1; *cmd = COMMAND; *canal = 1; *len = strlen (buffer); break; } else if (strstr (ptr, "STANDBY")) { sprintf (buffer, "(%d) DISCONNECTED fm KAM", can); p_port[*port].transmit = 0; valid = 1; *cmd = COMMAND; *canal = 1; *len = strlen (buffer); if ((p_port[*port].moport & 0x80) == 0) { /* Retour en mode packet */ kam_tor (*port, "X", 1); } break; } else if (*ptr != '*') break; ptr += 4; *buffer = '\0'; switch (*ptr) { case 'C': valid = 1; sscanf (ptr, "%*s %*s %s", stemp); sprintf (buffer, "(%d) CONNECTED to %s", can, stemp); /* Connection */ break; case 'D': valid = 1; sprintf (buffer, "(%d) DISCONNECTED fm KAM", can); /* Deconnection */ break; case 'r': valid = 1; sprintf (buffer, "(%d) LINK FAILURE with KAM", can); break; default: valid = 0; break; } *cmd = COMMAND; *canal = can; *len = strlen (buffer); break; case 'D': nbcar -= 3; memcpy (buffer, buf + 3, nbcar); valid = 1; *cmd = DATA; if (can < 0) can = 1; *canal = can; *len = nbcar; break; case 'C': nbcar -= 3; memcpy (buffer, buf + 3, nbcar); *len = 0; *cmd = NOCMD; if (nbcar > 0) { if (strncmp (buf + 3, "FREE", 4) == 0) { stat_ch sta; int tnc = p_port[*port].ccom; memset (&sta, 0, sizeof (sta)); *port = kam_try[tnc].port; can = kam_try[tnc].stream; lit_kam_status (*port, buf + 3, &sta); memcpy (buffer, &sta, sizeof (sta)); valid = 1; *cmd = STATS; *canal = can; *len = 0; } else if (strncmp (buf + 3, "TRIES", 5) == 0) { stat_ch sta; int tnc = p_port[*port].ccom; memset (&sta, 0, sizeof (sta)); *port = kam_try[tnc].port; can = kam_try[tnc].stream; lit_kam_tries (*port, can, buf + 3, &sta); memcpy (buffer, &sta, sizeof (sta)); valid = 1; *cmd = STATS; *canal = can; *len = 0; kam_try[tnc].port = 0; } else { valid = 1; *cmd = ECHOCMD; *canal = can; *len = nbcar; } } break; case 'R': nbcar -= 3; memcpy (buffer, buf + 3, nbcar); valid = 1; *cmd = UNPROTO; *canal = can; *len = nbcar; break; case 'I': valid = 0; *cmd = TOR; p_port[*port].transmit = (can != '0'); *len = 0; break; default: break; } } ff (); return (valid); } void env_com_kam (int port, int canal, char *buffer) { if (toupper (*buffer) == 'B') { paclen_change (port, canal, buffer); } else { kam_send (port, 0, 1, buffer, strlen (buffer)); *buffer = '\0'; } } fbb-7.04j/src/drv_mod.c0100644000175100017510000006004107726646105013005 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /****************************** * * DRIVERS pour ligne MODEM * ******************************/ #include #ifdef __LINUX__ #include #include #include #include #include #define N_TTY_BUF_SIZE 4096 #endif #include #include #define ANCIEN 1 extern int GetModemDCD (int port); /* #if defined (__WINDOWS__) || defined(__LINUX__) */ #define LOCSIZ 256 static char *locbuf[NBPORT] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; static int locnb[NBPORT] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static int echap[NBPORT] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* #endif */ static int bs[NBPORT] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; int echo[NBPORT] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; /* * Fonctions gnriques du driver */ int sta_mod (int port, int canal, int cmd, void *ptr) { int ret = 0; char command[256]; switch (cmd) { case PORTCMD: strcpy (command, (char *) ptr); strcat (command, "\r"); ret = snd_mod (port, 0, COMMAND, command, strlen (command), NULL); sleep_ (1); break; case BSCMD: bs[port] = *((int *) ptr); return (1); case ECHOCMD: echo[port] = *((int *) ptr); #ifdef __WIN32__ SetModemEcho (port, echo[port]); #endif return (1); case SUSPCMD: return (1); } return (ret); } int snd_mod (int port, int canal, int cmd, char *buffer, int len, Beacon * ptr) { int ctrl = 0; char c; switch (cmd) { case COMMAND: while (len--) { c = *buffer++; switch (c) { case '~': deb_io (); #ifdef __WINDOWS__ WinMSleep (500); #else tempo = 10; while (tempo); #endif break; case '^': ctrl = 1; break; default: if (ctrl) { c -= '@'; ctrl = 0; } #ifdef __LINUX__ if (BIOS (port) == P_LINUX) { defcom *ptrcom = &p_com[(int)p_port[port].ccom]; int nb; if (ptrcom->comfd < 0) return (1); for (;;) { int nbcar; ioctl (ptrcom->comfd, TIOCOUTQ, &nbcar); if ((N_TTY_BUF_SIZE - nbcar) >= 1) break; sleep_ (1); } nb = write (ptrcom->comfd, &c, 1); nb = N_TTY_BUF_SIZE >> 8; p_port[port].frame = (uchar) nb - 2; } #endif #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) { #ifdef __WIN32__ int nb; nb = PutModemBuf (port, &c, 1); #else defcom *ptrcom = &p_com[p_port[port].ccom]; COMSTAT cstat; DWORD dwErrorMask; int nb; if (ptrcom->comfd < 0) return (1); for (;;) { GetCommError (ptrcom->comfd, &cstat); if ((OUTQUE - cstat.cbOutQue) >= 1) break; sleep_ (1); } nb = WriteComm (ptrcom->comfd, &c, 1); while (GetCommError (ptrcom->comfd, &cstat)); #endif nb = OUTQUE >> 8; p_port[port].frame = (uchar) nb - 2; } #endif #ifdef __FBBDOS__ { RSEGS rsegs; BufReel[0] = c; memset (&rsegs, 0, sizeof (RSEGS)); rsegs.CX = 1; rsegs.DX = (int) p_port[port].ccom - 1; rsegs.DI = 0; rsegs.ES = BufSeg; rsegs.DS = BufSeg; while (rsegs.CX) { rsegs.AX = 0x0a00; int14real (&rsegs); } } #endif break; } } break; case DATA: #ifdef __LINUX__ if (BIOS (port) == P_LINUX) { defcom *ptrcom = &p_com[(int)p_port[port].ccom]; int nb; int c; int i; int dbl; /* int binary; */ char buf[600]; if (ptrcom->comfd < 0) return (1); /* binary = svoie[p_port[port].pr_voie]->binary; */ if (bs[port]) { i = 0; for (nb = 0; nb < len; nb++) { buf[i++] = buffer[nb]; if (buffer[nb] == '\r') buf[i++] = '\n'; } } else { i = 0; for (nb = 0; nb < len; nb++) { c = buffer[nb] & 0xff; switch (c) { case 0x01: /* Echappement */ case 0x11: /* XOn */ case 0x13: /* XOff */ case 0x08: /* BS */ case 0x0a: /* LF */ case 0x00: /* Null */ c += 0x40; dbl = 1; break; default: dbl = 0; break; } if (dbl) { /* Caractere d'echappement */ buf[i++] = 0x01; } buf[i++] = c; } } for (;;) { int nbcar; ioctl (ptrcom->comfd, TIOCOUTQ, &nbcar); if ((N_TTY_BUF_SIZE - nbcar) >= i) break; sleep_ (1); } nb = write (ptrcom->comfd, buf, i); nb = N_TTY_BUF_SIZE >> 8; p_port[port].frame = (uchar) nb - 2; } #endif #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) { #ifdef __WIN32__ defcom *ptrcom = &p_com[p_port[port].ccom]; int nb; int c; int i; int dbl; char buf[600]; if (ptrcom->comfd == NULL) return (1); i = 0; if (bs[port]) { for (nb = 0; nb < len; nb++) { c = buffer[nb] & 0xff; buf[i++] = c; /* Envoie le LF si pas d'echo ... */ if (c == '\r') buf[i++] = '\n'; } } else { for (nb = 0; nb < len; nb++) { c = buffer[nb] & 0xff; if (!bs[port]) { switch (c) { case 0x01: /* Echappement */ case 0x11: /* XOn */ case 0x13: /* XOff */ case 0x08: /* BS */ case 0x0a: /* LF */ case 0x00: /* Null */ c += 0x40; dbl = 1; break; default: dbl = 0; break; } if (dbl) { /* Caractere d'echappement */ buf[i++] = 0x01; } } buf[i++] = c; } } nb = PutModemBuf (port, buf, i); nb = OUTQUE >> 8; p_port[port].frame = (uchar) nb - 2; #else defcom *ptrcom = &p_com[p_port[port].ccom]; COMSTAT cstat; int nb; int c; int i; int dbl; /* int binary; */ char buf[600]; if (ptrcom->comfd < 0) return (1); /* binary = svoie[p_port[port].pr_voie]->binary; */ i = 0; if (bs[port]) { for (nb = 0; nb < len; nb++) { c = buffer[nb] & 0xff; buf[i++] = c; /* Envoie le LF si pas d'echo ... */ if (c == '\r') buf[i++] = '\n'; } } else { for (nb = 0; nb < len; nb++) { c = buffer[nb] & 0xff; if (!bs[port]) { switch (c) { case 0x01: /* Echappement */ case 0x11: /* XOn */ case 0x13: /* XOff */ case 0x08: /* BS */ case 0x0a: /* LF */ case 0x00: /* Null */ c += 0x40; dbl = 1; break; default: dbl = 0; break; } if (dbl) { /* Caractere d'echappement */ buf[i++] = 0x01; } } buf[i++] = c; } } for (;;) { GetCommError (ptrcom->comfd, &cstat); if ((OUTQUE - cstat.cbOutQue) >= i) break; sleep_ (1); } nb = WriteComm (ptrcom->comfd, buf, i); while (GetCommError (ptrcom->comfd, &cstat)); nb = OUTQUE >> 8; p_port[port].frame = (uchar) nb - 2; #endif } #endif #ifdef __FBBDOS__ { int nb; int c; int i; int dbl; /* int binary; */ char buf[600]; /* binary = svoie[p_port[port].pr_voie]->binary; */ i = 0; if (bs[port]) { memcpy (buf, buffer, len); } else { for (nb = 0; nb < len; nb++) { c = buffer[nb] & 0xff; switch (c) { case 0x01: /* Echappement */ case 0x11: /* XOn */ case 0x13: /* XOff */ case 0x0a: /* LF */ case 0x08: /* BS */ case 0x00: /* Null */ c += 0x40; dbl = 1; break; default: dbl = 0; break; } if (dbl) { /* Caractere d'echappement */ buf[i++] = 0x01; } buf[i++] = c; /* Envoie le LF si pas d'echo ... if ((!binary) && (p_port[port].echo) && (c == '\r')) */ } len = i; } memcpy (BufReel, buf, len); memset (&rsegs, 0, sizeof (RSEGS)); rsegs.CX = len; rsegs.DX = (int) p_port[port].ccom - 1; rsegs.DI = 0; rsegs.ES = BufSeg; rsegs.DS = BufSeg; while (rsegs.CX) { rsegs.AX = 0xa00; if (rsegs.CX != len) sleep_ (1); int14real (&rsegs); } p_port[port].frame = (uchar) (rsegs.BX >> 9) - 2; } #endif return (1); case UNPROTO: break; } return (1); } void end_modem (void) { #if defined(__WINDOWS__) || defined(__LINUX__) int i; for (i = 0; i < NBPORT; i++) { if (locbuf[i]) { m_libere (locbuf[i], LOCSIZ); locbuf[i] = NULL; } } #endif } int lit_port_modem (int port) { int fin_rxmodem; int fin_txmodem; int abort_xmodem; int zr_pos; int nb, con; int nbtot; int voie; int ch_stat; Forward *pfwd; if (DEBUG) return (0); df ("lit_port_modem", 3); voie = p_port[port].pr_voie; pfwd = svoie[voie]->curfwd; ch_stat = 0; #ifdef __LINUX__ if (BIOS (port) == P_LINUX) /* LINUX driver */ { defcom *ptrcom = &p_com[(int)p_port[port].ccom]; char buffer[300]; if (ptrcom->comfd < 0) return 0; for (;;) { int mcs; int old; if (svoie[voie]->binary == 2) nb = 0; else { old = fcntl (ptrcom->comfd, F_GETFL, 0); (void) fcntl (ptrcom->comfd, F_SETFL, old | O_NDELAY); nb = read (ptrcom->comfd, buffer, 300); (void) fcntl (ptrcom->comfd, F_SETFL, old); } if (nb < 0) { /* perror("com read"); */ nb = 0; } /* Lit l'etat du DCD */ ioctl (ptrcom->comfd, TIOCMGET, &mcs); con = (mcs & TIOCM_CAR) ? 1 : 0; fin_rxmodem = 0; fin_txmodem = 0; abort_xmodem = 0; zr_pos = 0; if ((svoie[voie]->sta.connect > 1) && (svoie[voie]->sta.connect < 17) && (!con)) { md_no_echo (voie); if (svoie[voie]->kiss >= 0) { init_timout (voie); selvoie (svoie[voie]->kiss); /* outln("MODEM DISCONNECTION", 20) ; */ ch_niv3 (2); texte (T_GAT + 1); selvoie (voie); status (voie); svoie[voie]->sta.connect = 17; } else { dec_voie (voie); re_init_modem (voie); echap[port] = 0; ch_stat = 1; } } if (nb) { if (con) { int c; int i; char *lbuf = locbuf[port]; int lnb = locnb[port]; if (lbuf == NULL) { lbuf = locbuf[port] = malloc (LOCSIZ); lnb = locnb[port] = 0; } if (svoie[voie]->binary == 2) { /* Envoie les donnees au process du FORK */ int fd = svoie[voie]->to_rzsz[1]; nb = write (fd, buffer, nb); if (nb < 0) nb = 0; if (nb) { /* int i; dprintf("Envoye %d carac a rszs(fd = %d)\n", nb, fd); for (i = 0 ; i < nb ; i++) dprintf("%02x ", buffer[i] &0xff); dprintf("\n"); */ } } else { for (i = 0; i < nb; i++) { c = buffer[i] & 0xff; if (echap[port]) { c -= 0x40; echap[port] = 0; } else if (c == 0x01) { /* Caractere d'echappement */ echap[port] = c; continue; } else if ((c == 0x08) /* && (bs[port]) */ ) { if (lnb > 0) { selvoie (voie); outs ("\b \b", 3); --lnb; } continue; } else if ((c == 0x0d) || /* CR */ (c == 0x11) || /* XOn */ (c == 0x13) || /* XOff */ (c == 0x00)) /* Null */ { /* A jeter !! */ continue; } else if (c == '\n') { /* transformer les LF en CR */ c = '\r'; } lbuf[lnb++] = c; if ((c == '\r') || (lnb == LOCSIZ) || ((svoie[voie]->binary) && (nb == i + 1))) { if (svoie[voie]->kiss >= 0) { init_timout (voie); selvoie (svoie[voie]->kiss); outs (lbuf, lnb); write_capture (lbuf, lnb); selvoie (voie); } else { md_inbuf (voie, lbuf, lnb); if ((pfwd) && (*pfwd->txt_con)) { md_send (no_port (voie), pfwd->txt_con); *pfwd->txt_con = '\0'; } } lnb = 0; } } locnb[port] = lnb; } } else if (md_busy (buffer, nb)) { /* Arret de la connexion */ md_no_echo (voie); if (svoie[voie]->sta.connect) { dec_voie (voie); deconnect_modem (voie); re_init_modem (voie); echap[port] = 0; ch_stat = 1; } } } else { if (con) { if (svoie[voie]->sta.connect <= 1) { sleep_ (1); connect_modem (voie); nb_trait = 0; status (voie); traite_voie (voie); } else if (svoie[voie]->sta.connect == 17) { sleep_ (1); init_timout (voie); selvoie (svoie[voie]->kiss); ch_niv3 (3); selvoie (voie); status (voie); svoie[voie]->sta.connect = 2; md_defaut (voie); } } break; } } if (ch_stat) { nb_trait = 0; traite_voie (voie); } /* Lire le nb de buffers dispos en emission */ { int nbcar; if (ioctl (ptrcom->comfd, TIOCOUTQ, &nbcar) == -1) perror ("ioctl"); /* printf("buf = %d\n", nbcar); */ nbtot = (nbcar + 127) >> 7; p_port[no_port (voie)].frame = (uchar) (N_TTY_BUF_SIZE >> 8) - 1; svoie[voie]->sta.mem = (N_TTY_BUF_SIZE >> 7); /* nbtot = (cstat.cbOutQue + 127) >> 7; p_port[no_port (voie)].frame = (uchar) (OUTQUE >> 8) - 1; svoie[voie]->sta.mem = (OUTQUE >> 7); */ } if (nbtot != svoie[voie]->sta.ack) { svoie[voie]->sta.ack = nbtot; if ((nbtot > 20) && (svoie[voie]->ch_mon >= 0)) { svoie[voie]->ch_mon = -1; } ch_stat = 1; } if (svoie[voie]->sta.connect) { ack_suiv (voie); } if ((!svoie[voie]->stop) && (svoie[voie]->seq)) { /* Recharge les bufs de sortie */ if (tot_mem > 10000L) traite_voie (voie); ff (); return (0); } if ((v_tell == 0) || (v_tell != voie) || ((v_tell) && (v_tell == voie))) { while ((!svoie[voie]->seq) && (inbuf_ok (voie))) { traite_voie (voie); if (svoie[voie]->seq) break; } } } #endif #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) /* WINDOWS driver */ { int nstat; COMSTAT cstat; defcom *ptrcom = &p_com[p_port[port].ccom]; char buffer[300]; #ifdef __WIN32__ int nbused; if (ptrcom->comfd == NULL) return; #else if (ptrcom->comfd < 0) return; #endif for (;;) { #ifdef __WIN32__ con = GetModemDCD (port); if ((con) && (svoie[voie]->niv1 == N_MOD) && (svoie[voie]->niv2 == 4) && ((svoie[voie]->niv3 == XR_EXTERN) || (svoie[voie]->niv3 == XS_EXTERN))) { if ((GetTransferStat (port)) == 0) { traite_voie (voie); return (0); } nb = 0; } else { nb = GetModemBuf (port, buffer, 300); } #else nb = ReadComm (ptrcom->comfd, buffer, 300); if (nb < 0) nb = -nb; while (GetCommError (ptrcom->comfd, &cstat)); nstat = GetCommStatus (ptrcom->comfd); con = (nstat & 0x80) ? 1 : 0; #endif fin_rxmodem = 0; fin_txmodem = 0; abort_xmodem = 0; zr_pos = 0; if ((svoie[voie]->sta.connect > 1) && (svoie[voie]->sta.connect < 17) && (!con)) { md_no_echo (voie); if (svoie[voie]->kiss >= 0) { init_timout (voie); selvoie (svoie[voie]->kiss); /* outln("MODEM DISCONNECTION", 20) ; */ ch_niv3 (2); texte (T_GAT + 1); selvoie (voie); status (voie); svoie[voie]->sta.connect = 17; } else { dec_voie (voie); re_init_modem (voie); echap[port] = 0; ch_stat = 1; } } if (nb) { if (con) { int c; int i; char *lbuf = locbuf[port]; int lnb = locnb[port]; if (lbuf == NULL) { lbuf = locbuf[port] = malloc (LOCSIZ); lnb = locnb[port] = 0; } for (i = 0; i < nb; i++) { c = buffer[i] & 0xff; if (echap[port]) { c -= 0x40; echap[port] = 0; } else if (c == 0x01) { /* Caractere d'echappement */ echap[port] = c; continue; } else if (c == 0x08) { if ((lnb > 0) && (bs[port])) { #ifndef __WIN32__ selvoie (voie); outs ("\b \b", 3); #endif --lnb; } continue; } else if ((c == 0x0a) || /* LF */ (c == 0x11) || /* XOn */ (c == 0x13) || /* XOff */ (c == 0x00)) /* Null */ { /* A jeter !! */ continue; } lbuf[lnb++] = c; if ((c == '\r') || (lnb == LOCSIZ) || ((svoie[voie]->binary) && (nb == i + 1))) { if (svoie[voie]->kiss >= 0) { init_timout (voie); selvoie (svoie[voie]->kiss); outs (lbuf, lnb); write_capture (lbuf, lnb); selvoie (voie); } else { md_inbuf (voie, lbuf, lnb); if ((pfwd) && (*pfwd->txt_con)) { md_send (no_port (voie), pfwd->txt_con); *pfwd->txt_con = '\0'; } } lnb = 0; } } locnb[port] = lnb; } else if (md_busy (buffer, nb)) { /* Arret de la connexion */ md_no_echo (voie); if (svoie[voie]->sta.connect) { dec_voie (voie); deconnect_modem (voie); #ifndef __WIN32__ re_init_modem (voie); #endif echap[port] = 0; ch_stat = 1; } } } else { if (con) { if (svoie[voie]->sta.connect <= 1) { sleep_ (1); connect_modem (voie); nb_trait = 0; status (voie); traite_voie (voie); } else if (svoie[voie]->sta.connect == 17) { sleep_ (1); init_timout (voie); selvoie (svoie[voie]->kiss); ch_niv3 (3); selvoie (voie); status (voie); svoie[voie]->sta.connect = 2; md_defaut (voie); } } break; } } if (ch_stat) { nb_trait = 0; traite_voie (voie); } #ifdef __WIN32__ GetModemStat (no_port (voie), &nbtot, &nbused); svoie[voie]->sta.mem = nbtot >> 8; nbtot = (nbused + 249) >> 8; #else nbtot = (cstat.cbOutQue + 127) >> 7; p_port[no_port (voie)].frame = (uchar) (OUTQUE >> 8) - 1; svoie[voie]->sta.mem = (OUTQUE >> 7); #endif if (nbtot != svoie[voie]->sta.ack) { svoie[voie]->sta.ack = nbtot; if ((nbtot > 20) && (svoie[voie]->ch_mon >= 0)) { svoie[voie]->ch_mon = -1; } ch_stat = 1; } if (svoie[voie]->sta.connect) { ack_suiv (voie); } if ((!svoie[voie]->stop) && (svoie[voie]->seq)) { /* Recharge les bufs de sortie */ if (tot_mem > 10000L) traite_voie (voie); ff (); return (0); } if ((v_tell == 0) || (v_tell != voie) || ((v_tell) && (v_tell == voie))) { while ((!svoie[voie]->seq) && (inbuf_ok (voie))) { traite_voie (voie); if (svoie[voie]->seq) break; } } } #endif #ifdef __FBBDOS__ { RSEGS rsegs; for (;;) { memset (&rsegs, 0, sizeof (RSEGS)); rsegs.AX = 0xb00; rsegs.CX = 256; rsegs.DX = (int) p_port[port].ccom - 1; rsegs.DI = 0; rsegs.ES = BufSeg; rsegs.DS = BufSeg; int14real (&rsegs); nb = (int) rsegs.CX; con = (rsegs.AX & 0x80) ? 1 : 0; fin_rxmodem = ((nb == 0) && (rsegs.BX & 0x1000)); fin_txmodem = ((rsegs.BX & 0x0080) == 0); abort_xmodem = ((rsegs.BX & 0x4000) != 0); zr_pos = ((rsegs.BX & 0x0040) != 0); if ((svoie[voie]->type_yapp == 3) && ((rsegs.BX & 0x8000) != 0)) { fin_txmodem = 1; } if (zr_pos) get_zrpos (voie); if ((svoie[voie]->time_trans == 0L) && ((rsegs.BX & 0x0100) == 0)) svoie[voie]->time_trans = time (NULL); if ((svoie[voie]->sta.connect > 1) && (svoie[voie]->sta.connect < 17) && (!con)) { md_no_echo (voie); if (svoie[voie]->kiss >= 0) { init_timout (voie); selvoie (svoie[voie]->kiss); /* outln("MODEM DISCONNECTION", 20) ; */ ch_niv3 (2); texte (T_GAT + 1); selvoie (voie); status (voie); svoie[voie]->sta.connect = 17; } else { dec_voie (voie); re_init_modem (voie); echap[port] = 0; ch_stat = 1; } } if (nb) { if (con) { if (svoie[voie]->kiss >= 0) { init_timout (voie); selvoie (svoie[voie]->kiss); outs (BufReel, nb); write_capture (BufReel, nb); selvoie (voie); } else { int i; int c; int lnb = nb; #if 0 lnb = 0; for (i = 0; i < nb; i++) { c = BufReel[i] & 0xff; if (echap[port]) { c -= 0x40; echap[port] = 0; } else if (c == 0x01) { echap[port] = c; continue; } else if (c == 0x08) { continue; } else if ((c == 0x0a) || /* LF */ (c == 0x11) || /* XOn */ (c == 0x13) || /* XOff */ (c == 0x00)) /* Null */ { continue; } BufReel[lnb++] = c; } #endif md_inbuf (voie, BufReel, lnb); if ((pfwd) && (*pfwd->txt_con)) { md_send (no_port (voie), pfwd->txt_con); *pfwd->txt_con = '\0'; } } } else if (md_busy (BufReel, nb)) { /* Arret de la connexion */ md_no_echo (voie); if (svoie[voie]->sta.connect) { dec_voie (voie); deconnect_modem (voie); re_init_modem (voie); echap[port] = 0; ch_stat = 1; } } } else { if (con) { if (svoie[voie]->sta.connect <= 1) { sleep_ (1); connect_modem (voie); nb_trait = 0; status (voie); traite_voie (voie); } else if (svoie[voie]->sta.connect == 17) { sleep_ (1); init_timout (voie); selvoie (svoie[voie]->kiss); ch_niv3 (3); selvoie (voie); status (voie); svoie[voie]->sta.connect = 2; md_defaut (voie); } } break; } } if (ch_stat) { nb_trait = 0; traite_voie (voie); } if ((svoie[voie]->binary) && (abort_xmodem)) { xmodem_fin (voie); svoie[voie]->niv3 = XM_ABORT; traite_voie (voie); } memset (&rsegs, 0, sizeof (RSEGS)); rsegs.AX = 0x0a00; rsegs.CX = 0; rsegs.DX = (int) p_port[port].ccom - 1; rsegs.DI = 0; rsegs.ES = BufSeg; rsegs.DS = BufSeg; int14real (&rsegs); nbtot = (int) ((rsegs.BX >> 8) - (rsegs.BX & 0xff)); p_port[no_port (voie)].frame = (uchar) (rsegs.BX >> 9) - 1; svoie[voie]->sta.mem = (int) (rsegs.BX >> 8) + 4; if (nbtot != svoie[voie]->sta.ack) { svoie[voie]->sta.ack = nbtot; if ((nbtot > 20) && (svoie[voie]->ch_mon >= 0)) { svoie[voie]->ch_mon = -1; } ch_stat = 1; } if (svoie[voie]->sta.connect) { ack_suiv (voie); } if ((svoie[voie]->binary) && (svoie[voie]->outptr == NULL) && (svoie[voie]->niv3 == XS_QUEUE)) { xmodem_fin (voie); svoie[voie]->niv3 = XS_END; } #ifdef ANCIEN if ((svoie[voie]->binary) && (fin_txmodem) && (svoie[voie]->niv3 == XS_END)) { traite_voie (voie); } #else if ((svoie[voie]->binary) && (fin_txmodem)) { traite_voie (voie); } #endif if ((!svoie[voie]->stop) && (svoie[voie]->seq)) { /* Recharge les bufs de sortie */ if (tot_mem > 10000L) traite_voie (voie); ff (); return (0); } if ((v_tell == 0) || (v_tell != voie) || ((v_tell) && (v_tell == voie))) { while ((!svoie[voie]->seq) && (inbuf_ok (voie))) { traite_voie (voie); if (svoie[voie]->seq) break; } } if ((svoie[voie]->binary) && (fin_rxmodem) && (svoie[voie]->niv3 == XR_RECV)) { svoie[voie]->xferok = 1; svoie[voie]->niv3 = XR_END; traite_voie (voie); } } #endif if (ch_stat) status (voie); ff (); return (0); } fbb-7.04j/src/drv_sock.c0100644000175100017510000011011507726646105013163 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /****************************************************** * * * FBB Driver for AF_AX25 domain sockets * * * * F6FBB - 1996 * * * ******************************************************/ #include #include #include #include #include #include #include #include #include #ifdef OLD_AX25 #include #include #include #else #include #include #include #endif union sockaddr_ham { struct full_sockaddr_ax25 axaddr; struct sockaddr_rose rsaddr; }; #define AX25_CALLSID 11 /* Big enough for ROSE addresses */ #define READ_EVENT 1 #define WRITE_EVENT 2 #define EXCEPT_EVENT 4 #define DISCONNECT 0 #define CPROGRESS 1 #define CONNECTED 2 #define NO_EVENT 0 #define DISC_EVENT 1 #define CONN_EVENT 2 #define RETR_EVENT 3 #define BUSY_EVENT 4 #define SOCK_MAXCAN 50 #define CAN_AX25 0 #define CAN_NETROM 1 #define CAN_ROSE 2 #ifndef SOL_AX25 #define SOL_AX25 257 #endif #undef open #undef read #undef write #undef close typedef struct { int ncan; int sock; int port; int state; int paclen; int maxframe; int type; /* CAN_AX25, CAN_NETROM or CAN_ROSE */ int event; int queue; char source[AX25_CALLSID]; } scan_t; scan_t scan[SOCK_MAXCAN]; static int last_can = 1; static int msocket = -1; static int is_rsaddr (char *); static int stop_cnx (int port); static int sock_rcv_ui (int *, char *, int *, ui_header *); static int sock_snd_ui (int, char *, int, Beacon *); static int sock_snd_dt (int, char *, int); static int sock_cmd (int, int, char *); static int sock_connect (char *, int); static int sock_connexion (int, int, union sockaddr_ham *, int *, char *); static int sock_stat (int, stat_ch *); static int sock_paclen (int); static int s_free (scan_t *); static int s_status (scan_t *); static int name_to_port (char *); #ifdef OLD_AX25 static char *ax25_ntoa (char *, const ax25_address *); static char *rose_ntoa (char *, const rose_address *); #else static char *ax25_ntoaddr (char *, const ax25_address *); static char *rose_ntoaddr (char *, const rose_address *); static char *rose_ntodnic (char *, const rose_address *); #endif static void clear_can (int canal); /* * Generic functions of the driver */ /* Check or change status of a port/channel */ int sta_sck (int port, int canal, int cmd, void *ptr) { switch (cmd) { case TNCSTAT: return (sock_stat (canal, (stat_ch *) ptr)); case PACLEN: *((int *) ptr) = sock_paclen (canal); return (1); case SNDCMD: return (sock_cmd (port, canal, (char *) ptr)); case SETBUSY: return stop_cnx (port); } return (0); } /* Sends data */ int snd_sck (int port, int canal, int cmd, char *buffer, int len, Beacon * ptr) { int ret = 0; switch (cmd) { case COMMAND: break; case DATA: ret = sock_snd_dt (canal, buffer, len); break; case UNPROTO: ret = sock_snd_ui (port, buffer, len, ptr); break; } return (ret); } /* receives data */ int rcv_sck (int *port, int *canal, int *cmd, char *buffer, int *len, ui_header * ui) { static int can = 0; int valid; int res; *cmd = INVCMD; valid = 0; /* Test monitoring */ if (sock_rcv_ui (port, buffer, len, ui)) { *canal = 0; *cmd = UNPROTO; return (1); } /* Test connection */ scan[0].sock = p_port[*port].fd; res = s_status (&scan[0]); if (res & READ_EVENT) { int new; int i; int addr_len; union sockaddr_ham addr; addr_len = sizeof (union sockaddr_ham); new = accept (p_port[*port].fd, (struct sockaddr *) &addr, &addr_len); if (new == -1) { perror ("accept"); return (FALSE); } /* Affect the new socket to an empty channel */ for (i = 1; i < last_can; i++) { if (scan[i].state == DISCONNECT) { break; } } if (i == last_can) { /* Impossible to affect the channel -> disconnection */ printf ("no channel available\n"); close (new); } else { int ret; *canal = i; ret = sock_connexion (new, i, &addr, port, buffer); if (ret) { *len = strlen (buffer); *cmd = COMMAND; *canal = i; return (TRUE); } return (FALSE); } } /* Next channel for the polling */ ++can; if (can == last_can) can = 1; if ((scan[can].sock <= 0) && (scan[can].state != DISCONNECT)) { switch (scan[can].type) { case CAN_AX25: sprintf (buffer, "(%d) DISCONNECTED fm AX25", can); break; case CAN_NETROM: sprintf (buffer, "(%d) DISCONNECTED fm NETROM", can); break; case CAN_ROSE: sprintf (buffer, "(%d) DISCONNECTED fm ROSE", can); break; } clear_can (can); /* scan[can].state = DISCONNECT; */ *len = strlen (buffer); *cmd = COMMAND; *canal = can; return (TRUE); } /* Canal de communication */ res = s_status (&scan[can]); if (res & EXCEPT_EVENT) { if (scan[can].event == CONN_EVENT) { /* Appel sortant connecte */ int addr_len; union sockaddr_ham addr; int ret; addr_len = sizeof (union sockaddr_ham); if (getpeername (scan[can].sock, (struct sockaddr *) &addr, &addr_len) == 0) { ret = sock_connexion (scan[can].sock, can, &addr, port, buffer); if (ret) { *len = strlen (buffer); *cmd = COMMAND; *canal = can; return (TRUE); } } else perror ("getpeername"); return (FALSE); } else { switch (scan[can].type) { case CAN_AX25: sprintf (buffer, "(%d) DISCONNECTED fm AX25", can); break; case CAN_NETROM: sprintf (buffer, "(%d) DISCONNECTED fm NETROM", can); break; case CAN_ROSE: sprintf (buffer, "(%d) DISCONNECTED fm ROSE", can); break; } printf ("Event -> deconnection %s\n", buffer); close (scan[can].sock); clear_can (can); *len = strlen (buffer); *cmd = COMMAND; *canal = can; return (TRUE); } } if (res & READ_EVENT) { int nb; if (scan[can].sock <= 0) { printf ("read on invalide socket\n"); return (FALSE); } nb = read (scan[can].sock, buffer, 256); if ((nb == 0) || ((nb == -1) && (errno == ENOTCONN))) { /* Deconnection */ switch (scan[can].type) { case CAN_AX25: sprintf (buffer, "(%d) DISCONNECTED fm AX25", can); break; case CAN_NETROM: sprintf (buffer, "(%d) DISCONNECTED fm NETROM", can); break; case CAN_ROSE: sprintf (buffer, "(%d) DISCONNECTED fm ROSE", can); break; } close (scan[can].sock); clear_can (can); *len = strlen (buffer); *cmd = COMMAND; *canal = can; return (TRUE); } else if (nb == -1) { printf ("errno = %d\n", errno); perror ("read"); } else { *len = nb; *cmd = DATA; *canal = can; return (TRUE); } } if (res & WRITE_EVENT) { /* Can write to the socket... Unused */ } return (FALSE); } /* Open port */ int opn_sck (int port, int nb) { static int nb_init = 0; int old_can; int i; int ioc; int backoff; int ok = TRUE; char s[80]; char *p_name; sprintf (s, "Init PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); InitText (s); old_can = last_can; last_can += nb; if (last_can > SOCK_MAXCAN) last_can = SOCK_MAXCAN; for (i = old_can; i < last_can; i++) { clear_can (i); } if (nb_init == 0) { nb_init = 1; fbb_ax25_config_load_ports (); fbb_nr_config_load_ports (); fbb_rs_config_load_ports (); /* Socket reception monitoring */ if (msocket <= 0) { int proto = (all_packets) ? ETH_P_ALL : ETH_P_AX25; if ((msocket = socket (AF_INET, SOCK_PACKET, htons (proto))) == -1) { perror ("socket_monitoring"); } else { /* Socket non bloquant */ ioc = 1; ioctl (msocket, FIONBIO, &ioc); } } } /* Receive connections socket */ if (p_port[port].fd == 0) { char call[20]; int addrlen = 0; union sockaddr_ham addr; sprintf (s, "Open PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); InitText (s); sleep (1); if (ax25_config_get_addr (p_port[port].name) != NULL) { p_port[port].type = CAN_AX25; } else if (nr_config_get_addr (p_port[port].name) != NULL) { p_port[port].type = CAN_NETROM; } else if (is_rsaddr (p_port[port].name) || (rs_config_get_addr (p_port[port].name) != NULL)) { p_port[port].type = CAN_ROSE; } else { fprintf (stderr, "invalid port name %s\n", p_port[port].name); return (0); } switch (p_port[port].type) { case CAN_AX25: printf ("CAN_AX25\n"); if ((p_port[port].fd = socket (AF_AX25, SOCK_SEQPACKET, 0)) < 0) { perror ("socket_r"); clear_can (port); return (0); } /* Socket non bloquant */ ioc = 1; ioctl (p_port[port].fd, FIONBIO, &ioc); backoff = 0; if (setsockopt (p_port[port].fd, SOL_AX25, AX25_BACKOFF, &backoff, sizeof (backoff)) == -1) { perror ("setsockopt : AX25_BACKOFF"); close (p_port[port].fd); clear_can (port); return (0); } addr.axaddr.fsa_ax25.sax25_family = AF_AX25; addr.axaddr.fsa_ax25.sax25_ndigis = 1; sprintf (call, "%s-%d", mycall, myssid); #ifdef OLD_AX25 convert_call_entry (call, addr.axaddr.fsa_ax25.sax25_call.ax25_call); #else ax25_aton_entry (call, addr.axaddr.fsa_ax25.sax25_call.ax25_call); #endif p_name = ax25_config_get_addr (p_port[port].name); #ifdef OLD_AX25 convert_call_entry (p_name, addr.axaddr.fsa_digipeater[0].ax25_call); #else ax25_aton_entry (p_name, addr.axaddr.fsa_digipeater[0].ax25_call); #endif addrlen = sizeof (struct full_sockaddr_ax25); break; case CAN_NETROM: printf ("CAN_NETROM\n"); if ((p_port[port].fd = socket (AF_NETROM, SOCK_SEQPACKET, 0)) < 0) { perror ("socket_r"); clear_can (port); return (0); } /* Socket non bloquant */ ioc = 1; ioctl (p_port[port].fd, FIONBIO, &ioc); addr.axaddr.fsa_ax25.sax25_family = AF_NETROM; addr.axaddr.fsa_ax25.sax25_ndigis = 0; p_name = nr_config_get_addr (p_port[port].name); #ifdef OLD_AX25 convert_call_entry (p_name, addr.axaddr.fsa_ax25.sax25_call.ax25_call); #else ax25_aton_entry (p_name, addr.axaddr.fsa_ax25.sax25_call.ax25_call); #endif addrlen = sizeof (struct full_sockaddr_ax25); break; case CAN_ROSE: printf ("CAN_ROSE\n"); if ((p_port[port].fd = socket (AF_ROSE, SOCK_SEQPACKET, 0)) < 0) { perror ("socket_r"); clear_can (port); return (0); } /* Socket non bloquant */ ioc = 1; ioctl (p_port[port].fd, FIONBIO, &ioc); addr.rsaddr.srose_family = AF_ROSE; addr.rsaddr.srose_ndigis = 0; sprintf (call, "%s-%d", mycall, myssid); #ifdef OLD_AX25 convert_call_entry (call, addr.rsaddr.srose_call.ax25_call); #else ax25_aton_entry (call, addr.rsaddr.srose_call.ax25_call); #endif if (is_rsaddr (p_port[port].name)) p_name = p_port[port].name; else p_name = rs_config_get_addr (p_port[port].name); #ifdef OLD_AX25 convert_rose_address (p_name, addr.rsaddr.srose_addr.rose_addr); #else rose_aton (p_name, addr.rsaddr.srose_addr.rose_addr); #endif addrlen = sizeof (struct sockaddr_rose); break; } if (bind (p_port[port].fd, (struct sockaddr *) &addr, addrlen) == -1) { perror ("bind"); close (p_port[port].fd); clear_can (port); return (0); } if (listen (p_port[port].fd, SOMAXCONN) == -1) { perror ("listen"); close (p_port[port].fd); clear_can (port); return (0); } memset (&scan[0], 0, sizeof (scan_t)); } sprintf (s, "Prog PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); InitText (s); return (ok); } /* Close port */ int cls_sck (int port) { int i; for (i = 0; i < last_can; i++) { if (scan[i].sock > 0) { printf ("cls_sck : disconnect stream %d\n", i); close (scan[i].sock); } clear_can (i); scan[i].state = DISCONNECT; } if (msocket > 0) close (msocket); msocket = -1; if ((p_port[port].typort == TYP_SCK) && (p_port[port].fd)) { close (p_port[port].fd); clear_can (port); } return (1); } /* * Static functions * */ static int get_call (char *trame, char *buffer) { int c, i, ssid; for (i = 0; i < 6; i++) { c = (*trame++) >> 1; if (isalnum (c)) *buffer++ = c; } ssid = *trame; if ((c = ((ssid >> 1) & 0xf)) != 0) { *buffer++ = '-'; if (c >= 10) { c -= 10; *buffer++ = '1'; } *buffer++ = c + '0'; } *buffer = '\0'; return (ssid); } static int stop_cnx (int port) { close(p_port[port].fd); p_port[port].fd = 0; return 1; } static int sock_rcv_ui (int *port, char *buffer, int *plen, ui_header * phead) { struct sockaddr sa; struct ifreq ifr; int asize; /* struct ifreq ifr; */ char buf[1500]; char temp[11]; char *via; int lg, ssid, ssid_d, v2; char ctrl; char *ptr; char *pctl; int b_port; int family; int prevp; char name[80]; do { b_port = *port; asize = sizeof (sa); lg = recvfrom (msocket, buf, 1500, 0, &sa, &asize); if ((lg <= 0) || ((buf[0] & 0xf) != 0)) { return (0); } strcpy (ifr.ifr_name, sa.sa_data); if (ioctl (msocket, SIOCGIFHWADDR, &ifr) < 0) { perror ("GIFADDR"); return (0); } family = ifr.ifr_hwaddr.sa_family; } while ((family != AF_AX25) && (family != AF_NETROM) && (family != AF_ROSE)); if ((ptr = ax25_config_get_name (sa.sa_data)) != NULL) { strcpy(name, ptr); b_port = name_to_port (ptr); } ptr = buf + 1; --lg; if (lg < 15) return (FALSE); memset (phead, 0, sizeof (ui_header)); via = phead->via; if (lg > 300) lg = 300; ssid_d = get_call (ptr, phead->to); ptr += 7; ssid = get_call (ptr, phead->from); ptr += 7; v2 = ((ssid_d & 0x80) != (ssid & 0x80)); lg -= 14; *via = '\0'; if ((ssid & 1) == 0) { do { lg -= 7; if (lg < 1) { ff (); return (0); } ssid = get_call (ptr, temp); ptr += 7; if (*temp) { strcat (via, temp); if (ssid & 0x80) { if ((ssid & 1) || (((ssid & 1) == 0) && ((ptr[6] & 0x80) == 0))) strcat (via, "*"); } strcat (via, " "); } } while ((ssid & 1) == 0); } ctrl = *ptr++; lg--; pctl = phead->ctl; if ((ctrl & 0x1) == 0) { /* I frame */ *pctl++ = 'I'; *pctl++ = (ctrl >> 5) + '0'; *pctl++ = ((ctrl >> 1) & 0x7) + '0'; } else if ((ctrl & 0x3) == 1) { /* S frame */ switch (ctrl & 0xf) { case 0x1: *pctl++ = 'R'; *pctl++ = 'R'; break; case 0x5: *pctl++ = 'R'; *pctl++ = 'N'; *pctl++ = 'R'; break; case 0x9: *pctl++ = 'R'; *pctl++ = 'E'; *pctl++ = 'J'; break; } *pctl++ = (ctrl >> 5) + '0'; } else { /* U frame */ switch (ctrl & 0xec) { case 0x2c: *pctl++ = 'S'; *pctl++ = 'A'; *pctl++ = 'B'; *pctl++ = 'M'; break; case 0x40: *pctl++ = 'D'; *pctl++ = 'I'; *pctl++ = 'S'; *pctl++ = 'C'; break; case 0x0c: *pctl++ = 'D'; *pctl++ = 'M'; break; case 0x60: *pctl++ = 'U'; *pctl++ = 'A'; break; case 0x84: *pctl++ = 'F'; *pctl++ = 'R'; *pctl++ = 'M'; *pctl++ = 'R'; break; case 0x00: *pctl++ = 'U'; *pctl++ = 'I'; phead->ui = 1; break; } } if (v2) { if (ctrl & 0x10) { if (ssid_d & 0x80) *pctl++ = '+'; else *pctl++ = '-'; } else { if (ssid_d & 0x80) *pctl++ = '^'; else *pctl++ = 'v'; } } else if (ctrl & 0x10) *pctl++ = '!'; *pctl = '\0'; if (((ctrl & 1) == 0) || ((ctrl & 0xef) == 0x3)) { lg--; if (lg < 0) { return (0); } phead->pid = *ptr++ & 0xff; } else phead->pid = 0; prevp = b_port; if (b_port == 0) { int bp; switch (phead->pid) { case 0xcf: /* Look for the port listening to this packet */ for (bp = 1; bp < NBPORT; bp++) { if ((p_port[bp].pvalid) && (p_port[bp].type == CAN_NETROM)) b_port = bp; } break; case 0x01: /* Look for the port listening to this packet */ for (bp = 1; bp < NBPORT; bp++) { if ((p_port[bp].pvalid) && (p_port[bp].type == CAN_ROSE)) b_port = bp; } break; } if (b_port == 0) return (0); } /* Par securite ? */ if (lg < 0) return (0); if (lg > 256) lg = 256; *plen = lg; if (lg) sprintf (phead->txt, " (%d)", lg); phead->port = *port = b_port; memcpy (buffer, ptr, lg); buffer[lg] = '\0'; return (1); } static int sock_snd_ui (int port, char *chaine, int len, Beacon * beacon) { #ifdef OLD_AX25 char *call[9]; #else char *calls[10]; char callsign[9]; char *ptr; #endif int dlen; int slen; struct full_sockaddr_ax25 dest; struct full_sockaddr_ax25 src; int i; int nb; int s; nb = 0; #ifdef OLD_AX25 call[nb] = malloc (AX25_CALLSID); sprintf (call[nb++], "%s-%d", beacon->desti.call, beacon->desti.num); #else calls[nb] = malloc (AX25_CALLSID); sprintf (calls[nb++], "%s-%d", beacon->desti.call, beacon->desti.num); #endif for (i = 0; i < beacon->nb_digi; i++) { #ifdef OLD_AX25 call[nb] = malloc (AX25_CALLSID); sprintf (call[nb++], "%s-%d", beacon->digi[i].call, beacon->digi[i].num); #else calls[nb] = malloc (AX25_CALLSID); sprintf (calls[nb++], "%s-%d", beacon->digi[i].call, beacon->digi[i].num); #endif } #ifdef OLD_AX25 call[nb] = NULL; if ((dlen = convert_call_arglist (call, &dest)) == -1) { fprintf (stderr, "beacon: unable to convert callsign '%s'\n", call[0]); return 0; } for (i = 0; call[i]; i++) { free (call[i]); } call[0] = malloc (AX25_CALLSID); sprintf (call[0], "%s-%d", mycall, myssid); slen = convert_call (call[0], &src); call[1] = ax25_config_get_addr (p_port[port].name); if (call[1] == NULL) { free (call[0]); return (0); } convert_call_entry (call[1], src.fsa_digipeater[0].ax25_call); src.fsa_ax25.sax25_ndigis = 1; free (call[0]); #else calls[nb] = NULL; if ((dlen = ax25_aton_arglist ((const char **)calls, &dest)) == -1) { fprintf (stderr, "beacon: unable to convert callsign '%s'\n", calls[0]); return 0; } for (i = 0; calls[i]; i++) free (calls[i]); sprintf (callsign, "%s-%d", mycall, myssid); slen = ax25_aton (callsign, &src); ptr = ax25_config_get_addr (p_port[port].name); if (ptr == NULL) return (0); ax25_aton_entry (ptr, src.fsa_digipeater[0].ax25_call); src.fsa_ax25.sax25_ndigis = 1; #endif if ((s = socket (AF_AX25, SOCK_DGRAM, 0)) == -1) { perror ("beacon: socket"); return 0; } if (bind (s, (struct sockaddr *) &src, slen) == -1) { perror ("beacon: bind"); return 0; } if (sendto (s, chaine, len, 0, (struct sockaddr *) &dest, dlen) == -1) { perror ("beacon: sendto"); return 0; } close (s); return (1); } static int sock_snd_dt (int canal, char *buffer, int len) { int nb; if (scan[canal].sock <= 0) return (FALSE); nb = write (scan[canal].sock, buffer, len); if (nb == -1) { printf ("Error %d on socket %d\n", errno, scan[canal].sock); perror ("write on socket"); } else if (nb < len) { printf ("Cannot write %d bytes on socket %d\n", len - nb, scan[canal].sock); } return (TRUE); } static int sock_cmd (int port, int canal, char *cmd) { switch (*cmd++) { case 'I': /* source callsign */ while (isspace (*cmd)) ++cmd; strn_cpy (AX25_CALLSID, scan[canal].source, cmd); break; case 'D': /* Deconnection */ if (scan[canal].sock > 0) { close (scan[canal].sock); /* clear_can (canal); */ scan[canal].sock = -1; } break; case 'C': /* Connection */ while (isspace (*cmd)) ++cmd; scan[canal].paclen = p_port[port].pk_t; scan[canal].maxframe = p_port[port].frame; scan[canal].port = port; scan[canal].type = p_port[port].type; sock_connect (cmd, canal); break; default: return (0); } return (1); } #ifdef OLD_AX25 static int nr_convert_call (char *address, struct full_sockaddr_ax25 *addr) #else static int nr_ax25_aton (char *address, struct full_sockaddr_ax25 *addr) #endif { char buffer[100], *call, *alias; FILE *fp; int addrlen; call = address; while (*call) { if (isspace (*call)) { *call = '\0'; break; } *call = toupper (*call); ++call; } if ((fp = fopen ("/proc/net/nr_nodes", "r")) == NULL) { fprintf (stderr, "call: NET/ROM not included in the kernel\n"); return -1; } while (fgets (buffer, 100, fp) != NULL) { call = strtok (buffer, " \t\n\r"); alias = strtok (NULL, " \t\n\r"); if (strcmp (address, call) == 0 || strcmp (address, alias) == 0) { #ifdef OLD_AX25 addrlen = convert_call (call, addr); #else addrlen = ax25_aton (call, addr); #endif addr->fsa_ax25.sax25_family = AF_NETROM; fclose (fp); return (addrlen == -1) ? -1 : sizeof (struct sockaddr_ax25); } } fclose (fp); fprintf (stderr, "call: NET/ROM callsign or alias not found\n"); return -1; } #ifdef OLD_AX25 static int rs_convert_call (char *address, struct sockaddr_rose *addr) #else static int rs_ax25_aton (char *address, struct sockaddr_rose *addr) #endif { char *command, *call, *rsaddr, *digi; command = strdup (address); if (command) { char roseaddr[12]; call = strtok (command, " ,\t\n\r"); addr->srose_family = AF_ROSE; addr->srose_ndigis = 0; #ifdef OLD_AX25 if (convert_call_entry (call, addr->srose_call.ax25_call) == -1) #else if (ax25_aton_entry (call, addr->srose_call.ax25_call) == -1) #endif { free (command); return -1; } rsaddr = strtok (NULL, " \t\r\n"); if (rsaddr == NULL) { free (command); return -1; } /* DNIC / Address */ if (strlen (rsaddr) == 10) strcpy (roseaddr, rsaddr); else if (strlen (rsaddr) == 4) { strcpy (roseaddr, rsaddr); rsaddr = strtok (NULL, " \t\r\n"); if ((rsaddr == NULL) || (strlen (rsaddr) != 6)) { free (command); return -1; } strcpy (roseaddr + 4, rsaddr); } #ifdef OLD_AX25 if (convert_rose_address (roseaddr, addr->srose_addr.rose_addr) == -1) #else if (rose_aton (roseaddr, addr->srose_addr.rose_addr) == -1) #endif { free (command); return -1; } /* Digis */ while ((digi = strtok (NULL, " \t\r\n")) != NULL) { #if 0 #ifdef OLD_AX25 if (convert_call_entry (digi, addr->srose_digis[addr->srose_ndigis].ax25_call) == -1) #else if (ax25_aton_entry (digi, addr->srose_digis[addr->srose_ndigis].ax25_call) == -1) #endif { free (command); return -1; } if (++addr->srose_ndigis == 6) break; #else #ifdef OLD_AX25 if (convert_call_entry (digi, addr->srose_digi.ax25_call) == -1) #else if (ax25_aton_entry (digi, addr->srose_digi.ax25_call) == -1) #endif { free (command); return -1; } if (++addr->srose_ndigis == 1) break; #endif } free (command); } return sizeof (struct sockaddr_rose); } static int sock_connect (char *commande, int can) { int fd; int addrlen; int t1 = 50; /* int retry = 3; */ /* int one = debug; */ int ioc; union sockaddr_ham addr; char *p_name; char mycallsign[AX25_CALLSID]; int backoff = 0; if (*scan[can].source) { strcpy (mycallsign, scan[can].source); } else { sprintf (mycallsign, "%s-%d", mycall, myssid); } switch (scan[can].type) { case CAN_AX25: if ((fd = socket (AF_AX25, SOCK_SEQPACKET, 0)) < 0) { perror ("socket_ax"); clear_can (can); return (0); } addr.axaddr.fsa_ax25.sax25_family = AF_AX25; addr.axaddr.fsa_ax25.sax25_ndigis = 1; p_name = ax25_config_get_addr (p_port[scan[can].port].name); #ifdef OLD_AX25 convert_call_entry (mycallsign, addr.axaddr.fsa_ax25.sax25_call.ax25_call); convert_call_entry (p_name, addr.axaddr.fsa_digipeater[0].ax25_call); #else ax25_aton_entry (mycallsign, addr.axaddr.fsa_ax25.sax25_call.ax25_call); ax25_aton_entry (p_name, addr.axaddr.fsa_digipeater[0].ax25_call); #endif addrlen = sizeof (struct full_sockaddr_ax25); if (setsockopt (fd, SOL_AX25, AX25_WINDOW, &scan[can].maxframe, sizeof (scan[can].maxframe)) == -1) { perror ("AX25_WINDOW"); close (fd); clear_can (can); return (0); } if (setsockopt (fd, SOL_AX25, AX25_PACLEN, &scan[can].paclen, sizeof (scan[can].paclen)) == -1) { perror ("AX25_PACLEN"); close (fd); clear_can (can); return (0); } t1 = 5; if (setsockopt (fd, SOL_AX25, AX25_T1, &t1, sizeof (t1)) == -1) { perror ("AX25_T1"); close (fd); clear_can (can); return (0); } /* if (setsockopt (fd, SOL_AX25, AX25_N2, &retry, sizeof (retry)) == -1) { perror ("AX25_N2"); close (fd); clear_can (can); return (0); } */ if (backoff != -1) { if (setsockopt (fd, SOL_AX25, AX25_BACKOFF, &backoff, sizeof (backoff)) == -1) { perror ("AX25_BACKOFF"); close (fd); clear_can (can); return (0); } } /* if (ax25mode != -1) { if (setsockopt (fd, SOL_AX25, AX25_EXTSEQ, &ax25mode, sizeof (ax25mode)) == -1) { perror ("AX25_EXTSEQ"); close (fd); clear_can (can); return (0); } } */ break; case CAN_NETROM: if ((fd = socket (AF_NETROM, SOCK_SEQPACKET, 0)) < 0) { perror ("socket_nr"); clear_can (can); return (0); } addr.axaddr.fsa_ax25.sax25_family = AF_NETROM; addr.axaddr.fsa_ax25.sax25_ndigis = 1; p_name = nr_config_get_addr (p_port[scan[can].port].name); #ifdef OLD_AX25 convert_call_entry (p_name, addr.axaddr.fsa_ax25.sax25_call.ax25_call); convert_call_entry (mycallsign, addr.axaddr.fsa_digipeater[0].ax25_call); #else ax25_aton_entry (p_name, addr.axaddr.fsa_ax25.sax25_call.ax25_call); ax25_aton_entry (mycallsign, addr.axaddr.fsa_digipeater[0].ax25_call); #endif addrlen = sizeof (struct full_sockaddr_ax25); /* if (setsockopt (fd, SOL_NETROM, NETROM_PACLEN, &scan[can].paclen, sizeof (scan[can].paclen)) == -1) { perror ("NETROM_PACLEN"); close (fd); clear_can (can); return (0); } */ break; case CAN_ROSE: if ((fd = socket (AF_ROSE, SOCK_SEQPACKET, 0)) < 0) { perror ("socket_rs"); clear_can (can); return (0); } addr.rsaddr.srose_family = AF_ROSE; addr.rsaddr.srose_ndigis = 0; if (is_rsaddr (p_port[scan[can].port].name)) p_name = p_port[scan[can].port].name; else p_name = rs_config_get_addr (p_port[scan[can].port].name); #ifdef OLD_AX25 convert_rose_address (p_name, addr.rsaddr.srose_addr.rose_addr); convert_call_entry (mycallsign, addr.rsaddr.srose_call.ax25_call); #else rose_aton (p_name, addr.rsaddr.srose_addr.rose_addr); ax25_aton_entry (mycallsign, addr.rsaddr.srose_call.ax25_call); #endif addrlen = sizeof (struct sockaddr_rose); break; default: return FALSE; } /* if (debug && setsockopt (fd, SOL_SOCKET, SO_DEBUG, &one, sizeof (one)) == -1) { perror ("SO_DEBUG"); close (fd); clear_can (can); return (0); } */ scan[can].state = CPROGRESS; if (bind (fd, (struct sockaddr *) &addr, addrlen) == -1) { perror ("sock_connect : bind"); close (fd); /* clear_can (can); */ scan[can].sock = -1; return (TRUE); } switch (scan[can].type) { case CAN_AX25: #ifdef OLD_AX25 if ((addrlen = convert_call (commande, &addr.axaddr)) == -1) #else if ((addrlen = ax25_aton (commande, &addr.axaddr)) == -1) #endif { close (fd); /* clear_can (can); */ scan[can].sock = -1; return (0); } break; case CAN_NETROM: #ifdef OLD_AX25 if ((addrlen = nr_convert_call (commande, &addr.axaddr)) == -1) #else if ((addrlen = nr_ax25_aton (commande, &addr.axaddr)) == -1) #endif { close (fd); /* clear_can (can); */ scan[can].sock = -1; return (TRUE); } break; case CAN_ROSE: #ifdef OLD_AX25 if ((addrlen = rs_convert_call (commande, &addr.rsaddr)) == -1) #else if ((addrlen = rs_ax25_aton (commande, &addr.rsaddr)) == -1) #endif { close (fd); /* clear_can (can); */ scan[can].sock = -1; return (TRUE); } break; } ioc = 1; ioctl (fd, FIONBIO, &ioc); if (connect (fd, (struct sockaddr *) &addr, addrlen) == -1) { if (errno != EINPROGRESS) { perror ("connect"); close (fd); /* clear_can (can); */ fd = -1; } } scan[can].sock = fd; return (TRUE); } static int sock_stat (int canal, stat_ch * ptr) { int lg; int val; int tries = 0; struct ax25_info_struct ax25info; if (scan[canal].sock <= 0) { ptr->ack = 0; ptr->ret = 0; return (0); } ptr->mem = 100; val = s_free (&scan[canal]); if (scan[canal].state == DISCONNECT) { ptr->ack = 0; ptr->ret = 0; } else if (scan[canal].state != CONNECTED) ptr->ack = 0; else { ptr->ack = (scan[canal].queue - val) / scan[canal].paclen; if ((scan[canal].queue - val) && (ptr->ack == 0)) ptr->ack = 1; } if (scan[canal].type == CAN_AX25) { if (ioctl (scan[canal].sock, SIOCAX25GETINFO, &ax25info) == 0) { ptr->ret = ax25info.n2count; /* printf("n2=%d n2t=%d send=%d recv=%d\n", ax25info.n2, ax25info.n2count, ax25info.snd_q, ax25info.rcv_q); */ } else { lg = sizeof (int); #ifdef AX25_N2COUNT if (getsockopt (scan[canal].sock, SOL_AX25, AX25_N2COUNT, &tries, &lg) <= 0) { #endif if (getsockopt (scan[canal].sock, SOL_AX25, AX25_N2, &tries, &lg) <= 0) { /* perror("getsockopt : AX25_N2"); */ } #ifdef AX25_N2COUNT } #endif ptr->ret = tries; } } else { ptr->ret = 0; /* XXX */ } return (1); } static int s_status (scan_t * can) { int nb; int res = 0; fd_set sock_read; fd_set sock_write; fd_set sock_excep; struct timeval to; if (can->sock <= 0) return (0); to.tv_sec = to.tv_usec = 0; can->event = 0; FD_ZERO (&sock_read); FD_ZERO (&sock_write); FD_ZERO (&sock_excep); FD_SET (can->sock, &sock_read); FD_SET (can->sock, &sock_write); FD_SET (can->sock, &sock_excep); nb = select (can->sock + 1, &sock_read, &sock_write, &sock_excep, &to); if (nb == -1) { perror ("select"); return (res); } else if (nb == 0) { return (res); } else { if (FD_ISSET (can->sock, &sock_read)) { res |= READ_EVENT; } if (FD_ISSET (can->sock, &sock_write)) { if (can->state == CPROGRESS) { nb = write (can->sock, &res, 0); printf ("nb = %d\n", nb); if (nb != -1) { can->state = CONNECTED; can->event = CONN_EVENT; } res |= EXCEPT_EVENT; } else res |= WRITE_EVENT; } if (FD_ISSET (can->sock, &sock_excep)) { printf ("Exception sur %d\n", can->sock); can->event = NO_EVENT; res |= EXCEPT_EVENT; } } return (res); } static int sock_paclen (int canal) { if (scan[canal].sock <= 0) return (0); return (scan[canal].paclen); } static int s_free (scan_t * can) { int queue_free; if (ioctl (can->sock, TIOCOUTQ, &queue_free) == -1) { perror ("ioctl : TIOCOUTQ"); return (0); } return (queue_free); } #ifdef OLD_AX25 static char *ax25_ntoa (char *peer, const ax25_address * axa) { const unsigned char *cp; unsigned char *h = peer; short cnt; for (cnt = 0, cp = (char *) axa;; cnt++, cp++) { if (*cp == '\100') /* Found a PAD char, skip the rest * */ cnt = 5; else if (cnt < 6) /* Callsign * */ *h++ = *cp >> 1; else if (cnt == 6) { /* SSID * */ *h++ = '-'; if ((*cp & 0x1e) > 19) { *h++ = '1'; *h++ = ((*cp & 0x1e) >> 1) + '&'; } else { *h++ = ((*cp & 0x1e) >> 1) + '0'; } *h = '\0'; return peer; } } } static char *rose_ntoa (char *peer, const rose_address * rsa) { sprintf (peer, "%02X%02X%02X", rsa->rose_addr[2], rsa->rose_addr[3], rsa->rose_addr[4]); return peer; } static char *rose_ntod (char *peer, const rose_address * rsa) { sprintf (peer, "%02X%02X", rsa->rose_addr[0], rsa->rose_addr[1]); return peer; } #else static char *ax25_ntoaddr (char *peer, const ax25_address * axa) { strcpy(peer, ax25_ntoa(axa)); return peer; } static char *rose_ntoaddr (char *peer, const rose_address * rsa) { strcpy(peer, rose_ntoa(rsa)+4); return peer; } static char *rose_ntodnic (char *peer, const rose_address * rsa) { strncpy(peer, rose_ntoa(rsa), 4); peer[4] = '\0'; return peer; } #endif static int name_to_port (char *port) { int i; for (i = 1; i < NBPORT; i++) { if (strcmp (port, p_port[i].name) == 0) return (i); } /* printf("Port <%s> not found in port.sys\n", port); */ return (0); } static int sock_connexion (int new, int can, union sockaddr_ham *addr, int *port, char *buffer) { int p; int val; int plen; int backoff; char *pn = NULL; char User[80]; char Node[80]; char Dnic[80]; union sockaddr_ham addrham; scan[can].state = CONNECTED; scan[can].sock = new; if (scan[can].port == 0) { plen = sizeof (addrham); if (getsockname (scan[can].sock, (struct sockaddr *) &addrham, &plen) == 0) { switch (addrham.axaddr.fsa_ax25.sax25_family) { case AF_AX25: scan[can].type = CAN_AX25; pn = ax25_config_get_port (&addrham.axaddr.fsa_digipeater[0]); break; case AF_NETROM: scan[can].type = CAN_NETROM; pn = nr_config_get_port (&addrham.axaddr.fsa_ax25.sax25_call); break; case AF_ROSE: scan[can].type = CAN_ROSE; pn = rs_config_get_port (&addrham.rsaddr.srose_addr); break; } scan[can].port = (pn) ? name_to_port (pn) : *port; printf ("Connection received on port %s = %d\n", pn, scan[can].port); if (scan[can].port == 0) { close (new); clear_can (can); return (0); } } else scan[can].port = *port; } scan[can].queue = s_free (&scan[can]); *port = p = scan[can].port; val = p_port[p].pk_t; if (val == 0) val = 128; scan[can].paclen = val; switch (scan[can].type) { case CAN_AX25: if (setsockopt (new, SOL_AX25, AX25_PACLEN, &val, sizeof (val)) == -1) { perror ("setsockopt : AX25_PACLEN"); close (new); clear_can (can); return (0); } backoff = 0; if (setsockopt (new, SOL_AX25, AX25_BACKOFF, &backoff, sizeof (backoff)) == -1) { perror ("setsockopt : AX25_BACKOFF"); close (new); clear_can (can); return (0); } /* Look for informations on the connection */ #ifdef OLD_AX25 ax25_ntoa (User, &addr->axaddr.fsa_ax25.sax25_call); #else ax25_ntoaddr (User, &addr->axaddr.fsa_ax25.sax25_call); #endif sprintf (buffer, "(%d) CONNECTED to %d:%s", can, p, User); if (addr->axaddr.fsa_ax25.sax25_ndigis) { int i; char c_digi[AX25_CALLSID + 1]; strcat (buffer, " via"); for (i = 0; i < addr->axaddr.fsa_ax25.sax25_ndigis; i++) { c_digi[0] = ' '; #ifdef OLD_AX25 ax25_ntoa (c_digi + 1, &addr->axaddr.fsa_digipeater[i]); #else ax25_ntoaddr (c_digi + 1, &addr->axaddr.fsa_digipeater[i]); #endif strcat (buffer, c_digi); } } break; case CAN_NETROM: /* if (setsockopt(new, SOL_NETROM, NETROM_PACLEN, &val, sizeof(val)) == -1) { perror("setsockopt : NETROM_PACLEN"); close (new); clear_can (can); return(0); } */ /* Look for informations on the connection */ #ifdef OLD_AX25 ax25_ntoa (User, &addr->axaddr.fsa_ax25.sax25_call); ax25_ntoa (Node, &addr->axaddr.fsa_digipeater[0]); #else ax25_ntoaddr (User, &addr->axaddr.fsa_ax25.sax25_call); ax25_ntoaddr (Node, &addr->axaddr.fsa_digipeater[0]); #endif sprintf (buffer, "(%d) CONNECTED to %d:%s via %s", can, p, User, Node); break; case CAN_ROSE: /* Look for informations on the connection */ #ifdef OLD_AX25 rose_ntod (Dnic, &addr->rsaddr.srose_addr); rose_ntoa (Node, &addr->rsaddr.srose_addr); ax25_ntoa (User, &addr->rsaddr.srose_call); #else rose_ntodnic (Dnic, &addr->rsaddr.srose_addr); rose_ntoaddr (Node, &addr->rsaddr.srose_addr); ax25_ntoaddr (User, &addr->rsaddr.srose_call); #endif sprintf (buffer, "(%d) CONNECTED to %d:%s via %s %s", can, p, User, Dnic, Node); break; } return (TRUE); } static void clear_can (int canal) { memset (&scan[canal], 0, sizeof (scan_t)); scan[canal].sock = -1; scan[canal].state = DISCONNECT; } static int is_rsaddr (char *addr) { int n = 0; while (addr[n]) { if (!isdigit (addr[n])) return (0); ++n; } return (n == 10); } fbb-7.04j/src/drv_tcp.c0100644000175100017510000010604507726652012013013 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /****************************************************** * * * FBB Driver for TCP/IP domain sockets * * * * F6FBB - 1996 * * * ******************************************************/ #include #include #include #include #include #include #include #include #include #include #include #undef open #undef read #undef write #undef close #define AX25_CALLSID 10 #define READ_EVENT 1 #define WRITE_EVENT 2 #define EXCEPT_EVENT 4 #define QUEUE_EVENT 8 #define DISCONNECT 0 #define CPROGRESS 1 #define CONNECTED 2 #define WAITINGCALL 3 #define WAITINGPASS 4 #define READONLY 5 #define SENDCALL 6 #define DISC_EVENT 1 #define CONN_EVENT 2 #define RETR_EVENT 4 #define BUSY_EVENT 8 #define TIME_EVENT 16 typedef struct { int ncan; int sock; int sock_ui; int port; int state; int paclen; int maxframe; int netrom; int event; int queue; int nego; int cesc; int lgial; int lpos; int lqueue; int nb_try; int nb_ret; int bs; int binary; int lgcall; long timeout; char ial[3]; char call[80]; indicat callsign; char *lbuf; } tcan_t; typedef struct { int sock_ui; int rem_port; int curcan; int nbcan; char rem_addr[80]; tcan_t *tcan; } tport_t; static tport_t tport[NBPORT]; /* static int last_can = 1; */ static int stop_cnx (int port); static int tcp_getline (int port, int can, char *buffer); static int tcp_snd_dt (int port, int, char *, int); static int tcp_cmd (int, int, char *); static int tcp_connect (int, char *, int); static int tcp_stat (int, int, stat_ch *); static int tcp_paclen (int port, int); static int s_free (tcan_t *); static int s_status (tcan_t *); static int tcp_check_call (int port, int can, char *callsign, char *address); static int tcp_check_pass (int port, int can, char *callsign); static int tcp_trame (int port, int canal, char *data, int len); static int snd_tcp_ui(int port, char *buffer, int len, Beacon *ptr); static int rcv_tcp_ui(int port, char *buffer, int *len, ui_header * ui); static void clear_can (int port, int canal); static void read_only_alert (int port, int); /* * Generic functions of the driver */ /* Check or change status of a port/channel */ int sta_tcp (int port, int canal, int cmd, void *ptr) { char *scan; char commande; switch (cmd) { case TNCSTAT: return (tcp_stat (port, canal, (stat_ch *) ptr)); case PACLEN: *((int *) ptr) = tcp_paclen (port, canal); return (1); case BSCMD: tport[port].tcan[canal].bs = *((int *) ptr); return (1); case SNDCMD: return (tcp_cmd (port, canal, (char *) ptr)); case SETBUSY: return stop_cnx (port); case PORTCMD: scan = (char *)ptr; commande = toupper(*scan); ++scan; while (isspace(*scan)) ++scan; switch (commande) { case 'A' : n_cpy(39, tport[port].rem_addr, scan); break; case 'P' : tport[port].rem_port = atoi(scan); break; } return(1); } return (0); } /* Sends data */ int snd_tcp (int port, int canal, int cmd, char *buffer, int len, Beacon * ptr) { int ret = 0; switch (cmd) { case COMMAND: break; case UNPROTO: if (p_port[port].typort == TYP_ETH) { snd_tcp_ui(port, buffer, len, ptr); return 1; } break; case DATA: ret = tcp_snd_dt (port, canal, buffer, len); break; } return (ret); } /* receives data */ int rcv_tcp (int *port, int *canal, int *cmd, char *buffer, int *len, ui_header * ui) { #define LGBUF 252 char buf[LGBUF + 2]; int can; int valid; int res; int i; *cmd = INVCMD; valid = 0; /* Teste les UIs */ if (rcv_tcp_ui(*port, buffer, len, ui)) { *canal = 0; *cmd = UNPROTO; return 1; } /* Teste s'il y a une connection */ tport[*port].tcan[0].sock = p_port[*port].fd; res = s_status (&tport[*port].tcan[0]); if (res & READ_EVENT) { /* static char *TelnetInit = "\377\375\001\377\375\042"; */ /* static char *TelnetInit = "\377\376\001\377\375\042"; */ static char *TelnetInit = "\377\374\001\000Telnet Initialisation string "; int new; int addr_len; struct sockaddr_in sock_addr; addr_len = sizeof (sock_addr); new = accept (p_port[*port].fd, (struct sockaddr *) &sock_addr, &addr_len); /* Affecter le nouveau socket a un canal vide */ for (i = 1; i <= tport[*port].nbcan; i++) { if (tport[*port].tcan[i].state == DISCONNECT) { break; } } if (i > tport[*port].nbcan) { write (new, TelnetInit, strlen (TelnetInit)); /* Impossible d'affecter le canal -> deconnexion */ sprintf (buf, "\r\nSorry, no more channels available\r\n\r\n"); write (new, buf, strlen (buf)); close (new); } else { int val = 0; FILE *fptr; tport[*port].tcan[i].state = WAITINGCALL; tport[*port].tcan[i].sock = new; tport[*port].tcan[i].paclen = (val == 0) ? 250 : val; tport[*port].tcan[i].queue = s_free (&tport[*port].tcan[i]); tport[*port].tcan[i].timeout = time (NULL) + 120L; if (p_port[*port].typort == TYP_ETH) { sprintf (buf, "\r\n%s BBS data access\r\n\r\n", my_call); write (new, buf, strlen (buf)); } else { write (new, TelnetInit, strlen (TelnetInit)); if ((fptr = fopen (c_disque ("LANG\\TELNET.ENT"), "rt")) == NULL) { sprintf (buf, "\r\n%s BBS. TELNET Access\r\n\r\n", my_call); write (new, buf, strlen (buf)); } else { int nb; char *ptr; while (fgets (buf, LGBUF, fptr)) { nb = strlen (buf); if (nb) { buf[nb - 1] = '\r'; buf[nb] = '\n'; buf[nb + 1] = '\0'; } ptr = var_txt (buf); write (new, ptr, strlen (ptr)); } fclose (fptr); } } sprintf (buf, "Callsign : "); write (new, buf, strlen (buf)); val = p_port[*port].pk_t; return (FALSE); } } for (i = 1 ; i <= tport[*port].nbcan ; i++) { /* Passe au canal suivant pour le polling */ ++tport[*port].curcan; if (tport[*port].curcan > tport[*port].nbcan) tport[*port].curcan = 1; can = tport[*port].curcan; if ((tport[*port].tcan[can].sock == -1) && (tport[*port].tcan[can].state != DISCONNECT)) { sprintf (buffer, "(%d) DISCONNECTED fm TCP", can); tport[*port].tcan[can].state = DISCONNECT; clear_can (*port, can); *len = strlen (buffer); *cmd = COMMAND; *canal = can; return (TRUE); } /* Canal de communication */ res = s_status (&tport[*port].tcan[can]); if (res & TIME_EVENT) { sprintf (buf, "Timeout, disconnected !\r\n"); write (tport[*port].tcan[can].sock, buf, strlen (buf)); close (tport[*port].tcan[can].sock); clear_can (*port, can); return (FALSE); } if (res & WRITE_EVENT) { /* Can write to the socket... Unused */ } if (res & EXCEPT_EVENT) { if (tport[*port].tcan[can].event == CONN_EVENT) { /* Appel sortant connecte */ /* Le host distant a ete connecte. sprintf(buffer, "*** Connected to %s-%d\r", tcan[can].callsign.call, tcan[can].callsign.num); in_buf(voie, buffer, strlen(buffer)); */ /* if (tcan[can].lgcall) write (tcan[can].sock, tcan[can].call, tcan[can].lgcall); */ /* Connexion a la BBS... */ sprintf (buffer, "(%d) CONNECTED to %s-%d", can, tport[*port].tcan[can].callsign.call, tport[*port].tcan[can].callsign.num); if (p_port[*port].typort == TYP_ETH) tport[*port].tcan[can].state = SENDCALL; else tport[*port].tcan[can].state = CONNECTED; tport[*port].tcan[can].nb_try = 0; tport[*port].tcan[can].timeout = 0L; *len = strlen (buffer); *cmd = COMMAND; *canal = can; return (TRUE); } } #define LGTCP 1100 if ((res & QUEUE_EVENT) || (res & READ_EVENT)) { int nb = 0; int i; if (tport[*port].tcan[can].sock == -1) { printf ("read on invalid socket\n"); return (FALSE); } /* Alloue le buffer si necessaire */ if (tport[*port].tcan[can].lbuf == NULL) { tport[*port].tcan[can].lbuf = calloc (LGTCP, 1); tport[*port].tcan[can].lpos = 0; tport[*port].tcan[can].lqueue = 0; tport[*port].tcan[can].nb_ret = 0; } if (res & READ_EVENT) { /* Reste de la place ds le buffer ? */ nb = ((LGTCP - tport[*port].tcan[can].lqueue) > 256) ? 256 : LGTCP - tport[*port].tcan[can].lqueue; if (nb) { nb = read (tport[*port].tcan[can].sock, buffer, nb); if ((nb == 0) || ((nb == -1) && (errno == ENOTCONN))) { /* Deconnection */ sprintf (buffer, "(%d) DISCONNECTED fm TCP", can); close (tport[*port].tcan[can].sock); clear_can (*port, can); *len = strlen (buffer); *cmd = COMMAND; *canal = can; return (TRUE); } else if (nb == -1) { printf ("errno = %d\n", errno); perror ("read"); return (FALSE); } } } { int process; int pos; int lg; char *ptr; char *address; int addr_len; struct sockaddr_in sock_addr; if (nb) { nb = tcp_trame (*port, can, buffer, nb); if (nb == 0) return (FALSE); } pos = tport[*port].tcan[can].lpos + tport[*port].tcan[can].lqueue; if (pos > LGTCP) pos -= LGTCP; for (i = 0; i < nb; i++) { if (tport[*port].tcan[can].lqueue > (LGTCP - 10)) { ++tport[*port].tcan[can].nb_ret; break; } tport[*port].tcan[can].lbuf[pos] = buffer[i]; if (++pos == LGTCP) pos = 0; ++tport[*port].tcan[can].lqueue; if (buffer[i] == '\r') { ++tport[*port].tcan[can].nb_ret; } } nb = tport[*port].tcan[can].lqueue; tport[*port].tcan[can].timeout = time (NULL) + 120L; process = (tport[*port].tcan[can].nb_ret > 0); switch (tport[*port].tcan[can].state) { case SENDCALL: lg = tcp_getline (*port, can, buffer); if (lg == 0) return 0; buffer[lg] = '\0'; if (strstr(buffer, "allsig")) { write(tport[*port].tcan[can].sock, tport[*port].tcan[can].call, tport[*port].tcan[can].lgcall); tport[*port].tcan[can].state = CONNECTED; tport[*port].tcan[can].lgcall = 0; return (TRUE); } break; case WAITINGCALL: if (!process) return (FALSE); if (!tcp_getline (*port, can, buffer)) return 0; sup_ln (strupr (buffer)); addr_len = sizeof (sock_addr); if ((getpeername(tport[*port].tcan[can].sock, (struct sockaddr *)&sock_addr, &addr_len) == 0) && (sock_addr.sin_family == AF_INET)) address = inet_ntoa(sock_addr.sin_addr); else address = NULL; switch (tcp_check_call (*port, can, buffer, address)) { case 0: if (++tport[*port].tcan[can].nb_try > 3) { sprintf (buf, "Callsign error, disconnected !\r\n"); write (tport[*port].tcan[can].sock, buf, strlen (buf)); close (tport[*port].tcan[can].sock); tport[*port].tcan[can].sock = -1; } else { char buf[80]; buffer[20] = '\0'; sprintf (buf, "Invalid callsign \"%s\" !\r\n", buffer); write (tport[*port].tcan[can].sock, buf, strlen (buf)); sprintf (buf, "Callsign : "); write (tport[*port].tcan[can].sock, buf, strlen (buf)); } break; case 1: { info buf_info; FILE *fptr; unsigned coord; if ((coord = chercoord (tport[*port].tcan[can].callsign.call)) == 0xffff) { close (tport[*port].tcan[can].sock); tport[*port].tcan[can].sock = -1; break; } fptr = ouvre_nomenc (); fseek (fptr, (long) coord * sizeof (info), 0); fread ((char *) &buf_info, sizeof (info), 1, fptr); ferme (fptr, 11); if (!MOD (buf_info.flags)) { read_only_alert (*port, can); tport[*port].tcan[can].state = READONLY; } else { sprintf (buf, "Password : "); write (tport[*port].tcan[can].sock, buf, strlen (buf)); tport[*port].tcan[can].state = WAITINGPASS; tport[*port].tcan[can].nb_try = 0; } } break; case 2: if (++tport[*port].tcan[can].nb_try > 3) { sprintf (buf, "Callsign error, disconnected !\r\n"); write (tport[*port].tcan[can].sock, buf, strlen (buf)); close (tport[*port].tcan[can].sock); tport[*port].tcan[can].sock = -1; } else { if (p_port[*port].moport & 0x40) { read_only_alert (*port, can); tport[*port].tcan[can].state = READONLY; } else { char buf[80]; sprintf (buf, "Unregistered callsign \"%s\" !\r\n", buffer); write (tport[*port].tcan[can].sock, buf, strlen (buf)); sprintf (buf, "Callsign : "); write (tport[*port].tcan[can].sock, buf, strlen (buf)); } } break; case 5: sprintf (buffer, "(%d) CONNECTED to %s-%d", can, tport[*port].tcan[can].callsign.call, tport[*port].tcan[can].callsign.num); tport[*port].tcan[can].state = CONNECTED; tport[*port].tcan[can].nb_try = 0; tport[*port].tcan[can].timeout = 0L; *len = strlen (buffer); *cmd = COMMAND; *canal = can; return (TRUE); } break; case WAITINGPASS: if (!process) return (FALSE); if (!tcp_getline (*port, can, buffer)) return 0; sup_ln (buffer); if (tcp_check_pass (*port, can, buffer)) { sprintf (buf, "\r\nLogon Ok. Type NP to change password.\r\n\r\n"); write (tport[*port].tcan[can].sock, buf, strlen (buf)); sprintf (buffer, "(%d) CONNECTED to %s-%d", can, tport[*port].tcan[can].callsign.call, tport[*port].tcan[can].callsign.num); tport[*port].tcan[can].state = CONNECTED; tport[*port].tcan[can].nb_try = 0; tport[*port].tcan[can].timeout = 0L; *len = strlen (buffer); *cmd = COMMAND; *canal = can; return (TRUE); } else { if (++tport[*port].tcan[can].nb_try > 3) { if (p_port[*port].moport & 0x40) { read_only_alert (*port, can); tport[*port].tcan[can].state = READONLY; } else { sprintf (buf, "Password error, disconnected !\r\n"); write (tport[*port].tcan[can].sock, buf, strlen (buf)); close (tport[*port].tcan[can].sock); tport[*port].tcan[can].sock = -1; } } else { char buf[80]; sprintf (buf, "Password error !\r\nPassword : "); write (tport[*port].tcan[can].sock, buf, strlen (buf)); } } return (FALSE); case READONLY: if (!process) return (FALSE); if (!tcp_getline (*port, can, buffer)) return 0; if (toupper (*buffer) == 'Y') { /* Read-Only mode accepted */ sprintf (buf, "\r\nLogon Ok. You have a read-only access.\r\n\r\n"); write (tport[*port].tcan[can].sock, buf, strlen (buf)); sprintf (buffer, "(%d) READONLY to %s-%d", can, tport[*port].tcan[can].callsign.call, tport[*port].tcan[can].callsign.num); tport[*port].tcan[can].state = CONNECTED; tport[*port].tcan[can].nb_try = 0; tport[*port].tcan[can].timeout = 0L; *len = strlen (buffer); *cmd = COMMAND; *canal = can; return (TRUE); } else { sprintf (buf, "Callsign : "); write (tport[*port].tcan[can].sock, buf, strlen (buf)); tport[*port].tcan[can].state = WAITINGCALL; } break; default: pos = tport[*port].tcan[can].lpos; ptr = tport[*port].tcan[can].lbuf; for (i = 0; i < tport[*port].tcan[can].lqueue; i++) { buffer[i] = ptr[pos]; if (++pos == LGTCP) pos = 0; } *len = tport[*port].tcan[can].lqueue; *cmd = DATA; *canal = can; tport[*port].tcan[can].nb_ret = 0; tport[*port].tcan[can].lpos = 0; tport[*port].tcan[can].lqueue = 0; tport[*port].tcan[can].timeout = 0L; return (TRUE); } } } } return (FALSE); } /* Open port */ int opn_tcp (int port, int nb) { int i; int val; int len; int ok = TRUE; int tcp_port; char s[80]; struct sockaddr_in sock_addr; char *ptr; tport[port].sock_ui = -1; sock_addr.sin_family = AF_INET; sock_addr.sin_addr.s_addr = 0; /* Test if portname is hex number */ ptr = p_com[(int) p_port[port].ccom].name; if (strcmp (ptr, "0") == 0) { tcp_port = p_com[(int) p_port[port].ccom].port; } else if (strspn (ptr, "0123456789abcdefABCDEF") != strlen (ptr)) { /* It may be tcp address. Port number is in port */ if (inet_aton (ptr, &sock_addr.sin_addr)) tcp_port = p_com[(int) p_port[port].ccom].port; else tcp_port = p_com[(int) p_port[port].ccom].cbase; } else { /* for up compatibility */ tcp_port = p_com[(int) p_port[port].ccom].cbase; } sock_addr.sin_port = htons (tcp_port); sprintf (s, "Init PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); InitText (s); /* old_can = last_can; last_can += nb; if (last_can > TCP_MAXCAN) last_can = TCP_MAXCAN; for (i = old_can; i < last_can; i++) { clear_can (i); } */ tport[port].tcan = (tcan_t *)calloc(nb+1, sizeof(tcan_t)); if (tport[port].tcan == NULL) return 0; tport[port].curcan = 1; tport[port].nbcan = nb; for (i = 0 ; i <= nb ; i++) clear_can(port, i); /* Socket reception d'appels */ if (p_port[port].fd == 0) { sprintf (s, "Open PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); InitText (s); sleep (1); if ((p_port[port].fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { perror ("socket_r"); return (0); } val = 1; len = sizeof (val); if (setsockopt (p_port[port].fd, SOL_SOCKET, SO_REUSEADDR, (char *) &val, len) == -1) { perror ("opn_tcp : setsockopt SO_REUSEADDR"); } if (bind (p_port[port].fd, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) != 0) { perror ("opn_tcp : bind"); close (p_port[port].fd); p_port[port].fd = -1; return (0); } if (listen (p_port[port].fd, SOMAXCONN) == -1) { perror ("listen"); close (p_port[port].fd); p_port[port].fd = -1; return (0); } memset (&tport[port].tcan[0], 0, sizeof (tcan_t)); } /* Socket reception UIs */ if (p_port[port].typort == TYP_ETH) { if ((tport[port].sock_ui = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { perror ("socket_ui"); return (0); } if (bind (tport[port].sock_ui, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) != 0) { perror ("opn_tcp : bind"); close (tport[port].sock_ui); tport[port].sock_ui = -1; return (0); } } sprintf (s, "Prog PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); InitText (s); return (ok); } /* Close port */ int cls_tcp (int port) { int i; for (i = 1; i <= tport[port].nbcan; i++) { if (tport[port].tcan[i].sock != -1) { close (tport[port].tcan[i].sock); } tport[port].tcan[i].state = DISCONNECT; } if ((p_port[port].typort == TYP_SCK) && (p_port[port].fd)) { close (p_port[port].fd); p_port[port].fd = 0; } if (tport[port].sock_ui != -1) { close (tport[port].sock_ui); tport[port].sock_ui = -1; } free(tport[port].tcan); return (1); } /* * Static functions * */ #define LF 0x0a #define CR 0x0d #define SE 0xf0 #define NOP 0xf1 #define DM 0xf2 #define BRK 0xf3 #define IP 0xf4 #define AO 0xf5 #define AYT 0xf6 #define EC 0xf7 #define EL 0xf8 #define GA 0xf9 #define SB 0xfa #define WILL 0xfb #define WONT 0xfc #define DO 0xfd #define DONT 0xfe #define IAC 0xff /* Telnet options */ #define TN_TRANSMIT_BINARY 0 #define TN_ECHO 1 #define TN_SUPPRESS_GA 3 #define TN_STATUS 5 #define TN_TIMING_MARK 6 /* Linemode options */ #define TN_LINEMODE 34 #define TN_LINEMODE_MODE 1 #define TN_LINEMODE_MODE_EDIT 1 static int stop_cnx (int port) { close(p_port[port].fd); p_port[port].fd = 0; return 1; } static int tcp_trame (int port, int canal, char *data, int len) { int i; int carac; int olg = 0; char *optr = data; int pial = tport[port].tcan[canal].lgial; if (tport[port].tcan[canal].binary) { return (len); } for (i = 0; i < len; i++) { carac = data[i] & 0xff; switch (pial) { case 0: if (carac == IAC) tport[port].tcan[canal].ial[pial++] = carac; else { if (tport[port].tcan[canal].nego == 0) { optr[olg++] = carac; if ((carac == CR) && (tport[port].tcan[canal].bs)) pial = 10; } else { printf ("%02x ", carac); } } break; case 1: if (carac == IAC) { optr[olg++] = carac; pial = 0; } else if (tport[port].tcan[canal].nego) { printf ("%02x...\n", carac); } else { switch (carac) { case WILL: printf ("WILL "); break; case WONT: printf ("WONT "); break; case DO: printf ("DO "); break; case DONT: printf ("DONT "); break; case SB: printf ("SUBN "); tport[port].tcan[canal].nego = 1; pial = 0; break; case GA: printf ("GA\n"); pial = 0; break; case EL: printf ("EL\n"); pial = 0; break; case EC: printf ("EC\n"); pial = 0; break; case AYT: printf ("AYT\n"); pial = 0; break; case AO: printf ("AO\n"); pial = 0; break; case IP: printf ("IP\n"); pial = 0; break; case BRK: printf ("BRK\n"); pial = 0; break; case DM: printf ("DM\n"); pial = 0; break; case NOP: printf ("NOP\n"); pial = 0; break; case SE: printf ("SE\n"); /* l = 0; */ tport[port].tcan[canal].nego = 0; pial = 0; break; default: printf ("%02x...\n", carac); break; } if (pial) tport[port].tcan[canal].ial[pial++] = carac; } break; case 2: { char buf[80]; printf ("%02x...\n", carac); switch (tport[port].tcan[canal].ial[1]) { case WILL: if (carac == TN_LINEMODE) { /* write(tport[port].tcan[canal].sock, buffer, strlen(buffer)); */ } printf (" -> DONT %02x\n", carac); sprintf (buf, "%c%c%c", IAC, DONT, carac); write (tport[port].tcan[canal].sock, buf, strlen (buf)); break; case DO: if (carac != TN_ECHO) { printf (" -> WONT %02x\n", carac); sprintf (buf, "%c%c%c", IAC, WONT, carac); write (tport[port].tcan[canal].sock, buf, strlen (buf)); } break; case WONT: case DONT: break; case SB: break; } pial = 0; } break; case 10: { /* Teste le CRLF -> CR */ if (carac != LF) optr[olg++] = carac; pial = 0; } break; } } tport[port].tcan[canal].lgial = pial; return (olg); } static int tcp_check_call (int port, int can, char *callsign, char *address) { int res = 0; if (*callsign == '.') { tport[port].tcan[can].binary = 1; ++callsign; } tport[port].tcan[can].callsign.num = extind (callsign, tport[port].tcan[can].callsign.call); if (find (tport[port].tcan[can].callsign.call)) { if (chercoord (tport[port].tcan[can].callsign.call) != 0xffff) res = 1; else res = 2; } // Adresse autorisee sans password ? if (address) { FILE *fptr; char str[256]; char ip[80]; char pass[256]; fptr = fopen(c_disque("passwd.sys"), "rt"); if (fptr) { while (fgets(str, sizeof(str), fptr)) { if ((*str == '\0') || (*str == '#')) continue; *ip = *pass = '\0'; sscanf(str, "%s %s", ip, pass); if (strcmp("+", ip) == 0) { res = 5; break; } if (strcmp(address, ip) == 0) { if (strcmp("+", pass) == 0) res = 5; else res = 2; break; } } fclose(fptr); } } return (res); } static int tcp_check_pass (int port, int can, char *passwd) { unsigned record; record = chercoord (tport[port].tcan[can].callsign.call); if (record != 0xffff) { FILE *fptr; info frec; fptr = ouvre_nomenc (); fseek (fptr, ((long) record * sizeof (info)), 0); fread (&frec, sizeof (info), 1, fptr); ferme (fptr, 92); if (strcasecmp (passwd, frec.pass) == 0) { return (TRUE); } } return (FALSE); } static int tcp_snd_dt (int port, int canal, char *buffer, int len) { int i; int nb; int lg; char *ptr; char buf[600]; if (tport[port].tcan[canal].sock == -1) return (FALSE); for (ptr = buf, nb = 0, i = 0; i < len; i++) { *ptr++ = buffer[i]; ++nb; if (!tport[port].tcan[canal].binary) { if ((buffer[i] == '\r') && (tport[port].tcan[canal].bs)) { *ptr++ = '\n'; ++nb; } else if (buffer[i] == IAC) { *ptr++ = IAC; ++nb; } } } lg = write (tport[port].tcan[canal].sock, buf, nb); if (lg == -1) { printf ("Error %d on socket %d\n", errno, tport[port].tcan[canal].sock); perror ("write on socket"); } else if (lg < nb) { printf ("Cannot write %d bytes on socket %d\n", nb - lg, tport[port].tcan[canal].sock); } return (TRUE); } static int tcp_cmd (int port, int canal, char *cmd) { switch (*cmd++) { case 'I': /* source callsign */ while (isspace (*cmd)) ++cmd; tport[port].tcan[canal].callsign.num = extind (cmd, tport[port].tcan[canal].callsign.call); break; case 'D': /* Deconnection */ if (tport[port].tcan[canal].sock != -1) { close (tport[port].tcan[canal].sock); tport[port].tcan[canal].sock = -1; } break; case 'C': tcp_connect (port, cmd, canal); break; default: return (0); } return (1); } static int tcp_connect (int port, char *commande, int can) { int fd; int ioc; int tcp_port; char tcp_add[80]; char indic[80]; struct sockaddr_in sock_addr; struct hostent *host; /* Connection */ while (isspace (*commande)) ++commande; tport[port].tcan[can].paclen = p_port[port].pk_t; tport[port].tcan[can].maxframe = p_port[port].frame; tport[port].tcan[can].port = port; if (tport[port].tcan[can].state != DISCONNECT) return (0); tcp_add[0] = '\0'; tcp_port = 23; commande[79] = '\0'; if (p_port[port].typort == TYP_ETH) { char *ptr; strcpy(tcp_add, tport[port].rem_addr); tcp_port = tport[port].rem_port; sprintf(tport[port].tcan[can].call, ".%s-%d^", tport[port].tcan[can].callsign.call, tport[port].tcan[can].callsign.num); /* Remote call */ ptr = strtok(commande, " ,\t"); if (!ptr) return(0); strcat(tport[port].tcan[can].call, strupr(ptr)); /* Digis */ ptr = strtok(NULL, " ,\t"); if (ptr) strcat(tport[port].tcan[can].call, " via"); while (ptr) { if ((stricmp(ptr, "via") != 0) && (stricmp(ptr, "v") != 0)) { strcat(tport[port].tcan[can].call, " "); strcat(tport[port].tcan[can].call, strupr(ptr)); } ptr = strtok(NULL, " ,\t"); } strcat(tport[port].tcan[can].call, "\r"); tport[port].tcan[can].lgcall = strlen(tport[port].tcan[can].call); tport[port].tcan[can].binary = 1; /* Canal->phase = SENDCALL; */ } else { sscanf (commande, "%s %s %i", indic, tcp_add, &tcp_port); tport[port].tcan[can].callsign.num = extind (indic, tport[port].tcan[can].callsign.call); tport[port].tcan[can].lgcall = 0; if (!find (tport[port].tcan[can].callsign.call)) { fprintf (stderr, "connect : invalid callsign %s\n", indic); return (0); } if (tcp_add[0] == '\0') { fprintf (stderr, "connect : tcp address missing\n"); return (0); } } if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { perror ("socket_ax"); clear_can (port, can); return (0); } sock_addr.sin_family = AF_INET; sock_addr.sin_port = htons (tcp_port); host = gethostbyname(tcp_add); if (host) sock_addr.sin_addr.s_addr = ((struct in_addr *)(host->h_addr))->s_addr; else sock_addr.sin_addr.s_addr = inet_addr (tcp_add); ioc = 1; ioctl (fd, FIONBIO, &ioc); if (connect (fd, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) == -1) { if (errno != EINPROGRESS) { printf ("\n"); perror ("connect"); clear_can (port, can); close (fd); return (0); } } printf ("*** Connect in progress %s canal %d\n", commande, can); tport[port].tcan[can].sock = fd; tport[port].tcan[can].state = CPROGRESS; tport[port].tcan[can].queue = s_free (&tport[port].tcan[can]); return (TRUE); } static int tcp_stat (int port, int canal, stat_ch * ptr) { int val; if ((canal == 0) || (tport[port].tcan[canal].sock == -1)) return (0); ptr->mem = 100; val = s_free (&tport[port].tcan[canal]); if (tport[port].tcan[canal].state != CONNECTED) ptr->ack = 0; else { ptr->ack = (tport[port].tcan[canal].queue - val) / tport[port].tcan[canal].paclen; if ((tport[port].tcan[canal].queue - val) && (ptr->ack == 0)) ptr->ack = 1; } return (1); } static int s_status (tcan_t * can) { int nb; int res = 0; fd_set tcp_read; fd_set tcp_write; fd_set tcp_excep; struct timeval to; if (can->sock == -1) return (0); if ((can->timeout) && (can->timeout < time (NULL))) { res |= TIME_EVENT; can->timeout = 0L; return (res); } if (can->lqueue) { res |= QUEUE_EVENT; } to.tv_sec = to.tv_usec = 0; can->event = 0; FD_ZERO (&tcp_read); FD_ZERO (&tcp_write); FD_ZERO (&tcp_excep); FD_SET (can->sock, &tcp_read); FD_SET (can->sock, &tcp_write); FD_SET (can->sock, &tcp_excep); nb = select (can->sock + 1, &tcp_read, &tcp_write, &tcp_excep, &to); if (nb == -1) { perror ("select"); return (res); } else if (nb == 0) { return (res); } else { if (FD_ISSET (can->sock, &tcp_read)) { res |= READ_EVENT; } if (FD_ISSET (can->sock, &tcp_write)) { if (can->state == CPROGRESS) { if (p_port[port].typort == TYP_ETH) can->state = SENDCALL; else can->state = CONNECTED; write (can->sock, &res, 0); res |= EXCEPT_EVENT; can->event = CONN_EVENT; } else res |= WRITE_EVENT; } if (FD_ISSET (can->sock, &tcp_excep)) { res |= EXCEPT_EVENT; } } return (res); } static int tcp_paclen (int port, int canal) { if (tport[port].tcan[canal].sock == -1) return (0); return (tport[port].tcan[canal].paclen); } static int s_free (tcan_t * can) { int queue_free; if (ioctl (can->sock, TIOCOUTQ, &queue_free) == -1) { perror ("ioctl : TIOCOUTQ"); return (0); } return (queue_free); } static void clear_can (int port, int canal) { if (tport[port].tcan[canal].lbuf) free (tport[port].tcan[canal].lbuf); memset (&tport[port].tcan[canal], 0, sizeof (tcan_t)); tport[port].tcan[canal].sock = -1; tport[port].tcan[canal].bs = 1; tport[port].tcan[canal].binary = 0; tport[port].tcan[canal].state = DISCONNECT; } #define READ_ONLY "\r\nLogin in read-only mode.\r\nYou may leave a message to SYSOP.\r\n\r\nGo on anyway (Y/N) ? " static void read_only_alert (int port, int can) { char buf[256]; sprintf (buf, READ_ONLY); write (tport[port].tcan[can].sock, buf, strlen (buf)); } /* Copie une ligne dans le buffer */ static int tcp_getline (int port, int can, char *buffer) { int i = 0; int c; int pos; char *ptr; pos = tport[port].tcan[can].lpos; ptr = tport[port].tcan[can].lbuf; while (tport[port].tcan[can].lqueue) { c = ptr[pos]; if (++pos == LGTCP) pos = 0; --tport[port].tcan[can].lqueue; if ((c == '\n') && (tport[port].tcan[can].bs)) continue; buffer[i++] = c; if (c == '\r') { --tport[port].tcan[can].nb_ret; break; } } buffer[i] = '\0'; tport[port].tcan[can].lpos = pos; return (i); } static int snd_tcp_ui(int port, char *buffer, int len, Beacon *ptr) { int i; int lg; char buf[1024]; char call[10]; char desti[120]; int sock_ui; struct sockaddr_in sock_addr; sock_addr.sin_family = AF_INET; sock_addr.sin_addr.s_addr = INADDR_ANY; sock_addr.sin_port = 0; sock_ui = socket(AF_INET, SOCK_DGRAM, 0); if (sock_ui < 0) { perror ("socket_ui"); return (0); } if (bind (sock_ui, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) != 0) { perror ("snd_tcp_ui : bind"); close (sock_ui); return (0); } sprintf(desti, "%s-%d", ptr->desti.call, ptr->desti.num); for (i = 0; i < ptr->nb_digi; i++) { strcat(desti, " "); sprintf(call, "%s-%d", ptr->digi[i].call, ptr->digi[i].num); strcat(desti, call); } sprintf(buf, "%d^%s-%d^%s^UI^F0^%d^", port, mycall, myssid, desti, len); lg = strlen(buf); memcpy(buf+lg, buffer, len); sock_addr.sin_family = AF_INET; sock_addr.sin_addr.s_addr = inet_addr(tport[port].rem_addr); sock_addr.sin_port = htons(tport[port].rem_port); lg = sendto(sock_ui, buf, lg+len, 0, (const struct sockaddr *)&sock_addr, sizeof (sock_addr)); close(sock_ui); if (lg < 0) { perror ("snd_tcp_ui:sendto"); return (0); } return(1); } static int rcv_tcp_ui(int port, char *buffer, int *len, ui_header * ui) { int nb; int lg; fd_set tcp_read; struct timeval to; struct sockaddr_in sock_addr; int addr_len = sizeof (sock_addr); char buf[1024]; char *ptr; char *p; if (tport[port].sock_ui == -1) return (0); to.tv_sec = to.tv_usec = 0; FD_ZERO (&tcp_read); FD_SET (tport[port].sock_ui, &tcp_read); nb = select (tport[port].sock_ui + 1, &tcp_read, NULL, NULL, &to); if (nb == -1) { perror ("select_ui"); return (0); } else if (nb == 0) { return (0); } nb = recvfrom(tport[port].sock_ui, buf, sizeof(buf), 0, (struct sockaddr *) &sock_addr, &addr_len); ptr = buf; /* remote port ignored */ lg = 0; p = ptr; while (*ptr != '^') { ++ptr; ++lg; --nb; } ++ptr; --nb; ui->port = port; /* from */ lg = 0; p = ptr; while (*ptr != '^') { ++ptr; ++lg; --nb; } n_cpy(lg, ui->from, p); ++ptr; --nb; /* to */ lg = 0; p = ptr; while (*ptr != '^') { if (*ptr == ' ') { /* Digis ... */ break; } ++ptr; ++lg; --nb; } n_cpy(lg, ui->to, p); ui->via[0] = '\0'; if (*ptr == ' ') { /* Digis ... */ ++ptr; --nb; lg = 0; p = ptr; while (*ptr != '^') { ++ptr; ++lg; --nb; } n_cpy(lg, ui->via, p); strcat(ui->via, " "); } ++ptr; --nb; /* ctrl */ lg = 0; p = ptr; while (*ptr != '^') { ++ptr; ++lg; --nb; } n_cpy(lg, ui->ctl, p); ui->ui = (strncmp("UI", p, 2) == 0); ++ptr; --nb; /* pid */ lg = 0; p = ptr; while (*ptr != '^') { ++ptr; ++lg; --nb; } sscanf(p, "%x", &ui->pid); ++ptr; --nb; /* len */ lg = 0; p = ptr; while (*ptr != '^') { ++ptr; ++lg; --nb; } lg = atoi(p); ++ptr; --nb; sprintf (ui->txt, " (%d)", lg); if (lg != nb) return 0; if (lg > 0) memcpy(buffer, ptr, lg); *len = lg; return lg; } fbb-7.04j/src/edit.c0100644000175100017510000003036107726646105012302 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #define RECSIZ 256 static char *fic (char *); static int cmd_edit (void); static int edit_find (char *); static int edit_replace (char *, char *); static int ouvre_temp (void); static void cree_temp (void); static void edit_insert (char *); static void edit_append (char *); static void edit_kill (int); static void edit_aff (int); static void kill_temp (void); static void prompt_edit (void); static void sauve_temp (void); int cmd_edit (void) { int c, nb, moins; char chaine1[300]; char chaine2[300]; char *pbuf; sup_ln (indd); while (*indd) { moins = 0; if (*indd == '+') ++indd; else if (*indd == '-') { moins = 1; ++indd; } if (isdigit (*indd)) { nb = 0; while (isdigit (*indd)) { nb *= 10; nb += (*indd++ - '0'); } } else nb = 1; if (moins) nb = -nb; c = *indd++; switch (toupper (c)) { case ' ': break; case '?': outln ("A,B,E,F,I,K,L,N,P,R,S,Q,?", 25); break; case 'A': pbuf = chaine1; while ((c = *indd++) != 0) { if (c == '\\') c = *indd++; else if (c == '/') break; *pbuf++ = c; } *pbuf = '\0'; if (pvoie->tete_edit.max == 0) edit_insert (chaine1); else edit_append (chaine1); break; case 'B': pvoie->tete_edit.ligne = 1; break; case 'E': pvoie->tete_edit.ligne = pvoie->tete_edit.max; if (pvoie->tete_edit.ligne < 1) pvoie->tete_edit.ligne = 1; break; case 'F': pbuf = chaine1; while ((c = *indd++) != 0) { if (c == '\\') c = *indd++; else if (c == '/') break; *pbuf++ = c; } *pbuf = '\0'; if (edit_find (chaine1) == 0) { texte (T_ERR + 0); return (1); } break; case 'I': pbuf = chaine1; while ((c = *indd++) != 0) { if (c == '\\') c = *indd++; else if (c == '/') break; *pbuf++ = c; } *pbuf = '\0'; edit_insert (chaine1); break; case 'K': edit_kill (nb); break; case 'L': pvoie->tete_edit.ligne += nb; if (pvoie->tete_edit.ligne < 1) pvoie->tete_edit.ligne = 1; if (pvoie->tete_edit.ligne > pvoie->tete_edit.max) pvoie->tete_edit.ligne = pvoie->tete_edit.max; break; case 'N': pvoie->tete_edit.numero = !pvoie->tete_edit.numero; break; case 'P': edit_aff (nb); break; case 'R': pbuf = chaine1; while ((c = *indd++) != 0) { if (c == '\\') c = *indd++; else if (c == '/') break; *pbuf++ = c; } *pbuf = '\0'; pbuf = chaine2; while ((c = *indd++) != 0) { if (c == '\\') c = *indd++; else if (c == '/') break; *pbuf++ = c; } *pbuf = '\0'; if (edit_replace (chaine1, chaine2) == 0) { texte (T_ERR + 0); return (1); } break; case 'S': sauve_temp (); break; case 'Q': libere_edit (voiecur); return (0); default: varx[0][0] = c; varx[0][1] = '\0'; texte (T_ERR + 1); return (1); } } return (1); } void prompt_edit (void) { outs ("EDIT>", 5); } int ouvre_temp (void) { int ftemp; char nom_temp[80]; sprintf (nom_temp, "TEMP_%d.$$$", voiecur); if ((ftemp = open (nom_temp, O_RDWR | O_BINARY)) == -1) fbb_error (ERR_OPEN, nom_temp, 1); return (ftemp); } void kill_temp (void) { char nom_temp[80]; sprintf (nom_temp, "TEMP_%d.$$$", voiecur); unlink (nom_temp); } static char *fic (char *nomfic) { char *ptr; if ((ptr = strrchr (nomfic, '\\')) != NULL) return (ptr + 1); else return (nomfic); } void libere_edit (int voie) { edit_ch *edit_temp, *ch_ptr; edit_temp = svoie[voie]->tete_edit.liste; while ((ch_ptr = edit_temp) != NULL) { edit_temp = edit_temp->suite; m_libere (ch_ptr, sizeof (edit_ch)); } svoie[voie]->tete_edit.liste = NULL; } void edit_aff (int nblig) { int ftemp, pos; edit_ch *edit_temp; char buffer[RECSIZ + 2]; char chaine[300]; ftemp = ouvre_temp (); edit_temp = pvoie->tete_edit.liste; pos = 1; while (edit_temp) { if (pos >= pvoie->tete_edit.ligne) { if (nblig-- <= 0) break; lseek (ftemp, RECSIZ * (long) edit_temp->record, 0); read (ftemp, buffer, RECSIZ); if (pvoie->tete_edit.numero) sprintf (chaine, "%03d %s", pos, buffer); else strcpy (chaine, buffer); outs (chaine, strlen (chaine)); } edit_temp = edit_temp->suite; ++pos; } close (ftemp); } void edit_kill (int nblig) { int ftemp, pos; edit_ch *edit_temp, *ch_deb = NULL, *ch_ptr; char buffer[RECSIZ + 2]; ftemp = ouvre_temp (); edit_temp = pvoie->tete_edit.liste; pos = 1; while (edit_temp) { if (pos == pvoie->tete_edit.ligne) break; ch_deb = edit_temp; edit_temp = edit_temp->suite; ++pos; } while (edit_temp) { if (nblig-- <= 0) break; lseek (ftemp, (long) RECSIZ * (long) edit_temp->record, 0); read (ftemp, buffer, RECSIZ); buffer[0] = '\0'; lseek (ftemp, (long) RECSIZ * (long) edit_temp->record, 0); write (ftemp, buffer, RECSIZ); ch_ptr = edit_temp; edit_temp = edit_temp->suite; m_libere (ch_ptr, sizeof (edit_ch)); --pvoie->tete_edit.max; } if (pvoie->tete_edit.ligne == 1) pvoie->tete_edit.liste = edit_temp; else ch_deb->suite = edit_temp; close (ftemp); } void edit_insert (char *chaine) { int ftemp, pos; char *ptr; edit_ch *edit_temp, *ch_deb; ftemp = ouvre_temp (); pos = 1; if (pvoie->tete_edit.ligne == 1) { ch_deb = pvoie->tete_edit.liste; edit_temp = pvoie->tete_edit.liste = (edit_ch *) m_alloue (sizeof (edit_ch)); } else { edit_temp = pvoie->tete_edit.liste; while (edit_temp) { if (pos == pvoie->tete_edit.ligne - 1) break; edit_temp = edit_temp->suite; ++pos; } ch_deb = edit_temp->suite; edit_temp->suite = (edit_ch *) m_alloue (sizeof (edit_ch)); edit_temp = edit_temp->suite; } edit_temp->suite = ch_deb; ptr = chaine; while (*ptr) ++ptr; *ptr++ = '\n'; *ptr = '\0'; lseek (ftemp, 0L, 2); edit_temp->record = (int) (tell (ftemp) / RECSIZ); write (ftemp, chaine, RECSIZ); close (ftemp); ++pvoie->tete_edit.max; } void edit_append (char *chaine) { int ftemp, pos; char *ptr; edit_ch *edit_temp, *ch_deb; ftemp = ouvre_temp (); pos = 1; edit_temp = pvoie->tete_edit.liste; while (edit_temp) { if (pos == pvoie->tete_edit.ligne) break; edit_temp = edit_temp->suite; ++pos; } if (edit_temp) { ch_deb = edit_temp->suite; edit_temp->suite = (edit_ch *) m_alloue (sizeof (edit_ch)); edit_temp = edit_temp->suite; } else { edit_temp = (edit_ch *) m_alloue (sizeof (edit_ch)); ch_deb = NULL; } edit_temp->suite = ch_deb; ptr = chaine; while (*ptr) ++ptr; *ptr++ = '\n'; *ptr = '\0'; lseek (ftemp, 0L, 2); edit_temp->record = (int) (tell (ftemp) / RECSIZ); write (ftemp, chaine, RECSIZ); close (ftemp); ++pvoie->tete_edit.max; ++pvoie->tete_edit.ligne; } int edit_find (char *chaine) { int ftemp, pos, ok = 0; edit_ch *edit_temp; char buffer[RECSIZ + 2]; ftemp = ouvre_temp (); edit_temp = pvoie->tete_edit.liste; pos = 1; while (edit_temp) { if (pos >= pvoie->tete_edit.ligne) { lseek (ftemp, RECSIZ * (long) edit_temp->record, 0); read (ftemp, buffer, RECSIZ); if (strstr (buffer, chaine)) { pvoie->tete_edit.ligne = pos; ok = 1; break; } } edit_temp = edit_temp->suite; ++pos; } close (ftemp); return (ok); } int edit_replace (char *avant, char *apres) { int ftemp, pos, ok = 0; edit_ch *edit_temp; char buffer[RECSIZ + 2]; char change[300]; char *ptr, *nptr, *cptr; ftemp = ouvre_temp (); edit_temp = pvoie->tete_edit.liste; pos = 1; while (edit_temp) { if (pos >= pvoie->tete_edit.ligne) { lseek (ftemp, RECSIZ * (long) edit_temp->record, 0); read (ftemp, buffer, RECSIZ); ptr = buffer; if ((cptr = strstr (buffer, avant)) != NULL) { pvoie->tete_edit.ligne = pos; nptr = change; while (ptr != cptr) *nptr++ = *ptr++; while (*apres) *nptr++ = *apres++; while (*avant) { ++avant; ++ptr; } while ((*nptr++ = *ptr++) != '\0'); if (strlen (change) > 256) { /* printf ("<>\n"); */ outln ("<>", 2); } else { lseek (ftemp, RECSIZ * (long) edit_temp->record, 0); write (ftemp, change, RECSIZ); } ok = 1; break; } } edit_temp = edit_temp->suite; ++pos; } close (ftemp); return (ok); } void cree_temp (void) { FILE *fptr; long nbcar = 0L; int ftemp, lg, pos; edit_ch *edit_temp; char buffer[RECSIZ + 2]; char nom_temp[80]; sprintf (nom_temp, "TEMP_%d.$$$", voiecur); if ((ftemp = open (nom_temp, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IREAD | S_IWRITE) ) == -1) fbb_error (ERR_CREATE, nom_temp, 2); pos = 0; pvoie->tete_edit.ligne = 1; pvoie->tete_edit.carac = 0; pvoie->tete_edit.liste = NULL; edit_temp = pvoie->tete_edit.liste; if ((fptr = fopen (pvoie->sr_fic, "rt")) != NULL) { while (fgets (buffer, RECSIZ + 2, fptr)) { if ((lg = strlen (buffer)) > RECSIZ) { #ifdef ENGLISH outln ("Line too long ! ", 19); #else outln ("Ligne trop longue !", 19); #endif break; } if ((lg) && (buffer[lg - 1] != '\n')) { buffer[lg] = '\n'; buffer[lg + 1] = '\0'; ++lg; } write (ftemp, buffer, RECSIZ); if (edit_temp) { edit_temp->suite = (edit_ch *) m_alloue (sizeof (edit_ch)); edit_temp = edit_temp->suite; } else { edit_temp = pvoie->tete_edit.liste = (edit_ch *) m_alloue (sizeof (edit_ch)); } edit_temp->suite = NULL; edit_temp->record = pos++; nbcar += (long) lg + 1; } fclose (fptr); pvoie->tete_edit.new_t = 0; } else pvoie->tete_edit.new_t = 1; pvoie->tete_edit.max = pos; close (ftemp); sprintf (buffer, "%s : %d/%ld", fic (pvoie->sr_fic), pos, nbcar + 1); outsln (buffer, strlen (buffer)); } void sauve_temp (void) { FILE *fptr; int ftemp, pos = 0; long nbcar = 0L; edit_ch *edit_temp; char buffer[RECSIZ + 2]; if (pvoie->tete_edit.new_t) pvoie->tete_edit.new_t = 2; if ((fptr = fopen (pvoie->sr_fic, "wt")) == NULL) fbb_error (ERR_CREATE, pvoie->sr_fic, 3); ftemp = ouvre_temp (); edit_temp = pvoie->tete_edit.liste; while (edit_temp) { lseek (ftemp, RECSIZ * (long) edit_temp->record, 0); read (ftemp, buffer, RECSIZ); fputs (buffer, fptr); nbcar += (long) strlen (buffer) + 1; ++pos; edit_temp = edit_temp->suite; } /* fputc ('\032', fptr); */ fclose (fptr); close (ftemp); wr_dir (pvoie->sr_fic, pvoie->sta.indicatif.call); sprintf (buffer, "%s : %d/%ld", fic (pvoie->sr_fic), pos, nbcar + 1); outsln (buffer, strlen (buffer)); } void edit (void) { char *ptr; pvoie->lignes = -1; switch (pvoie->niv3) { case 0: strtok (indd, " \r"); /* cprintf("Commande : <%s>\r\n", indd) ; */ if ((ptr = strtok (NULL, " \r")) == NULL) { texte (T_ERR + 20); } else { if (tst_point (ptr)) { if (aut_ecr (ch_slash (ptr), 1)) { pvoie->tete_edit.numero = 0; strcpy (pvoie->sr_fic, tot_path (ch_slash (ptr), pvoie->dos_path)); cree_temp (); prompt_edit (); ch_niv3 (1); break; } } } maj_niv (9, 0, 0); prompt_dos (); break; case 1: if (!cmd_edit ()) { kill_temp (); if (pvoie->tete_edit.new_t == 2) { ch_niv3 (2); texte (T_YAP + 3); break; } else { maj_niv (9, 0, 0); prompt_dos (); break; } } prompt_edit (); break; case 2: new_label (); maj_niv (9, 0, 0); prompt_dos (); break; } } fbb-7.04j/src/ems.c0100644000175100017510000004327607726646105012152 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Gestion de la memoire EMS/XMS * */ #include #ifdef __WIN32__ #define huge #endif #define CTRL_Z '\032' static int read_exms_record (int, unsigned, char *, unsigned, unsigned); static int realloc_bloc (int); static int select_bloc (char *); static int write_exms_record (int, unsigned, char *, unsigned, unsigned); #define EMS_VECT 0x67 #define MAX_BUFLIG 16 #define NB_BLOCK 4 #define NB_LIG (EMS_BLOC / sizeof(Ligne)) #ifdef __FBBDOS__ static Ligne *buf_ligne[MAX_BUFLIG]; #endif #define DIRMES_REC (EMS_BLOC / sizeof(bullist)) #define BID_REC (EMS_BLOC / BIDCOMP) #define WPG_REC (EMS_BLOC / sizeof(Wp)) #define REJ_REC (EMS_BLOC / sizeof(Rej_rec)) #define CHN_REC (EMS_BLOC / sizeof(Svoie)) static char *ems_ptr = NULL; Desc *desc; static FILE *dir_ptr = NULL; static int nb_dir = 0; /* Nombre de d'ouvertures DIRMES en cours */ static int exms = NO_MS; static int exms_pages = 0; /* Ecritures / Lectures de record */ void end_exms (void) { int file; int bloc; if (desc == NULL) return; for (file = 0; file < NB_EMS; file++) { for (bloc = 0; bloc < desc[file].max_bloc ; bloc++) { if (desc[file].alloc[bloc]) { free (desc[file].alloc[bloc]); desc[file].alloc[bloc] = NULL; } } } free (desc); desc = NULL; } int read_dirmes (unsigned record, bullist * pbul) { return (read_exms_record (DIRMES, record, (char *) pbul, sizeof (bullist), DIRMES_REC)); } int write_dirmes (unsigned record, bullist * pbul) { return (write_exms_record (DIRMES, record, (char *) pbul, sizeof (bullist), DIRMES_REC)); } int read_fwd (unsigned record, bullist * pbul) { return (read_exms_record (DIRMES, record, (char *) pbul, sizeof (bullist), DIRMES_REC)); } int write_fwd (unsigned record, bullist * pbul) { return (write_exms_record (DIRMES, record, (char *) pbul, sizeof (bullist), DIRMES_REC)); } int read_wp (unsigned record, Wp * wp) { return (read_exms_record (WPG, record, (char *) wp, sizeof (Wp), WPG_REC)); } int write_wp (unsigned record, Wp * wp) { return (write_exms_record (WPG, record, (char *) wp, sizeof (Wp), WPG_REC)); } int read_bid (unsigned record, char *pbul) { return (read_exms_record (WBID, record, (char *) pbul, BIDCOMP, BID_REC)); } int write_bid (unsigned record, char *pbul) { return (write_exms_record (WBID, record, (char *) pbul, BIDCOMP, BID_REC)); } int read_rej (unsigned record, Rej_rec * rej) { return (read_exms_record (REJET, record, (char *) rej, sizeof (Rej_rec), REJ_REC)); } int write_rej (unsigned record, Rej_rec * rej) { return (write_exms_record (REJET, record, (char *) rej, sizeof (Rej_rec), REJ_REC)); } static int read_exms_record (int file, unsigned record, char *ptr, unsigned size, unsigned nb_rec) { char *bloc; char *mptr; if (record >= desc[file].nb_records) { return (0); } bloc = desc[file].alloc[record / nb_rec]; if (bloc == NULL) return (0); deb_io (); select_bloc (bloc); mptr = ems_ptr + (record % nb_rec) * size; memcpy (ptr, mptr, size); fin_io (); return (size); } static int write_exms_record (int file, unsigned record, char *ptr, unsigned size, unsigned nb_rec) { char *bloc; char *mptr; int num_bloc = record / nb_rec; Desc *dsk = &desc[file]; if (record > dsk->nb_records) { return (0); } if (record == dsk->nb_records) ++(dsk->nb_records); while (num_bloc >= dsk->max_bloc) { int i; dsk->alloc = realloc(dsk->alloc, sizeof(char *) * (dsk->max_bloc+NB_BLOCK)); for (i = dsk->max_bloc ; i < dsk->max_bloc+NB_BLOCK ; i++) { dsk->alloc[i] = NULL; } dsk->max_bloc += NB_BLOCK; } bloc = dsk->alloc[num_bloc]; deb_io (); if (bloc == NULL) { if (!realloc_bloc (file)) { return (0); } bloc = dsk->alloc[num_bloc]; desc[file].size += (long) EMS_BLOC; } select_bloc (bloc); mptr = ems_ptr + (record % nb_rec) * size; memcpy (mptr, ptr, size); fin_io (); return (size); } char *new_bloc (int file) { realloc_bloc (file); desc[file].size += (long) EMS_BLOC; return (ems_ptr); } char *sel_bloc (int file, int numero) { if (desc[file].alloc[numero] != NULL) { select_bloc (desc[file].alloc[numero]); return (ems_ptr); } return (NULL); } void seek_exms_string (int file, long pos) { char *bloc; Desc *dsk = &desc[file]; dsk->pos = pos; dsk->num_bloc = (int) (pos / (long) EMS_BLOC); bloc = dsk->alloc[dsk->num_bloc]; if (bloc == NULL) return; select_bloc (bloc); dsk->nb = EMS_BLOC - (int) (pos % (long) EMS_BLOC); dsk->ptr = ems_ptr + (int) (pos % (long) EMS_BLOC); } long tell_exms_string (int file) { Desc *dsk = &desc[file]; return (dsk->pos); } int read_exms_string (int file, char *ptr) { int c; char *bloc; Desc *dsk = &desc[file]; int nbcar; char *mptr; bloc = dsk->alloc[dsk->num_bloc]; if (bloc == NULL) return (0); select_bloc (bloc); nbcar = dsk->nb; mptr = dsk->ptr; do { if (--nbcar == 0) { ++dsk->num_bloc; if (dsk->num_bloc == dsk->max_bloc) { int i; dsk->max_bloc += NB_BLOCK; dsk->alloc = realloc(dsk->alloc, sizeof(char *) * dsk->max_bloc); for (i = dsk->num_bloc ; i < dsk->max_bloc ; i++) { dsk->alloc[i] = NULL; } } bloc = dsk->alloc[dsk->num_bloc]; if (bloc == NULL) return (0); select_bloc (bloc); mptr = ems_ptr; nbcar = EMS_BLOC; } c = *mptr++; if (c == CTRL_Z) { --mptr; return (0); } *ptr++ = c; ++dsk->pos; } while (c); *ptr = '\0'; dsk->nb = nbcar; dsk->ptr = mptr; return (1); } int write_exms_string (int file, char *ptr) { int c; char *bloc; Desc *dsk = &desc[file]; int nbcar; char *mptr; bloc = dsk->alloc[dsk->num_bloc]; if (bloc == NULL) { if (!realloc_bloc (file)) return (0); bloc = dsk->alloc[dsk->num_bloc]; dsk->nb = EMS_BLOC; dsk->ptr = ems_ptr; desc[file].size += (long) EMS_BLOC; } select_bloc (bloc); nbcar = dsk->nb; mptr = dsk->ptr; do { if (--nbcar == 0) { ++dsk->num_bloc; if (dsk->num_bloc == dsk->max_bloc) { int i; dsk->max_bloc += NB_BLOCK; dsk->alloc = realloc(dsk->alloc, sizeof(char *) * dsk->max_bloc); for (i = dsk->num_bloc ; i < dsk->max_bloc ; i++) { dsk->alloc[i] = NULL; } } bloc = dsk->alloc[dsk->num_bloc]; if (bloc == NULL) { if (!realloc_bloc (file)) return (0); bloc = dsk->alloc[dsk->num_bloc]; dsk->nb = EMS_BLOC; dsk->ptr = ems_ptr; } select_bloc (bloc); mptr = ems_ptr; nbcar = EMS_BLOC; } c = *ptr++; *mptr++ = c; ++dsk->pos; } while (c); dsk->nb = nbcar; dsk->ptr = mptr; return (1); } static int select_bloc (char *bloc) { if (bloc == ems_ptr) return (1); if (bloc == NULL) return (0); deb_io (); ems_ptr = bloc; fin_io (); return (1); } static int realloc_bloc (int file) { char *mptr; ++exms_pages; mptr = ems_ptr = calloc (1, EMS_BLOC); if (mptr == NULL) { fbb_error (ERR_EXMS, "REALLOCATE: Error DPMI", 0); libere_xems (); return (0); } desc[file].alloc[desc[file].tot_bloc] = mptr; ++desc[file].tot_bloc; return (1); } void init_exms (void) { int i; int j; if (ems_aut) ems_aut = 2; desc = (Desc *) calloc (NB_EMS, sizeof (Desc)); if (desc == NULL) { ems_aut = 0; } for (i = 0; i < NB_EMS; i++) { desc[i].tot_bloc = 0; desc[i].num_bloc = 0; desc[i].nb_records = 0; desc[i].ptr = NULL; desc[i].nb = EMS_BLOC; desc[i].size = 0; desc[i].max_bloc = NB_BLOCK; desc[i].alloc = malloc(sizeof(char *) * desc[i].max_bloc); for (j = 0; j < NB_BLOCK; j++) desc[i].alloc[j] = NULL; } exms = NO_MS; if (ems_aut) { exms = XMS; exms_pages = 0; #ifdef ENGLISH if (!operationnel) cprintf ("%s Set-up \r\n", typ_exms ()); #else if (!operationnel) cprintf ("Initialise %s\r\n", typ_exms ()); #endif } else in_exms = 0; } #ifdef __WINDOWS__ /* * Routines specifiques Windows */ static HGLOBAL hMem; static int read_xms_bloc (unsigned page) { char huge *mptr; if (page == 0xffff) return (1); mptr = GlobalLock (hMem); if (mptr == 0) { fbb_error (ERR_EXMS, "Error WIN_READ", 0); return (0); } _fmemcpy (ems_ptr, mptr + ((long) page * (long) EMS_BLOC), EMS_BLOC); GlobalUnlock (hMem); return (1); } static int write_xms_bloc (unsigned page) { char huge *mptr; if (page == 0xffff) return (1); mptr = GlobalLock (hMem); if (mptr == NULL) { fbb_error (ERR_EXMS, "Error WIN_WRITE", 0); return (0); } _fmemcpy (mptr + ((long) page * (long) EMS_BLOC), ems_ptr, EMS_BLOC); GlobalUnlock (hMem); return (1); } static int xms_ok (void) { return (1); } static int alloue_xms (void) { hMem = GlobalAlloc (GMEM_MOVEABLE, EMS_BLOC); if (hMem == NULL) { fbb_error (ERR_EXMS, "ALLOCATE: Error WIN", 0); libere_xems (); } if (hMem) exms_pages = 0; return ((hMem != NULL)); } static int realloue_xms_page (void) { DWORD nb_bytes; deb_io (); ++exms_pages; nb_bytes = (long) exms_pages *(long) EMS_BLOC; hMem = GlobalReAlloc (hMem, nb_bytes, GMEM_MOVEABLE); FbbMem (); if (hMem == NULL) { fbb_error (ERR_EXMS, "REALLOCATE: Error WIN", 0); libere_xems (); return (0); } else return (1); } #endif char *typ_exms (void) { static char s[30]; if (exms == NO_MS) sprintf (s, "No high memory"); else { #ifdef __WINDOWS__ sprintf (s, "Windows virtual paged memory"); #elif __LINUX__ sprintf (s, "LINUX virtual paged memory"); #else sprintf (s, "DPMI virtual paged memory"); #endif } return (s); } int nb_ems_pages (void) { return (exms_pages); } void libere_xems (void) { /* Liberer les zones allouees !! */ exms = NO_MS; in_exms = 0; } void ouvre_dir (void) { ++nb_dir; if (!EMS_MSG_OK ()) { /* Pas d'EMS, on ouvre le fichier */ if (dir_ptr == NULL) dir_ptr = ouvre_dirmes (); } } void ferme_dir (void) { if (--nb_dir == 0) { if (dir_ptr) ferme (dir_ptr, 45); dir_ptr = NULL; } } #define ECRIT 1 #define LIT 2 unsigned length_dir (void) { if (EMS_MSG_OK ()) return (desc[DIRMES].nb_records); fseek (dir_ptr, 0L, SEEK_END); return ((unsigned) (ftell (dir_ptr) / (long) sizeof (bullist))); } int read_dir (unsigned record, bullist * pbul) { if (EMS_MSG_OK ()) return (read_dirmes (record, pbul)); fseek (dir_ptr, (long) record * sizeof (bullist), SEEK_SET); return (fread (pbul, sizeof (bullist), 1, dir_ptr)); } int write_dir (unsigned record, bullist * pbul) { if (dir_ptr == NULL) dir_ptr = ouvre_dirmes (); if (EMS_MSG_OK ()) { /* if (operationnel) printf("Ecrit record %u offset %d Max %u\n", record, offset, nb_record); */ if (!write_dirmes (record, pbul)) in_exms &= (~EMS_MSG); } fseek (dir_ptr, (long) record * sizeof (bullist), SEEK_SET); return (fwrite (pbul, sizeof (bullist), 1, dir_ptr)); } /* Gestion des BIDs */ int where_exms_bid (char *bid) { char *bloc; int page; register int i; register int nb_bid; register char *ptr = NULL; char t_bid[BIDCOMP]; memcpy (t_bid, comp_bid (bid), BIDCOMP); page = 0; nb_bid = BID_REC; for (i = 0; i < maxbbid; i++) { if (nb_bid == BID_REC) { bloc = desc[WBID].alloc[page]; select_bloc (bloc); nb_bid = 0; ptr = ems_ptr; /* dprintf("cherche dans page virtuelle %d, reelle %d\r\n", page, bloc); */ ++page; } if (strncmp (ptr, t_bid, BIDCOMP) == 0) { return (i + 1); } ptr += BIDCOMP; ++nb_bid; } return (0); } void tst_exms_bid (bullist * fb_mess, int nb, int *t_res) { int j; char *bloc; int page; register int i; register int nb_bid; register char *ptr = NULL; char t_bid[BIDCOMP]; for (j = 0; j < nb; j++) { if ((t_res[j]) || (*fb_mess[j].bid == '\0')) continue; memcpy (t_bid, comp_bid (fb_mess[j].bid), BIDCOMP); page = 0; nb_bid = BID_REC; deb_io (); fin_io (); /* Pour laisser un peu de temps aux autres ! */ for (i = 0; i < maxbbid; i++) { if (nb_bid == BID_REC) { bloc = desc[WBID].alloc[page]; select_bloc (bloc); nb_bid = 0; ptr = ems_ptr; ++page; } if (strncmp (ptr, t_bid, BIDCOMP) == 0) { t_res[j] = 1; break; } ptr += BIDCOMP; ++nb_bid; } } } void delete_exms_bid (int pos) { int j; char *bloc; int page; register int i; register int nb_bid; register char *ptr = NULL; page = 0; --pos; nb_bid = BID_REC; for (i = 0; i < maxbbid; i++) { if (nb_bid == BID_REC) { bloc = desc[WBID].alloc[page]; select_bloc (bloc); nb_bid = 0; ptr = ems_ptr; ++page; } if (pos == i) { for (j = 0; j < BIDCOMP; j++, *ptr++ = '\0'); break; } ptr += BIDCOMP; ++nb_bid; } } void init_exms_bid (FILE * fptr) { int i; #ifdef __FBBDOS__ int page = 0; #endif int nb_bid = BID_REC; bidfwd fwbuf; for (i = 0; i < maxbbid; i++) { if (nb_bid == BID_REC) { #if defined(__WINDOWS__) || defined(__LINUX__) char buf[80]; InitText (itoa (i, buf, 10)); #else cprintf ("\rPage %d", page++); #endif nb_bid = 0; } fread (&fwbuf, sizeof (bidfwd), 1, fptr); write_bid (i, comp_bid (fwbuf.fbid)); ++nb_bid; } #if defined(__WINDOWS__) || defined(__LINUX__) { char buf[80]; InitText (itoa (i, buf, 10)); } #else cprintf ("\rPage %d", page); #endif } #ifdef __WINDOWS__ /* Rien sous Windows */ #elif __DPMI16__ static Ligne *current_line (int bloc, int off) { unsigned offset; char *page; char *mptr; static Ligne ligne; page = desc[SCREEN].alloc[bloc]; offset = (unsigned) off *sizeof (Ligne); mptr = page; if (mptr == NULL) { fbb_error (ERR_EXMS, "Error DPMI_READ", 0); return (NULL); } memcpy (&ligne, mptr + offset, sizeof (Ligne)); return (&ligne); } Ligne *sel_scr (FScreen * screen, int lig) { int bloc; int off; lig += screen->first; off = lig % NB_LIG; bloc = lig / NB_LIG; if (EMS_SCR_OK ()) { return (current_line (bloc, off)); } else { return (&(buf_ligne[bloc][off])); } } void wr_scr (FScreen * screen, Ligne * ligne, int lig) { unsigned offset; int bloc; int off; char *page; char *mptr; if ((!EMS_SCR_OK ()) || (exms != XMS)) return; lig += screen->first; off = lig % NB_LIG; bloc = lig / NB_LIG; page = desc[SCREEN].alloc[bloc]; offset = (unsigned) off *sizeof (Ligne); mptr = page; if (mptr == NULL) { fbb_error (ERR_EXMS, "Error DPMI_WRITE", 0); return; } memcpy (mptr + offset, ligne, sizeof (Ligne)); } void alloue_screen (int nb_lignes) { int i; int nb; if (nb_lignes == 0) return; #ifdef ENGLISH cprintf ("Allocating screen buffers\r\n"); #else cprintf ("Alloue les buffers cran \r\n"); #endif if (EMS_SCR_OK ()) { for (i = 0;; i++) { nb = (nb_lignes > NB_LIG) ? NB_LIG : nb_lignes; realloc_bloc (SCREEN); desc[SCREEN].size += (long) EMS_BLOC; nb_lignes -= nb; if (nb_lignes == 0) break; } } else { for (i = 0; i < MAX_BUFLIG; i++) { nb = (nb_lignes > NB_LIG) ? NB_LIG : nb_lignes; buf_ligne[i] = (Ligne *) calloc (nb, sizeof (Ligne)); nb_lignes -= nb; if (nb_lignes == 0) break; } } } #endif unsigned search_wp_record (lcall icall, int what, unsigned first_record) { unsigned record; unsigned max; char *bloc; int page; register int nb_wp_page; register Wp *wp = NULL; max = desc[WPG].nb_records; nb_wp_page = WPG_REC; page = 0; if (what == USR_CALL) { for (record = first_record; record < max; record++) { if (nb_wp_page == WPG_REC) { deb_io (); fin_io (); /* Pour laisser un peu de temps aux autres ! */ bloc = desc[WPG].alloc[page]; select_bloc (bloc); nb_wp_page = 0; wp = (Wp *) ems_ptr; /* dprintf("cherche dans page virtuelle %d, reelle %d\r\n", page, bloc); */ ++page; } if (wp->callsign == icall) { return (record); } ++wp; ++nb_wp_page; } } else if (what == BBS_CALL) { for (record = first_record; record < max; record++) { if (nb_wp_page == WPG_REC) { deb_io (); fin_io (); /* Pour laisser un peu de temps aux autres ! */ bloc = desc[WPG].alloc[page]; select_bloc (bloc); nb_wp_page = 0; wp = (Wp *) ems_ptr; ++page; } if ((wp->callsign == icall) && (wp->home == icall)) { return (record); } ++wp; ++nb_wp_page; } } return (0xffff); } int high_memory_type (void) { return (exms); } unsigned xms_free (void) { return (256); } void load_dirmes (void) { FILE *fptr; int page = 0; #ifdef __FBBDOS__ fen *fen_ptr; #endif bullist bull; int record = 0; if (!EMS_MSG_OK ()) return; deb_io (); #ifdef __FBBDOS__ fen_ptr = open_win (10, 5, 50, 8, INIT, "Messages"); #endif fptr = ouvre_dirmes (); while (fread (&bull, sizeof (bullist), 1, fptr)) { /* printf("Entre le %ld, record %d\n", bull.numero, record); */ if (!write_dirmes (record, &bull)) { in_exms &= (~EMS_MSG); break; } if ((record++ % DIRMES_REC) == 0) { #if defined(__WINDOWS__) || defined(__LINUX__) char buf[80]; sprintf (buf, "Page %d", page); InitText (buf); #else cprintf ("\rPage %d", page); #endif page++; } } ferme (fptr, 56); #ifdef __FBBDOS__ sleep_ (1); close_win (fen_ptr); #endif fin_io (); } fbb-7.04j/src/epurmess.c0100644000175100017510000010156307726646105013223 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #define ENGLISH #include #include #include #include #include #include #include #include #ifdef __LINUX__ #include #else #include #include #include #include #endif #include #include "version.h" #define DEBUG 1 #define TRUE 1 #define FALSE 0 #ifdef ENGLISH #define EXPI "Expi" #define ARCH "Arch" #define LECT "Read" #define SUPP "Kill" #define DETR "Dest" #else #define EXPI "Expi" #define ARCH "Arch" #define LECT "Lect" #define SUPP "Supp" #define DETR "Detr" #endif #ifdef __LINUX__ #define _read read #define _write write #define O_BINARY 0 #define __a2__ __attribute__ ((packed, aligned(2))) #define stricmp strcasecmp #define strcmpi strcasecmp #define strnicmp strncasecmp #define strncmpi strncasecmp #else #define __a2__ #endif char cdate[80]; long numtot, numenr, nomess, numsup, numarc, nbtot; long nbp, nbb; char mycall[7], expediteur[7], destinataire[7]; char mypath[80]; long mdate; #define MAX_RENUM (14L * 0x10000L) #define DEL_RENUM (MAX_RENUM - 0x20000L) #define NBBBS 80 #define NBMASK NBBBS/8 #define LGFREE 5 typedef struct { /* Longueur = 194 octets */ char type; char status; long numero __a2__; long taille __a2__; long date __a2__; char bbsf[7]; char bbsv[41]; char exped[7]; char desti[7]; char bid[13]; char titre[61]; char bin; char free[5]; long grpnum __a2__; unsigned short nblu; long theme __a2__; long datesd __a2__; long datech __a2__; char fbbs[NBMASK]; char forw[NBMASK]; } bullist; typedef struct typ_serlist { char nom[7]; char delai; struct typ_serlist *suiv; } deslist; typedef struct { long pn; long py; long pf; long px; long pk; long bn; long by; long bf; long bx; long bk; long bd; long rt; long rr; } param; #define NB_AUTOMESS 2 int auto_mess[NB_AUTOMESS]; char text_rt[NB_AUTOMESS][256]; char mail_in[80]; char callsign[40]; int nb_return_lines; void aff_status (bullist *); void change_defauts (param *, bullist *); int copy_ (char *, char *); void defauts (void); void ent_arch (FILE *, bullist *); void entete_liste (void); void erreur_arg (int); void init_liste (char *, int); void message_retour (int, bullist *, long); void newname (char *, char *); void print_compte_rendu (void); char *date_mbl_new (long); char *strdt (long); int semaine (void); int is_route (char *fbbs); deslist *tete_exped, *tete_route, *tete_desti; int *tabrec; char dirmes_sys[257]; char dirmes_old[257]; char dirmes_new[257]; char compte_rendu[257]; char old_mail[257]; char mail[257]; char binmail[257]; int archive_p, archive_b; int old_format; int ext_call = 0; long heure; param max, def; FILE *fptr, *dptr; extern long timezone; #ifdef __LINUX__ char *strupr (char *str) { char *tmp = str; while (*tmp) { if (islower (*tmp)) *tmp = toupper (*tmp); ++tmp; } return str; } char *back2slash (char *str) { char *tmp = str; while (*tmp) { if (isupper (*tmp)) *tmp = tolower (*tmp); if (*tmp == '\\') *tmp = '/'; ++tmp; } return str; } #endif char *test_back_slash (char *chaine) { if ((strlen(chaine) == 0) #ifdef __LINUX__ || (chaine[strlen (chaine) - 1] != '/')) strcat(chaine, "/"); #else || (chaine[strlen (chaine) - 1] != '\\')) strcat(chaine, "\\"); #endif return (chaine); } void err_keyword(char *keyword) { fprintf(stderr, "Error : keyword \"%s\" missing in fbb.conf file\n", keyword); exit(1); } void epure (char *ligne) { int lg; lg = strlen (ligne); if (ligne[lg - 1] == '\n') ligne[lg - 1] = '\0'; lg = strlen (ligne); if (ligne[lg - 1] == '\r') ligne[lg - 1] = '\0'; if (*ligne == '\032') *ligne = '\0'; } static int fbb_unlink (char *filename) { int ret = unlink (filename); return (ret); } int main (int ac, char **av) { int i; char s[257]; char old_name[257]; char new_name[257]; char bin_name[257]; char buffer[257]; int ecrit, unite; bullist entete; long record; FILE *fcr, *fpti, *fpto; long minimum; long maximum; int renum = 0; old_format = 0; tete_exped = tete_route = tete_desti = NULL; for (i = 0; i < NB_AUTOMESS; i++) auto_mess[i] = 0; #ifdef LETTRE printf ("Epurmess V %d.%02d%c\n\n", MAJEUR, MINEUR, LETTRE); #else printf ("Epurmess V %d.%02d\n\n", MAJEUR, MINEUR); #endif for (i = 1; i < ac; i++) { if (strnicmp ("/O", av[i], 2) == 0) { old_format = 1; printf ("Archive in old format\n"); } } defauts (); if (access (dirmes_sys, 0)) { fprintf (stderr, "Cannot find %s\n", dirmes_sys); exit (0); } heure = time (NULL); minimum = heure - (10L * 12L * 30L * 24L * 3600L); maximum = heure + (10L * 12L * 30L * 24L * 3600L); if ((fcr = fopen (compte_rendu, "rt")) != NULL) { if (fread (s, 80, 1, fcr)) { fclose (fcr); if ((heure - atol (s)) > 864000L) { fcr = fopen (compte_rendu, "wt"); #ifdef ENGLISH fprintf (fcr, "0\n\n"); fprintf (fcr, "EPURMESS was not done because your last EPURMESS was done more than 24h ago. \n\n"); fprintf (fcr, "Please verify the system clock!!!\n\n"); fprintf (fcr, "Kill this file (%s) to validate EPURMESS. \n", compte_rendu); printf ("Last update > 24h. EPURMESS was not done. \n"); #else fprintf (fcr, "0\n\n"); fprintf (fcr, "EPURMESS n'a pas t valid car la dernire mise a jour remonte plus de 24h.\n\n"); fprintf (fcr, "Vrifiez votre horloge !!! \n\n"); fprintf (fcr, "Supprimer ce fichier (%s) pour revalider EPURMESS.\n", compte_rendu); printf ("Date de dernire mise jour > 24h. EPURMESS non effectu.\n"); #endif fclose (fcr); exit (1); } } else fclose (fcr); } #ifdef ENGLISH printf ("%s - Saves dirmes.sys file into dirmes.old file \n\n", date_mbl_new (time (NULL))); #else printf ("%s - Sauvegarde du fichier dirmes.sys en dirmes.old\n\n", date_mbl_new (time (NULL))); #endif if (!copy_ (dirmes_sys, dirmes_old)) { #ifdef ENGLISH printf ("%s - Cannot save dirmes.sys file into dirmes.old file !! \n\n", date_mbl_new (time (NULL))); #else printf ("%s - Sauvegarde du fichier dirmes.sys en dirmes.old impossible !!\n\n", date_mbl_new (time (NULL))); #endif } if ((fptr = fopen (dirmes_sys, "rb")) == NULL) { #ifdef ENGLISH printf ("Cannot open '%s' \n", dirmes_sys); #else printf ("Erreur ouverture '%s'\n", dirmes_sys); #endif exit (1); } if ((dptr = fopen (dirmes_new, "wb")) == NULL) { exit (1); } nbp = nbb = numtot = numenr = numsup = numarc = 0L; entete_liste (); if (fread (&entete, sizeof (bullist), 1, fptr) == 0) { #ifdef ENGLISH printf ("Error while reading file '%s'\n", dirmes_sys); #else printf ("Erreur lecture fichier '%s' \n", dirmes_sys); #endif exit (1); } if (entete.numero > MAX_RENUM) { renum = 1; entete.numero -= DEL_RENUM; } if (fwrite (&entete, sizeof (bullist), 1, dptr) == 0) { #ifdef ENGLISH printf ("Error while writting file '%s'\n", dirmes_new); #else printf ("Erreur ecriture fichier '%s' \n", dirmes_new); #endif exit (1); } record = 1L; strcpy (mycall, entete.exped); while (1) { ecrit = 1; if (fread (&entete, sizeof (bullist), 1, fptr) == 0) break; entete.bbsf[6] = '\0'; entete.bbsv[40] = '\0'; entete.exped[6] = '\0'; entete.desti[6] = '\0'; entete.bid[12] = '\0'; entete.titre[60] = '\0'; if (renum) { if ((entete.numero - DEL_RENUM) < 1L) { entete.status = 'A'; } } memset (entete.free, '\0', LGFREE); unite = (unsigned int) (entete.numero % 10); if (entete.type == '\0') { #ifdef __LINUX__ sprintf (old_name, "%smail%d/m_%06ld.mes", mail, unite, entete.numero); sprintf (bin_name, "%smail%d/m_%06ld.mes", binmail, unite, entete.numero); #else sprintf (old_name, "%sMAIL%d\\M_%06ld.MES", mail, unite, entete.numero); sprintf (bin_name, "%sMAIL%d\\M_%06ld.MES", binmail, unite, entete.numero); #endif fbb_unlink (old_name); fbb_unlink (bin_name); continue; } aff_status (&entete); def = max; change_defauts (&def, &entete); if ((entete.datech < minimum) || (entete.datech > maximum)) entete.status = 'A'; if ((entete.date < minimum) || (entete.date > maximum)) entete.status = 'A'; if ((entete.datesd < minimum) || (entete.datesd > maximum)) entete.datesd = entete.date; /* Message erronne */ if ((entete.taille > 10000000L) || (entete.taille < 0)) entete.status = 'A'; if (entete.datech > heure) entete.datech = heure; if (entete.date > heure) entete.date = heure; #ifdef __LINUX__ sprintf (old_name, "%smail%d/m_%06ld.mes", mail, unite, entete.numero); sprintf (bin_name, "%smail%d/m_%06ld.mes", binmail, unite, entete.numero); #else sprintf (old_name, "%sMAIL%d\\M_%06ld.MES", mail, unite, entete.numero); sprintf (bin_name, "%sMAIL%d\\M_%06ld.MES", binmail, unite, entete.numero); #endif if ((entete.type == 'P') && (entete.status == 'N') && (*entete.bbsv)) { if (!is_route (entete.fbbs) && (def.rr) && (heure - entete.date >= def.rr)) { message_retour (1, &entete, heure); entete.status = 'A'; } else if (!is_route (entete.forw) && (def.rt) && (heure - entete.date >= def.rt)) { message_retour (0, &entete, heure); entete.status = 'A'; } } if ((entete.type == 'A') && (entete.status != 'N')) { /* Destruction immediate */ printf (DETR); fbb_unlink (old_name); fbb_unlink (bin_name); ++numsup; ecrit = 0; } else if ((entete.type == 'P') || (entete.type == 'A')) { if ((entete.status == '$') && (heure - entete.datech >= def.bd)) { entete.status = 'X'; entete.datech = heure; fbb_unlink (bin_name); printf (EXPI); } if ((entete.status == 'N') && (heure - entete.datech >= def.pn)) { entete.status = 'X'; entete.datech = heure; fbb_unlink (bin_name); printf (EXPI); } if ((entete.status == 'Y') && (heure - entete.datech >= def.py)) { entete.status = 'X'; entete.datech = heure; fbb_unlink (bin_name); printf (EXPI); } if ((entete.status == 'F') && (heure - entete.datech >= def.pf)) { entete.status = 'K'; entete.datech = heure; fbb_unlink (bin_name); printf (SUPP); } if ((entete.status == 'X') && (heure - entete.datech >= def.px)) { entete.status = 'K'; entete.datech = heure; fbb_unlink (bin_name); printf (SUPP); } if ((entete.status == 'K') && (heure - entete.datech >= def.pk)) { entete.status = 'A'; entete.datech = heure; } if (entete.status == 'A') { /* Archivage immediat */ fbb_unlink (bin_name); if (archive_p) { sprintf (new_name, "%sPRIV.%02d", old_mail, semaine ()); if ((fpto = fopen (new_name, "at")) != NULL) { ent_arch (fpto, &entete); if ((fpti = fopen (old_name, "rt")) != NULL) { while (fgets (buffer, 256, fpti)) { fputs (buffer, fpto); } fclose (fpti); } fprintf (fpto, "\n/EX\n"); fclose (fpto); } printf (ARCH); ++numarc; } else { printf (DETR); ++numsup; } fbb_unlink (old_name); ecrit = 0; } if (ecrit) ++nbp; } else { if ((entete.status == 'N') && (heure - entete.datech >= def.bn)) { entete.status = 'X'; entete.datech = heure; fbb_unlink (bin_name); printf (EXPI); } if ((entete.status == '$') && (heure - entete.datech >= def.bd)) { entete.status = 'X'; entete.datech = heure; fbb_unlink (bin_name); printf (EXPI); } if ((entete.status == 'Y') && (heure - entete.datech >= def.by)) { entete.status = 'X'; entete.datech = heure; fbb_unlink (bin_name); printf (EXPI); } if ((entete.status == 'F') && (heure - entete.datech >= def.bf)) { entete.status = 'K'; entete.datech = heure; fbb_unlink (bin_name); printf (SUPP); } if ((entete.status == 'X') && (heure - entete.datech >= def.bx)) { entete.status = 'K'; entete.datech = heure; fbb_unlink (bin_name); printf (SUPP); } if ((entete.status == 'K') && (heure - entete.datech >= def.bk)) { entete.status = 'A'; entete.datech = heure; } if (entete.status == 'A') { /* Archivage immediat */ fbb_unlink (bin_name); if (archive_b) { sprintf (new_name, "%sBULL.%02d", old_mail, semaine ()); if ((fpto = fopen (new_name, "at")) != NULL) { ent_arch (fpto, &entete); if ((fpti = fopen (old_name, "rt")) != NULL) { while (fgets (buffer, 256, fpti)) fputs (buffer, fpto); fclose (fpti); } fprintf (fpto, "\n/EX\n"); fclose (fpto); } printf (ARCH); ++numarc; } else { printf (DETR); ++numsup; } fbb_unlink (old_name); ecrit = 0; } if (ecrit) ++nbb; } if (ecrit) { ++numtot; if (entete.status != 'K') ++numenr; ++record; } if (ecrit) { if (renum) { char ren_name[257]; entete.numero -= DEL_RENUM; unite = (unsigned int) (entete.numero % 10); #ifdef __LINUX__ sprintf (ren_name, "%smail%d/m_%06ld.mes", mail, unite, entete.numero); #else sprintf (ren_name, "%sMAIL%d\\M_%06ld.MES", mail, unite, entete.numero); #endif /* delete the binary file */ unlink (bin_name); /* rename the ascii file */ newname (old_name, ren_name); } if (fwrite (&entete, sizeof (bullist), 1, dptr) == 0) { #ifdef ENGLISH printf ("Error while writting file '%s'\n", dirmes_old); #else printf ("Erreur ecriture fichier '%s' \n", dirmes_old); #endif exit (1); } } putchar ('\n'); } putchar ('\n'); fclose (dptr); fclose (fptr); #ifdef ENGLISH printf ("Saves into dirmes.old - Copies dirmes.new into dirmes.sys \n"); #else printf ("Sauvegarde dans dirmes.old - Recopie dirmes.new dans dirmes.sys\n"); #endif if (!copy_ (dirmes_new, dirmes_sys)) { #ifdef ENGLISH printf ("%s - Cannot save dirmes.new file into dirmes.sys file !! \n\n", date_mbl_new (time (NULL))); #else printf ("%s - Sauvegarde du fichier dirmes.new en dirmes.sys impossible !!\n\n", date_mbl_new (time (NULL))); #endif } print_compte_rendu (); return (0); } void print_compte_rendu () { FILE *fcr; #ifdef ENGLISH printf ("\n"); printf ("File cleared : %4ld private message(s) \n", nbp); printf (" : %4ld bulletin message(s) \n", nbb); printf (" : %4ld active message(s) \n", numenr); printf (" : %4ld killed message(s) \n", numtot - numenr); printf (" : %4ld total message(s) \n", numtot); printf (" : %4ld archived message(s) \n", numarc); printf (" : %4ld destroyed message(s) \n", numsup); printf (" : %4d Timed-out message(s) \n", auto_mess[0]); printf (" : %4d No-Route message(s) \n\n", auto_mess[1]); if ((fcr = fopen (compte_rendu, "wt")) != NULL) { fprintf (fcr, "%ld\n\n", heure); fprintf (fcr, "File cleared : %4ld private message(s) \n", nbp); fprintf (fcr, " : %4ld bulletin message(s) \n", nbb); fprintf (fcr, " : %4ld active message(s) \n", numenr); fprintf (fcr, " : %4ld killed message(s) \n", numtot - numenr); fprintf (fcr, " : %4ld total message(s) \n", numtot); fprintf (fcr, " : %4ld archived message(s) \n", numarc); fprintf (fcr, " : %4ld destroyed message(s) \n", numsup); fprintf (fcr, " : %4d Timed-out message(s) \n", auto_mess[0]); fprintf (fcr, " : %4d No-Route message(s) \n\n", auto_mess[1]); fprintf (fcr, "Start computing : %s\n", strdt (heure)); fprintf (fcr, "End computing : %s\n", strdt (time (NULL))); fclose (fcr); } #else printf ("\n"); printf ("Fichier pur : %4ld message(s) priv(s) \n", nbp); printf (" : %4ld message(s) bulletin(s)\n", nbb); printf (" : %4ld message(s) actif(s) \n", numenr); printf (" : %4ld message(s) supprim(s)\n", numtot - numenr); printf (" : %4ld message(s) total \n", numtot); printf (" : %4ld message(s) archiv(s) \n", numarc); printf (" : %4ld message(s) dtruit(s) \n", numsup); printf (" : %4d message(s) oubli(s) \n", auto_mess[0]); printf (" : %4d message(s) sans route \n\n", auto_mess[1]); if (fcr = fopen (compte_rendu, "wt")) { fprintf (fcr, "%ld\n\n", heure); fprintf (fcr, "Fichier pur : %4ld message(s) priv(s) \n", nbp); fprintf (fcr, " : %4ld message(s) bulletin(s)\n", nbb); fprintf (fcr, " : %4ld message(s) actif(s) \n", numenr); fprintf (fcr, " : %4ld message(s) supprim(s)\n", numtot - numenr); fprintf (fcr, " : %4ld message(s) total \n", numtot); fprintf (fcr, " : %4ld message(s) archiv(s) \n", numarc); fprintf (fcr, " : %4ld message(s) dtruit(s) \n", numsup); fprintf (fcr, " : %4d message(s) oubli(s) \n", auto_mess[0]); fprintf (fcr, " : %4d message(s) sans route \n\n", auto_mess[1]); fprintf (fcr, "Debut du traitement : %s\n", strdt (heure)); fprintf (fcr, "Fin du traitement : %s\n", strdt (time (NULL))); fclose (fcr); } #endif } void change_defauts (param * def, bullist * bull) { deslist *lptr; lptr = tete_exped; while (lptr) { if (strcmp (lptr->nom, bull->exped) == 0) { def->bf = def->bx = def->pf = def->px = (long) lptr->delai * 86400L; break; } lptr = lptr->suiv; } lptr = tete_route; while (lptr) { if (strcmp (lptr->nom, bull->bbsv) == 0) { def->bf = def->bx = def->pf = def->px = (long) lptr->delai * 86400L; break; } lptr = lptr->suiv; } lptr = tete_desti; while (lptr) { if (strcmp (lptr->nom, bull->desti) == 0) { def->bf = def->bx = def->pf = def->px = (long) lptr->delai * 86400L; break; } lptr = lptr->suiv; } } void entete_liste (void) { #ifdef ENGLISH printf ("Act Msg# TS Dim. To @ BBS From Date Datexp Subject\n"); #else printf ("Act Msg# TS Dim. Pour @ BBS Exp. Date Datexp Sujet \n"); #endif } char *bbs_via (char *s) { int nb = 0; static char bbs[80]; while ((*s) && (*s != '.')) { if (nb == 6) break; bbs[nb++] = *s++; } bbs[nb] = '\0'; return (bbs); } void aff_status (bullist * ligne) { int i; char *ptri, *ptro; char bbs_v[42], date[40], datech[40], titre[21]; if (*(ligne->bbsv)) sprintf (bbs_v, "@%-6s", bbs_via (ligne->bbsv)); else *bbs_v = '\0'; strcpy (datech, date_mbl_new (ligne->datech)); strcpy (date, date_mbl_new (ligne->date)); ptri = ligne->titre; ptro = titre; for (i = 0; i < 20; i++) { if (*ptri == '\0') break; if (*ptri == '\a') *ptro = ' '; else *ptro = *ptri; ++ptri; ++ptro; } *ptro = '\0'; #ifdef ENGLISH printf ("Read %6ld %c%c %5ld %-6s%7s %-6s %-6s %s %1.19s\r", #else printf ("Lect %6ld %c%c %5ld %-6s%7s %-6s %-6s %s %1.19s\r", #endif ligne->numero, ligne->type, ligne->status, ligne->taille, ligne->desti, bbs_v, ligne->exped, date, datech, titre); } int find (char *s) { char *t = s; int n = 0; int dernier = 0, chiffre = 0, lettre = 0; while (*t) { if (!isalnum (*t)) return (FALSE); *t = toupper (*t); dernier = (isdigit (*t)); if (isdigit (*t)) ++chiffre; else ++lettre; ++t; ++n; } if (ext_call) { /* * L'indicatif doit avoir entre 3 et 6 caracteres . * doit contenir au moins un chiffre * doit contenir au moins une lettre */ if ((n < 3) || (n > 6) || (chiffre < 1) || (lettre < 1)) return (0); } else { /* * L'indicatif doit avoir entre 3 et 6 caracteres . * doit contenir 1 ou 2 chiffres . * ne doit pas se terminer par un chiffre . */ if ((n < 3) || (n > 6) || (chiffre < 1) || (chiffre > 2) || dernier) return (0); } return (1); } char *date_mbl_new (long temps) { struct tm *sdate; static char cdate[40]; sdate = localtime (&temps); #ifdef ENGLISH sprintf (cdate, "%02d-%02d-%02d", sdate->tm_year % 100, sdate->tm_mon + 1, sdate->tm_mday); #else sprintf (cdate, "%02d/%02d/%02d", sdate->tm_mday, sdate->tm_mon + 1, sdate->tm_year % 100); #endif return (cdate); } char *strdt (long temps) { struct tm *sdate; static char cdate[80]; sdate = localtime (&temps); #ifdef ENGLISH sprintf (cdate, "%02d-%02d-%02d %02d:%02d", sdate->tm_year % 100, sdate->tm_mon + 1, sdate->tm_mday, sdate->tm_hour, sdate->tm_min); #else sprintf (cdate, "%02d/%02d/%02d %02d:%02d", sdate->tm_mday, sdate->tm_mon + 1, sdate->tm_year % 100, sdate->tm_hour, sdate->tm_min); #endif return (cdate); } void defauts (void) { int i; unsigned int flag; int init = 1; int nolig, lig; FILE *fptr; char c_path[256]; char ligne[258]; char str[80]; static char tzlig[80]; char *ptr; char temp[20]; if (read_fbb_conf(NULL) > 0) { #ifdef ENGLISH fprintf (stderr, "Cannot open fbb.conf file \n"); #else fprintf (stderr, "Erreur ouverture fichier fbb.conf\n"); #endif exit (1); /* and users base directory */ } ptr = find_fbb_conf("vers", 0); if (ptr == NULL) { #ifdef ENGLISH fprintf (stderr, "Version number missing in fbb.conf\n"); #else fprintf (stderr, "Pas de numro dans le fbb.conf\n"); #endif exit (1); } sprintf (temp, "FBB%d.%02d", MAJEUR, MINEUR); /* Only test the major number ... */ if (strncasecmp (temp, ptr, 4) != 0) { #ifdef ENGLISH fprintf (stderr, "Wrong version number in fbb.conf\n"); #else fprintf (stderr, "Numro de version erron dans fbb.conf\n"); #endif exit (1); } fprintf (stderr, "Configuration version : %s\r\n", ptr); ptr = find_fbb_conf("call", 0); if (ptr == NULL) err_keyword("call"); strcpy (callsign, strupr (ptr)); strcpy (mypath, strupr (ptr)); if ((ptr = strchr (callsign, '.')) != NULL) *ptr = '\0'; #ifdef ENGLISH fprintf (stderr, "Callsign : %s\n", callsign); fprintf (stderr, "Address : %s\n", mypath); #else fprintf (stderr, "Indicatif : %s\n", callsign); fprintf (stderr, "Addresse : %s\n", mypath); #endif /* Mail.in */ ptr = find_fbb_conf("impo", 0); if (ptr == NULL) ptr = def_fbb_conf("impo"); if (ptr == NULL) err_keyword("impo"); strcpy (mail_in, strupr (ptr)); #ifdef __LINUX__ back2slash (mail_in); #endif #ifdef ENGLISH fprintf (stderr, "MAIL.IN file : %s\n", mail_in); #else fprintf (stderr, "fichier MAIL.IN: %s\n", mail_in); #endif /* path of conf files */ ptr = find_fbb_conf("conf", 0); if (ptr == NULL) ptr = def_fbb_conf("conf"); if (ptr == NULL) err_keyword("conf"); strcpy (c_path, test_back_slash(ptr)); #ifdef ENGLISH fprintf (stderr, "Conf directory : %s\n", c_path); #else fprintf (stderr, "Configuration : %s\n", c_path); #endif /* flags */ ptr = find_fbb_conf("fbbf", 0); if (ptr == NULL) ptr = def_fbb_conf("fbbf"); if (ptr == NULL) err_keyword("fbbf"); flag = 0; sscanf (ptr, "%s %u", str, &flag); ext_call = ((flag & 4096) != 0); /* diff GMT */ ptr = find_fbb_conf("loca", 0); if (ptr == NULL) ptr = def_fbb_conf("loca"); if (ptr == NULL) err_keyword("loca"); #ifdef ENGLISH fprintf (stderr, "GMT difference : %d\n", atoi (ptr)); #else fprintf (stderr, "Diffrence GMT : %d\n", atoi (ptr)); #endif if (getenv ("TZ") == NULL) { sprintf (tzlig, "TZ=XXX%d", -atoi (ptr)); putenv (tzlig); } tzset (); /* get timezone info */ putchar ('\n'); sleep (2); lig = nolig = 0; sprintf(ligne, "%sepurmess.ini", c_path); #ifdef __LINUX__ if ((fptr = fopen (ligne, "r")) != NULL) #else if ((fptr = fopen (ligne, "rt")) != NULL) #endif { while (fgets (ligne, 256, fptr)) { epure (ligne); nolig++; if ((*ligne == '#') || (*ligne == '\0') || (*ligne == '\032')) continue; lig++; if ((lig < 20) && (lig > 21)) strupr (ligne); if (init) { switch (lig) { case 1: strcpy (mail, ligne); #ifdef __LINUX__ back2slash (mail); #endif break; case 2: strcpy (binmail, ligne); #ifdef __LINUX__ back2slash (binmail); #endif break; case 3: strcpy (old_mail, ligne); #ifdef __LINUX__ back2slash (old_mail); #endif break; case 4: strcpy (dirmes_sys, ligne); #ifdef __LINUX__ back2slash (dirmes_sys); #endif break; case 5: strcpy (dirmes_old, ligne); #ifdef __LINUX__ back2slash (dirmes_old); #endif break; case 6: strcpy (dirmes_new, ligne); #ifdef __LINUX__ back2slash (dirmes_new); #endif break; case 7: strcpy (compte_rendu, ligne); #ifdef __LINUX__ back2slash (compte_rendu); #endif break; case 8: archive_p = archive_b = 1; sscanf (ligne, "%d %d", &archive_p, &archive_b); break; case 9: max.pn = atol (ligne) * 86400L; break; case 10: max.py = atol (ligne) * 86400L; break; case 11: max.pf = atol (ligne) * 86400L; break; case 12: max.px = atol (ligne) * 86400L; break; case 13: max.pk = atol (ligne) * 86400L; break; case 14: max.bn = atol (ligne) * 86400L; break; case 15: max.bd = atol (ligne) * 86400L; break; case 16: max.by = atol (ligne) * 86400L; break; case 17: max.bx = atol (ligne) * 86400L; break; case 18: max.bf = atol (ligne) * 86400L; break; case 19: max.bk = atol (ligne) * 86400L; break; case 20: sscanf (ligne, "%ld %[^\n]", &max.rt, text_rt[0]); if (max.rt == 0) *text_rt[0] = '\0'; max.rt *= 86400L; break; case 21: sscanf (ligne, "%ld %[^\n]", &max.rr, text_rt[1]); if (max.rr == 0) *text_rt[1] = '\0'; max.rr *= 86400L; break; case 22: nb_return_lines = atoi (ligne); break; case 23: if (*ligne != '-') erreur_arg (nolig); init = 0; break; default: erreur_arg (nolig); break; } } else { if (*ligne == '-') break; init_liste (ligne, nolig); } } for (i = 0; i < NB_AUTOMESS; i++) { char *ptri; char *ptro; ptri = ptro = text_rt[i]; while (*ptri) { if ((*ptri == '$') && (*(ptri + 1) == 'W')) { *ptro = '\n'; ++ptri; } else *ptro = *ptri; ++ptri; ++ptro; } *ptro = '\0'; } } else { #ifdef ENGLISH fprintf (stderr, "Cannot open EPURMESS.INI file \n"); #else fprintf (stderr, "Error ouverture fichier EPURMESS.INI\n"); #endif exit (1); } } void init_liste (char *ligne, int nolig) { char nom[80]; int temps; int init = 0; char mode[80]; deslist *lptr = tete_desti; if (sscanf (ligne, "%s %s %d", mode, nom, &temps) != 3) erreur_arg (nolig); switch (toupper (*mode)) { case 'F': case '<': lptr = tete_exped; if (lptr == NULL) { tete_exped = lptr = malloc (sizeof (deslist)); init = 1; } break; case 'V': case '@': lptr = tete_route; if (lptr == NULL) { tete_route = lptr = malloc (sizeof (deslist)); init = 1; } break; case 'T': case '>': lptr = tete_desti; if (lptr == NULL) { tete_desti = lptr = malloc (sizeof (deslist)); init = 1; } break; default: erreur_arg (nolig); break; } if (init == 0) { while (lptr->suiv) lptr = lptr->suiv; lptr->suiv = malloc (sizeof (deslist)); lptr = lptr->suiv; } lptr->suiv = NULL; strncpy (lptr->nom, nom, 6); lptr->nom[6] = '\0'; lptr->delai = temps; } #if 0 void copy_ (char *oldfich, char *newfich) { char s[256]; #ifdef __LINUX__ sprintf (s, "cp %s %s > /dev/null", oldfich, newfich); #else sprintf (s, "copy %s %s", oldfich, newfich); #endif system (s); } #endif #define TAIBUF 16384 /* static char buffer[TAIBUF]; */ int copy_ (char *oldfich, char *newfich) { int retour = 1; int fd_orig; int fd_dest; int nb_lus; int ret; int dest_access; char *buffer; buffer = malloc (TAIBUF); if (buffer == NULL) return (0); if ((fd_orig = open (oldfich, O_RDONLY | O_BINARY, S_IREAD | S_IWRITE)) == EOF) { fprintf (stderr, "Cannot find %s\n", oldfich); free (buffer); return (0); } dest_access = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY; if ((fd_dest = open (newfich, dest_access, S_IREAD | S_IWRITE)) == EOF) { close (fd_orig); fprintf (stderr, "Cannot create %s\n", newfich); free (buffer); return (0); } for (;;) { nb_lus = _read (fd_orig, buffer, TAIBUF); if (nb_lus == -1) { retour = 0; break; } if (nb_lus == 0) { retour = 1; break; } ret = _write (fd_dest, buffer, nb_lus); if (ret != nb_lus) { retour = 0; break; } } close (fd_orig); close (fd_dest); free (buffer); return (retour); } void newname (char *oldfich, char *newfich) { rename (oldfich, newfich); } int is_route (char *fbbs) { int i; for (i = 0; i < NBMASK; i++) if (fbbs[i]) return (1); return (0); } void erreur_arg (int numero) { #ifdef ENGLISH printf ("Error EPURMESS.INI in line Nb %d \n", numero); #else printf ("Erreur fichier EPURMESS.INI ligne N%d\n", numero); #endif exit (1); } int semaine (void) { long temps = time (NULL); struct tm *sdate = localtime (&temps); #if 0 int ny = sdate->tm_yday - 1; int nw = sdate->tm_wday; int first_day; if (nw == 0) nw = 6; else --nw; if (ny <= nw) first_day = nw - ny; else first_day = 7 - ((ny - nw) % 7); return ((((ny + first_day) / 7) % 52) + 1); #endif int ny = sdate->tm_yday; /* Numero du jour dans l'annee */ int nw = sdate->tm_wday; /* Numero du jour dans la semaine */ if (nw == 0) nw = 6; else --nw; /* 0 = dimanche -> 0 = lundi */ if (ny < nw) /* Premiere semaine de l'annee ? */ { temps -= (3600L * 24L * (ny + 1)); sdate = localtime (&temps); ny = sdate->tm_yday; /* Numero du jour de l'annee precedente */ nw = sdate->tm_wday; /* Numero du jour de la semaine avant */ if (nw == 0) nw = 6; else --nw; /* 0 = dimanche -> 0 = lundi */ } return ((7 - nw + ny) / 7); } void ent_arch (FILE * fptr, bullist * pm) { char bbsv[80]; long temps = pm->date; struct tm *sdate = gmtime (&temps); if (old_format) { fprintf (fptr, "Msg #%ld Type:%c Stat:%c To:%s@%s From:%s Date:%s \n", pm->numero, pm->type, pm->status, pm->desti, pm->bbsv, pm->exped, strdt (pm->date)); fprintf (fptr, "Bid: %s Subject: %s\n", pm->bid, pm->titre); } else { if (*pm->bbsv) sprintf (bbsv, " @ %s", pm->bbsv); else *bbsv = '\0'; fprintf (fptr, "S%c %s%s < %s $%s\n", pm->type, pm->desti, bbsv, pm->exped, pm->bid); fprintf (fptr, "%s\n", pm->titre); } fprintf (fptr, "R:%02d%02d%02d/%02d%02dZ @:%s\n", sdate->tm_year % 100, sdate->tm_mon + 1, sdate->tm_mday, sdate->tm_hour, sdate->tm_min, mypath); } void message_retour (int num_txt, bullist * entete, long heure) { FILE *mess; FILE *fptr; int unite; int i; int nrl; char bbs[42]; char ligne[256]; char *scan; /* printf("\nDemande de message %d\n", num_txt); printf("Message = <%s>\n", text_rt[num_txt]); sleep(5); */ if (*text_rt[num_txt] == '\0') return; if (num_txt >= NB_AUTOMESS) return; nrl = nb_return_lines; *bbs = '\0'; ++auto_mess[num_txt]; unite = entete->numero % 10; sprintf (ligne, "%sMAIL%d\\M_%06ld.MES", mail, unite, entete->numero); if ((mess = fopen (ligne, "rt")) == NULL) { return; } while (fgets (ligne, 256, mess)) { if (strncmp (ligne, "R:", 2) != 0) break; scan = ligne; while ((*scan) && (*scan != '@')) ++scan; ++scan; if (*scan == ':') ++scan; i = 0; while (isgraph (*scan)) { bbs[i] = toupper (*scan); ++scan; if (++i == 40) break; } bbs[i] = '\0'; } if (*bbs == '\0') strcpy (bbs, callsign); if ((fptr = fopen (mail_in, "at")) != NULL) { fprintf (fptr, "SP %s @ %s < %s\n", entete->exped, bbs, callsign); fprintf (fptr, "Undelivered mail in %s\n\n", callsign); fprintf (fptr, "%s BBS, %s%s", callsign, ctime (&heure), text_rt[num_txt]); fprintf (fptr, "\n\nSP %s @ %s < %s\n", entete->desti, entete->bbsv, entete->exped); fprintf (fptr, "%s\n", entete->titre); while (fgets (ligne, 256, mess)) { if (nrl-- <= 0) break; if (strncmpi (ligne, "/ACK", 4) != 0) fputs (ligne, fptr); } fprintf (fptr, "/EX\n"); } fclose (fptr); fclose (mess); } fbb-7.04j/src/epurwp.c0100644000175100017510000004227507726646105012706 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #define ENGLISH /* * Mise a jour des WP en fonction de la date * */ #include #include #include #include #include #include #ifdef __LINUX__ #include #include #else #include #include #endif #include #include "version.h" #ifdef __LINUX__ #define __a2__ __attribute__ ((packed, aligned(2))) #define O_BINARY 0 #define _read read #define _write write #else #define __a2__ #endif #define uchar unsigned char #define lcall unsigned long typedef struct { /* 194 bytes */ char callsign[7]; char name[13]; uchar free; uchar changed; unsigned short seen; long last_modif __a2__; long last_seen __a2__; char first_homebbs[41]; char secnd_homebbs[41]; char first_zip[9]; char secnd_zip[9]; char first_qth[31]; char secnd_qth[31]; } Wps; lcall zone[1000]; int addr_check = 1; int ext_call = 0; unsigned deb_zone; long tst_date; long kill_date; long heure; long record = 0L; long lines_out = 0L; long record_in = 0L; long record_out = 0L; long update = 0L; long destroy = 0L; long dupes = 0L; Wps rec; char wp_sys[256]; char wp_old[256]; char wp_mess[256]; char upd_file[256]; char compte_rendu[256]; void defauts (int, int); void print_compte_rendu (void); void strn_cpy (char *, char *, int); void init_zone (long); void add_zone (Wps *); char *date_mbl_new (long); char *strdt (long); void wp_message (Wps *); lcall call2l (char *); int addr_ok (char *s); int find (char *); int copy_ (char *, char *); int check_record (Wps * rec); FILE *fpti; FILE *fpto; FILE *fptr_mess; FILE *fptr_upd; #ifdef __LINUX__ char *strupr (char *str) { char *tmp = str; while (*tmp) { if (islower (*tmp)) *tmp = toupper (*tmp); ++tmp; } return str; } char *strlwr (char *str) { char *tmp = str; while (*tmp) { if (isupper (*tmp)) *tmp = tolower (*tmp); ++tmp; } return str; } long filelength (int fd) { struct stat st; int val; val = fstat (fd, &st); if (val == -1) return (-1L); return (st.st_size); } #endif char *test_back_slash (char *chaine) { if ((strlen(chaine) == 0) #ifdef __LINUX__ || (chaine[strlen (chaine) - 1] != '/')) strcat(chaine, "/"); #else || (chaine[strlen (chaine) - 1] != '\\')) strcat(chaine, "\\"); #endif return (chaine); } void err_keyword(char *keyword) { fprintf(stderr, "Error : keyword \"%s\"missing in fbb.conf file\n", keyword); exit(1); } void epure (char *ligne) { int lg; lg = strlen (ligne); if (ligne[lg - 1] == '\n') ligne[lg - 1] = '\0'; lg = strlen (ligne); if (ligne[lg - 1] == '\r') ligne[lg - 1] = '\0'; if (*ligne == '\032') *ligne = '\0'; } int main (int ac, char **av) { int status; int jours = 40; int obsolete = 90; int deb_zone = 0xffff; *upd_file = '\0'; if ((ac >= 2) && (strcmp (strupr (av[1]), "/H") == 0)) { #ifdef LETTRE fprintf (stderr, "\nEPURWP V %d.%02d%c\n", MAJEUR, MINEUR, LETTRE); #else fprintf (stderr, "\nEPURWP V %d.%02d\n", MAJEUR, MINEUR); #endif fprintf (stderr, "format : EPURWP [upd-days [kill-days [update-file]]]\n"); fprintf (stderr, "defaults: upd-days = 40\n kill-days= 90\n\n"); fprintf (stderr, "If temporary part is stable during \"upd-days\" days,\n"); fprintf (stderr, "temporary part updates main part of WP\n\n"); fprintf (stderr, "If the callsign is not seen during \"kill-days\" days,\n"); fprintf (stderr, "callsign is deleted from WP database\n\n"); fprintf (stderr, "\"update-file\" stores the WP records corresponding to the\n"); fprintf (stderr, "updates in a file which can be processed later (eg for statistics)\n\n"); exit (0); } if (strncmp (strupr (av[ac - 1]), "/NOC", 4) == 0) { addr_check = 0; --ac; } if (ac >= 2) jours = atoi (av[1]); if (ac >= 3) obsolete = atoi (av[2]); if (ac >= 4) strcpy (upd_file, av[3]); /* if (ac >= 4) deb_zone = (unsigned)atoi(av[3]) * 1000; */ #ifdef LETTRE fprintf (stderr, "\nEpurwp V %d.%02d%c\n\n", MAJEUR, MINEUR, LETTRE); #else fprintf (stderr, "\nEpurwp V %d.%02d\n\n", MAJEUR, MINEUR); #endif heure = time (NULL); defauts (jours, obsolete); #ifdef ENGLISH fprintf (stderr, "Updating white pages database \n"); fprintf (stderr, " Update time is %d days\n", jours); if (obsolete) fprintf (stderr, " Delete time is %d days\n\n", obsolete); #else fprintf (stderr, "Mise jour de la base de donnes\n"); fprintf (stderr, " Dlai : %d jours\n", jours); if (obsolete) fprintf (stderr, " Suppression : %d jours\n\n", obsolete); #endif if ((fptr_mess = fopen (wp_mess, "at")) == NULL) { #ifdef ENGLISH fprintf (stderr, "Cannot create '%s' \n", wp_mess); #else fprintf (stderr, "Erreur creation '%s'\n", wp_mess); #endif exit (1); } #ifdef ENGLISH fprintf (stderr, "%s - Saves WP.SYS file into WP.OLD file \n\n", date_mbl_new (time (NULL))); #else fprintf (stderr, "%s - Sauvegarde du fichier WP.SYS en WP.OLD\n\n", date_mbl_new (time (NULL))); #endif if (!copy_ (wp_sys, wp_old)) { unlink (wp_old); exit (2); } if ((fpti = fopen (wp_old, "rb")) == NULL) { #ifdef ENGLISH fprintf (stderr, "Cannot open '%s' \n", wp_old); #else fprintf (stderr, "Erreur ouverture '%s'\n", wp_old); #endif exit (3); } if ((fpto = fopen (wp_sys, "wb")) == NULL) { #ifdef ENGLISH fprintf (stderr, "Cannot open '%s' \n", wp_sys); #else fprintf (stderr, "Erreur ouverture '%s'\n", wp_sys); #endif exit (4); } if (*upd_file) { if ((fptr_upd = fopen (upd_file, "ab")) == NULL) { #ifdef ENGLISH fprintf (stderr, "Cannot open '%s' \n", upd_file); #else fprintf (stderr, "Erreur ouverture '%s'\n", upd_file); #endif exit (5); } } else fptr_upd = NULL; init_zone (filelength (fileno (fpti)) / (long) sizeof (Wps)); while (fread (&rec, sizeof (Wps), 1, fpti)) { status = check_record (&rec); if (record_in >= deb_zone) add_zone (&rec); if (status == 2) ++update; if (status) { if (fwrite (&rec, sizeof (Wps), 1, fpto) == 0) { #ifdef ENGLISH fprintf (stderr, "Error while writting file '%s'\n", wp_sys); #else fprintf (stderr, "Erreur ecriture fichier '%s' \n", wp_sys); #endif exit (1); } ++record_out; } else if (rec.last_modif) ++destroy; if ((*rec.callsign) && ((++record % 100) == 0)) fprintf (stderr, "\rRecord %ld", record); ++record_in; } #if 0 memset (&rec, '\0', sizeof (Wps)); while (record_out < record_in) { fseek (fpto, record_out * sizeof (Wps), SEEK_SET); if (fwrite (&rec, sizeof (Wps), 1, fpto) == 0) { #ifdef ENGLISH fprintf (stderr, "Error while writting file '%s'\n", wp_sys); #else fprintf (stderr, "Erreur ecriture fichier '%s' \n", wp_sys); #endif exit (1); } ++record_out; } #endif if (fptr_upd) fclose (fptr_upd); fclose (fpti); fclose (fpto); fclose (fptr_mess); fprintf (stderr, "\rRecord %ld\n\n", record); print_compte_rendu (); return (0); } void init_zone (long lg) { int i; long nbbloc = (lg / 1000L) + 1L; if (deb_zone == 0xffff) deb_zone = 1000 * (unsigned) (heure % nbbloc); /* printf("%ld records, %ld blocs, heure = %ld zone = %u\n", lg, nbbloc, heure, deb_zone); */ for (i = 0; i < 1000; i++) zone[i] = 0L; } int is_dupe (Wps * rec) { lcall lc; int i; lc = call2l (rec->callsign); for (i = 0; i < 1000; i++) { if (lc == zone[i]) { ++dupes; fprintf (stderr, "\rRecord %ld (%s) duplicated\n", record, rec->callsign); return (1); } } return (0); } void add_zone (Wps * rec) { static int index = 0; if (index == 1000) return; zone[index++] = call2l (rec->callsign); } int check_record (Wps * rec) { int modif = 1; rec->callsign[6] = '\0'; rec->name[12] = '\0'; rec->first_homebbs[40] = '\0'; rec->secnd_homebbs[40] = '\0'; rec->first_zip[8] = '\0'; rec->secnd_zip[8] = '\0'; rec->first_qth[30] = '\0'; rec->secnd_qth[30] = '\0'; if ((!find (rec->callsign)) || (*rec->first_homebbs == '\0') || (*rec->first_homebbs == '?')) return (0); if ((addr_check) && (!addr_ok (rec->first_homebbs))) { return (0); } if (is_dupe (rec)) return (0); if (rec->last_seen < kill_date) { /* Entree obsolete */ return (0); } if (rec->last_modif < tst_date) { /* Mise a jour */ if (strncmp (rec->first_homebbs, rec->secnd_homebbs, 40) != 0) { strn_cpy (rec->first_homebbs, rec->secnd_homebbs, 40); modif = 2; } if (strncmp (rec->first_zip, rec->secnd_zip, 8) != 0) { strn_cpy (rec->first_zip, rec->secnd_zip, 8); modif = 2; } if (strncmp (rec->first_qth, rec->secnd_qth, 30) != 0) { strn_cpy (rec->first_qth, rec->secnd_qth, 30); modif = 2; } } if (rec->changed) { wp_message (rec); rec->changed = 0; } return (modif); } void print_compte_rendu (void) { FILE *fcr; #ifdef ENGLISH printf ("\n"); printf ("WP updated : %5ld total records \n", record); printf (" : %5ld updated record(s) \n", update); printf (" : %5ld deleted record(s) \n", destroy); printf (" : %5ld WP update line(s) \n\n", lines_out); if ((fcr = fopen (compte_rendu, "wt")) != NULL) { fprintf (fcr, "%ld\n\n", heure); fprintf (fcr, "WP updated : %5ld total record(s) \n", record); fprintf (fcr, " : %5ld updated record(s) \n", update); fprintf (fcr, " : %5ld deleted records(s) \n", destroy); fprintf (fcr, " : %5ld WP update line(s) \n\n", lines_out); fprintf (fcr, "Start computing : %s\n", strdt (heure)); fprintf (fcr, "End computing : %s\n", strdt (time (NULL))); fclose (fcr); } #else printf ("\n"); printf ("Pages Blanches : %5ld enregistrement(s)\n", record); printf (" : %5ld mise(s) jour \n", update); printf (" : %5ld suppression(s) \n", destroy); printf (" : %5ld lignes de m.a.j. \n\n", lines_out); if ((fcr = fopen (compte_rendu, "wt")) != NULL) { fprintf (fcr, "%ld\n\n", heure); fprintf (fcr, "Pages Blanches : %5ld enregistrement(s)\n", record); fprintf (fcr, " : %5ld mise(s) jour \n", update); fprintf (fcr, " : %5ld suppression(s) \n", destroy); fprintf (fcr, " : %5ld lignes de m.a.j. \n\n", lines_out); fprintf (fcr, "Debut du traitement : %s\n", strdt (heure)); fprintf (fcr, "Fin du traitement : %s\n", strdt (time (NULL))); fclose (fcr); } #endif } void defauts (int jours, int obsolete) { int lig; unsigned int flag; char *ptr; char system_dir[256]; char temp[20]; lig = 0; if (read_fbb_conf(NULL) > 0) { #ifdef ENGLISH fprintf (stderr, "Cannot open fbb.conf file \n"); #else fprintf (stderr, "Erreur ouverture fichier fbb.conf\n"); #endif exit (1); /* and users base directory */ } ptr = find_fbb_conf("vers", 0); if (ptr == NULL) { #ifdef ENGLISH fprintf (stderr, "Version number missing in fbb.conf\n"); #else fprintf (stderr, "Pas de numro dans le fbb.conf\n"); #endif exit (1); } sprintf (temp, "FBB%d.%02d", MAJEUR, MINEUR); /* Only test the major number ... */ if (strncasecmp (temp, ptr, 4) != 0) { #ifdef ENGLISH fprintf (stderr, "Wrong version number in fbb.conf\n"); #else fprintf (stderr, "Numro de version erron dans fbb.conf\n"); #endif exit (1); } fprintf (stderr, "Configuration version : %s\r\n", ptr); /* path of conf files */ ptr = find_fbb_conf("data", 0); if (ptr == NULL) ptr = def_fbb_conf("data"); if (ptr == NULL) err_keyword("data"); strcpy (system_dir, test_back_slash(strlwr (ptr))); /* flags */ ptr = find_fbb_conf("fbbf", 0); if (ptr == NULL) ptr = def_fbb_conf("fbbf"); if (ptr == NULL) err_keyword("fbbf"); flag = 0; sscanf (ptr, "%s %u", temp, &flag); ext_call = ((flag & 4096) != 0); #ifdef __LINUX__ sprintf (wp_sys, "%swp/wp.sys", system_dir); sprintf (wp_old, "%swp/wp.old", system_dir); sprintf (wp_mess, "%swp/mess.wp", system_dir); strcpy (compte_rendu, "epurwp.res"); #else sprintf (wp_sys, "%sWP\\WP.SYS", system_dir); sprintf (wp_old, "%sWP\\WP.OLD", system_dir); sprintf (wp_mess, "%sWP\\MESS.WP", system_dir); strcpy (compte_rendu, "EPURWP.RES"); #endif tst_date = heure - (long) jours *86400L; kill_date = heure - (long) obsolete *86400L; } char *strdt (long temps) { struct tm *sdate; static char cdate[80]; sdate = localtime (&temps); #ifdef ENGLISH sprintf (cdate, "%02d-%02d-%02d %02d:%02d", sdate->tm_year % 100, sdate->tm_mon + 1, sdate->tm_mday, sdate->tm_hour, sdate->tm_min); #else sprintf (cdate, "%02d/%02d/%02d %02d:%02d", sdate->tm_mday, sdate->tm_mon + 1, sdate->tm_year % 100, sdate->tm_hour, sdate->tm_min); #endif return (cdate); } char *date_mbl_new (long temps) { struct tm *sdate; static char cdate[40]; sdate = localtime (&temps); #ifdef ENGLISH sprintf (cdate, "%02d-%02d-%02d", sdate->tm_year % 100, sdate->tm_mon + 1, sdate->tm_mday); #else sprintf (cdate, "%02d/%02d/%02d", sdate->tm_mday, sdate->tm_mon + 1, sdate->tm_year % 100); #endif return (cdate); } void strn_cpy (char *dest, char *source, int len) { for (;;) { if ((len-- == 0) || (*source == '\0')) break; *dest++ = *source++; } *dest = '\0'; } int find (char *s) { char *t = s; int n = 0; int dernier = 0, chiffre = 0, lettre = 0; while (isalnum (*t)) { *t = toupper (*t); dernier = (isdigit (*t)); if (isdigit (*t)) ++chiffre; else ++lettre; ++t; ++n; } *t = '\0'; if (ext_call) { /* * L'indicatif doit avoir entre 3 et 6 caracteres . * doit contenir au moins un chiffre * doit contenir au moins une lettre */ if ((n < 3) || (n > 6) || (chiffre < 1) || (lettre < 1)) return (0); } else { /* * L'indicatif doit avoir entre 3 et 6 caracteres . * doit contenir 1 ou 2 chiffres . * ne doit pas se terminer par un chiffre . */ if ((n < 3) || (n > 6) || (chiffre < 1) || (chiffre > 2) || dernier) return (0); } return (1); } static char *wp_date_mbl (long temps) { struct tm *sdate; static char cdate[7]; sdate = localtime (&temps); sprintf (cdate, "%02d%02d%02d", sdate->tm_year % 100, sdate->tm_mon + 1, sdate->tm_mday); return (cdate); } void wp_message (Wps * rec) { if (fptr_upd) { fwrite (rec, sizeof (Wps), 1, fptr_upd); } if ((rec->changed == 'U') || (rec->changed == 'G') || (rec->changed == 'I')) { fprintf (fptr_mess, "On %s %s/%c @ %s zip %s %s %s\n", wp_date_mbl (rec->last_modif), rec->callsign, rec->changed, (*rec->secnd_homebbs) ? rec->secnd_homebbs : "?", (*rec->secnd_zip) ? rec->secnd_zip : "?", (*rec->name) ? rec->name : "?", (*rec->secnd_qth) ? rec->secnd_qth : "?" ); ++lines_out; } } #if 0 int copy_ (char *oldfich, char *newfich) { char s[256]; #ifdef __LINUX__ sprintf (s, "cp %s %s > /dev/null", oldfich, newfich); #else sprintf (s, "COPY %s %s > NUL", oldfich, newfich); #endif system (s); return (1); } #endif #define TAIBUF 16384 static char buffer[TAIBUF]; int copy_ (char *oldfich, char *newfich) { int retour = 1; int fd_orig; int fd_dest; int nb_lus; int ret; int dest_access; if ((fd_orig = open (oldfich, O_RDONLY | O_BINARY, S_IREAD | S_IWRITE)) == EOF) { fprintf (stderr, "Cannot find %s\n", oldfich); return (0); } dest_access = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY; if ((fd_dest = open (newfich, dest_access, S_IREAD | S_IWRITE)) == EOF) { close (fd_orig); fprintf (stderr, "Cannot create %s\n", newfich); return (0); } for (;;) { nb_lus = _read (fd_orig, buffer, TAIBUF); if (nb_lus == -1) { retour = 0; break; } if (nb_lus == 0) { retour = 1; break; } ret = _write (fd_dest, buffer, nb_lus); if (ret != nb_lus) { retour = 0; break; } } close (fd_orig); close (fd_dest); return (retour); } lcall call2l (char *callsign) { register char *ptr = callsign; register int c; lcall val = 0L; while ((c = (int) *ptr++) != 0) { if (c < 48) return (0xffffffffL); c -= 47; if (c > 10) { c -= 7; if (c > 36) { return (0xffffffffL); } else if (c < 11) { return (0xffffffffL); } } val *= 37; val += c; } return (val); } int addr_ok (char *s) { int nb = 0; int total = 0; while (*s) { if (*s == '.') { nb = 0; } else { if (nb == 6) { return (0); } ++nb; } ++s; if (++total == 31) return (0); } return (1); } fbb-7.04j/src/error.c0100644000175100017510000001004007726646105012476 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #undef fopen /* * Writes an error message in ERROR.SYS file * * Do not Overlay ! * */ static int error_type = 0; static int erreur = 0; void boot_prg (void) { FILE *fichier; if ((fichier = fopen ("ERROR.SYS", "a+")) != NULL) { #ifdef ENGLISH fprintf (fichier, "> *** System boot on %s *** \n", strdate (time (NULL))); #else fprintf (fichier, "> *** Boot systeme le %s ***\n", strdate (time (NULL))); #endif fclose (fichier); } } void err_alloc (unsigned numero) { fbb_error (ERR_MEMORY, "malloc", numero); } static void fbb_w (unsigned type, char *texte, unsigned numero) { FILE *fichier; int nbfiles = 0; static char *type_error[] = { "WARNING :", "FATAL :", "EXCEPTION :", }; static char *text_error[] = { "Cannot open file", "Cannot create file", "Cannot close file", "Cannot resynchronize TNC", "Not enough memory", "Wrong channel selection", "Wrong procedure level", "Cannot write to file", "Syntax error", "Error communication/TNC", "Pointer already allocated", "XMS/EMS error", "Divide by zero", "Memory exception", }; if (error_type == 1) nbfiles = fbb_fcloseall (); if ((fichier = fopen ("ERROR.SYS", "a+")) != NULL) { fprintf (fichier, "> %s Station %s, Ch:%d (%d-%d-%d) %s\n Version %s (%s)\n", type_error[error_type], pvoie->sta.indicatif.call, voiecur, pvoie->niv1, pvoie->niv2, pvoie->niv3, strdate (time (NULL)), version(), date ()); if (error_type == 1) fprintf (fichier, " %d open files\n", nbfiles); fprintf (fichier, " %s %u, errno %d=%s %s\n\n", texte, numero, erreur, strerror (erreur), text_error[type]); /* #if FBB_DEBUG fbb_printfiles(fichier); if (error_type) { print_stack(numero, fichier); } #endif */ fclose (fichier); } } void fbb_error (unsigned type, char *texte, unsigned numero) { erreur = errno; error_type = 2; fbb_w (type, texte, numero); port_log (0, 0, 'S', "Q *** BBS Quit"); ferme_log (); #ifdef __WINDOWS__ fbb_quit (0); #else sleep (5); exit (0); #endif } void fbb_except (unsigned type, char *texte, unsigned numero) { erreur = errno; error_type = 1; port_log (0, 0, 'S', "Q *** BBS Quit"); fbb_w (type, texte, numero); ferme_log (); } void fbb_warning (unsigned type, char *texte, unsigned numero) { erreur = errno; error_type = 0; fbb_w (type, texte, numero); } void win_message (int temps, char *texte) { #ifdef __WINDOWS__ WinMessage (temps, texte); #endif #ifdef __LINUX__ WinMessage (temps, texte); #endif #ifdef __FBBDOS__ fen *fen_ptr; deb_io (); fen_ptr = open_win (15, 7, 15 + strlen (texte) + 3, 9, INIT, "message"); _wscroll = 0; cputs (texte); putch ('\a'); _wscroll = 1; sleep_ (temps); close_win (fen_ptr); fin_io (); #endif } void write_error (char *filename) { int i; char text[256]; sprintf (text, "Cannot access to %s", filename); for (i = 0; i < 5; i++) { deb_io (); win_message (2, text); #ifdef __FBBDOS__ putch ('\a'); #endif fin_io (); } fbb_error (ERR_WRITE, filename, 0); } fbb-7.04j/src/exec_pg.c0100644000175100017510000003303007726646105012763 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* * Execution de programmes pour l'utilisateur * */ static void dir_pg (void); static void pg_commande (void); static void load_pg (void); static int nbpg = 0; #ifdef __LINUX__ #undef open #include #include #include cmdlist *tete_cmd = NULL; static int pty_open (int *pty, struct winsize *winsize) { int pid; int i; char line[20]; int c; int tty, devtty; for (c = 'p'; c <= 's'; c++) { for (i = 0; i < 16; i++) { sprintf (line, "/dev/pty%c%x", c, i); *pty = open (line, O_RDWR | O_NOCTTY); if (*pty >= 0) break; } if (*pty >= 0) break; } if (*pty < 0) { fprintf (stderr, "Out of pty\n"); return -1; } ioctl (*pty, TIOCEXCL, NULL); if ((pid = fork ()) != 0) return pid; /* child */ close (*pty); signal (SIGHUP, SIG_DFL); line[5] = 't'; tty = open (line, O_RDWR); if (tty < 0) { fprintf (stderr, "Cannot open slave side\n"); close (*pty); return -1; } (void) chown (line, getuid (), getgid ()); (void) chmod (line, 0600); setsid (); /* will break terminal affiliation */ ioctl (tty, TIOCSCTTY, (char *) 0); setuid (getuid ()); setgid (getgid ()); devtty = open ("/dev/tty", O_RDWR); if (devtty < 0) { perror ("cannot open /dev/tty"); exit (1); } ioctl (devtty, TIOCSWINSZ, winsize); close (tty); dup2 (devtty, 0); dup2 (devtty, 1); dup2 (devtty, 2); return 0; } int is_cmd (int voie) { struct timeval to; fd_set fds_read; if (svoie[voie]->niv1 == N_MBL && svoie[voie]->niv2 == 20 && svoie[voie]->niv3 > 0) { FD_ZERO (&fds_read); FD_SET (svoie[voie]->niv3, &fds_read); to.tv_sec = 0; to.tv_usec = 0; return (select (svoie[voie]->niv3 + 1, &fds_read, NULL, NULL, &to) > 0); } return 0; } void exec_cmd (cmdlist * cptr) { if (pvoie->niv3 == 0) { int pid, ac; struct winsize win = {24, 80, 0, 0}; char *av[20]; if (cptr == NULL) return; /* Create the child process */ pid = pty_open (&pvoie->niv3, &win); if (pid == 0) { /* child */ struct termios termios; char *line; memset ((char *) &termios, 0, sizeof (termios)); ioctl (0, TIOCSCTTY, (char *) 0); termios.c_iflag = ICRNL | IXOFF; termios.c_oflag = OPOST | ONLCR; termios.c_cflag = CS8 | CREAD /*| CLOCAL */ ; termios.c_lflag = ISIG | ICANON; termios.c_cc[VINTR] = 127; termios.c_cc[VQUIT] = 28; termios.c_cc[VERASE] = 8; termios.c_cc[VKILL] = 24; termios.c_cc[VEOF] = 4; cfsetispeed (&termios, B38400); cfsetospeed (&termios, B38400); tcsetattr (0, TCSANOW, &termios); /* Transform the command line to list of arguments */ sup_ln (indd); while (*indd && (!isspace (*indd))) ++indd; line = calloc (1, strlen (cptr->action) + strlen (indd) + 2); strcpy (line, cptr->action); strcat (line, indd); ac = 0; av[ac] = strtok (line, " \t\n\r"); while (av[ac]) av[++ac] = strtok (NULL, " \t\n"); /* envc = 0; envp[envc] = (char *) malloc (30); sprintf (envp[envc++], "AXCALL=%s", call); envp[envc] = (char *) malloc (30); sprintf (envp[envc++], "PROTOCOL=%s", protocol); envp[envc] = (char *) malloc (30); sprintf (envp[envc++], "TERM=linux"); envp[envc] = NULL; */ execvp (av[0], av); /* should never go there */ exit (1); } } else { /* read/write the child process */ if (*indd) write (pvoie->niv3, indd, strlen (indd)); if (is_cmd (voiecur)) { char buf[250]; int cnt; cnt = read (pvoie->niv3, buf, sizeof (buf)); if (cnt <= 0) { /* End of connection */ close (pvoie->niv3); pvoie->niv3 = 0; retour_mbl (); return; } out (buf, cnt); } } } #endif void exec_pg (void) { int n_sauve; int ret; char s[256]; char *ptr = NULL; FILE *fptr; if (pvoie->niv3 == 0) { /* if ... incindd(); */ teste_espace (); sup_ln (indd); if (*indd) { ptr = pvoie->appendf; while (ISGRAPH (*indd)) *ptr++ = *indd++; *ptr = '\0'; if (!tst_point (pvoie->appendf)) { retour_mbl (); return; } while_space (); } else { dir_pg (); retour_mbl (); return; } } indd[80] = '\0'; if (pvoie->ncur->coord != 0xffff) { /* Ecrit le record de l'utilisateur en fichier */ fptr = ouvre_nomenc (); fseek (fptr, pvoie->ncur->coord * ((long) sizeof (info)), 0); fwrite ((char *) &(pvoie->finf), (int) sizeof (info), 1, fptr); ferme (fptr, 18); } #if defined(__WINDOWS__) || defined(__MSDOS__) #define PG_BUF 32000 { char *ptr = m_alloue (PG_BUF); if (ptr == NULL) return; memset (ptr, '\0', PG_BUF); #ifdef __LINUX__ sprintf (s, "%s%s %s-%d %d %u %d %s", PGDIR, #elsif __WIN32__ sprintf (s, "PG32\\%s %s-%d %d %u %d %s", #else sprintf (s, "PG\\%s %s-%d %d %u %d %s", #endif pvoie->appendf, pvoie->sta.indicatif.call, pvoie->sta.indicatif.num, pvoie->niv3, pvoie->finf.flags, pvoie->ncur->coord, indd); ret = filter (s, ptr, PG_BUF, NULL, NULL); ptr[PG_BUF - 1] = '\0'; if (*ptr) out (ptr, strlen (ptr)); m_libere (ptr, PG_BUF); } #endif #ifdef __LINUX__ { char deroute[80]; char *pptr = s; sprintf (deroute, "%sEXECUTE.xxx", MBINDIR); sprintf (s, "%s%s %s-%d %d %u %d '%s'", PGDIR, strlwr (pvoie->appendf), pvoie->sta.indicatif.call, pvoie->sta.indicatif.num, pvoie->niv3, pvoie->finf.flags, pvoie->ncur->coord, indd); ret = call_nbdos (&pptr, 1, REPORT_MODE, deroute, PGDIR, NULL); if (ret != -1) { outfich (deroute); } unlink (deroute); } #endif /* #ifdef __FBBDOS__ sprintf (s, "PG\\%s %s-%d %d %u %d %s", pvoie->appendf, pvoie->sta.indicatif.call, pvoie->sta.indicatif.num, pvoie->niv3, pvoie->finf.flags, pvoie->ncur->coord, indd); ret = send_dos (4, s, NULL); #endif */ if (pvoie->ncur->coord != 0xffff) { /* Relit le record de l'utilisateur du fichier */ fptr = ouvre_nomenc (); fseek (fptr, pvoie->ncur->coord * ((long) sizeof (info)), 0); fread ((char *) &(pvoie->finf), (int) sizeof (info), 1, fptr); ferme (fptr, 18); } switch (ret) { case 0: init_hold (); retour_mbl (); break; case 1: ++pvoie->niv3; break; case 2: pvoie->deconnect = 6; break; case 3: pg_commande (); break; case 4: n_sauve = ++pvoie->niv3; init_hold (); pg_commande (); maj_niv (N_MBL, 17, n_sauve); break; case 5: break; case -1: clear_outbuf (voiecur); strcpy (varx[0], pvoie->appendf); texte (T_ERR + 1); retour_mbl (); break; default: retour_mbl (); break; } } static void dir_pg (void) { int num = 0; char str[80]; char *ptr; #ifdef __WINDOWS__ #ifdef __WIN32__ if (findfirst ("PG32\\*.*", &(pvoie->dirblk), FA_DIREC)) #else if (findfirst ("PG\\*.*", &(pvoie->dirblk), FA_DIREC)) #endif { texte (T_DOS + 2); return; } #endif #ifdef __FBBDOS__ if (findfirst ("PG\\*.*", &(pvoie->dirblk), FA_DIREC)) { texte (T_DOS + 2); return; } #endif #ifdef __LINUX__ { cmdlist *clist = tete_cmd; while (clist) { if (num == 4) { cr (); num = 0; } sprintf (str, "%-10s", clist->cmd); out (str, 10); clist = clist->next; } if (num != 0) cr (); } num = 0; sprintf(str, "%s*", PGDIR); if (findfirst (str, &(pvoie->dirblk), FA_DIREC)) { texte (T_DOS + 2); return; } #endif if (*pvoie->dirblk.ff_name == '.') { findnext (&(pvoie->dirblk)); if (findnext (&(pvoie->dirblk))) { texte (T_DOS + 2); return; } } while (1) { if ((pvoie->dirblk.ff_attrib & FA_DIREC) == 0) { if (num == 4) { cr (); num = 0; } ptr = strrchr (pvoie->dirblk.ff_name, '.'); if (ptr) *ptr = '\0'; sprintf (str, "%-10s", pvoie->dirblk.ff_name); out (str, 10); ++num; } if (findnext (&(pvoie->dirblk))) break; } if (num != 0) cr (); } static void pg_commande (void) { obuf *optr; char *ptr, *tptr; int ncars, nbcars, nocars; int maxcar = DATABUF; if ((optr = pvoie->outptr) != NULL) { ncars = 0; tptr = data; nbcars = optr->nb_car; nocars = optr->no_car; ptr = optr->buffer + nocars; while (1) { if (nbcars == nocars) { pvoie->outptr = optr->suiv; m_libere (optr, sizeof (obuf)); pvoie->memoc -= 250; if ((optr = pvoie->outptr) != NULL) { nbcars = optr->nb_car; nocars = 0; ptr = optr->buffer; } else { /* cprintf(" Vide ") ; */ break; } } *tptr++ = *ptr; ++nocars; if (++ncars == maxcar) { optr->no_car = nocars; break; } ++ptr; } *tptr = '\0'; maj_niv (N_MBL, 0, 0); in_buf (voiecur, data, strlen (data)); while (pvoie->inbuf.nblig) traite_voie (voiecur); } } int appel_pg (char *nom) { pglist *lptr = tete_pg; #ifdef __LINUX__ cmdlist *cptr = tete_cmd; strupr (nom); while (cptr) { if (strcmp (nom, cptr->cmd) == 0) { maj_niv (N_MBL, 20, 0); --indd; exec_cmd (cptr); return (1); } cptr = cptr->next; } #else strupr (nom); #endif while (lptr) { if (strcmp (nom, lptr->nom_pg) == 0) { maj_niv (N_MBL, 17, 0); --indd; exec_pg (); return (1); } lptr = lptr->suiv; } return (0); } #ifdef __LINUX__ static void load_cmd (void) { FILE *fptr; char line[256]; char cmd[256]; char action[256]; cmdlist *cptr; fptr = fopen (c_disque ("commands.sys"), "r"); if (fptr == NULL) return; while (fgets (line, sizeof (line), fptr)) { int nb = sscanf (line, "%s %[^\n]", cmd, action); if (nb < 2 || *cmd == '#') continue; cptr = malloc (sizeof (cmdlist)); if (cptr == NULL) return; strupr (cmd); n_cpy (sizeof (cptr->cmd) - 1, cptr->cmd, cmd); cptr->action = strdup (action); cptr->next = tete_cmd; tete_cmd = cptr; ++nbpg; { char text[80]; sprintf (text, "%d: CMD %s", nbpg, cptr->cmd); InitText (text); } } fclose (fptr); } #endif static void load_pg (void) { char str[80]; char *ptr; pglist *lptr = tete_pg; struct ffblk dirblk; #if defined(__WINDOWS__) || defined(__FBBDOS__) #ifdef __WIN32__ if (findfirst ("PG32\\*.*", &dirblk, FA_DIREC)) #else if (findfirst ("PG\\*.*", &dirblk, FA_DIREC)) #endif { return; } #endif #if defined(__LINUX__) sprintf(str, "%s*", PGDIR); if (findfirst (str, &dirblk, FA_DIREC)) { return; } #endif if (*pvoie->dirblk.ff_name == '.') { findnext (&dirblk); if (findnext (&dirblk)) { return; } } ptr = strchr (dirblk.ff_name, '.'); if (ptr) *ptr = '\0'; if ((dirblk.ff_attrib & FA_DIREC) == 0) { if (lptr) { lptr->suiv = (pglist *) m_alloue (sizeof (pglist)); lptr = lptr->suiv; } else { tete_pg = lptr = (pglist *) m_alloue (sizeof (pglist)); } lptr->suiv = NULL; strn_cpy (8, lptr->nom_pg, dirblk.ff_name); #if defined(__WINDOWS__) || defined(__LINUX__) ++nbpg; { char text[80]; sprintf (text, "%d: PG %s", nbpg, lptr->nom_pg); InitText (text); } #endif } while (findnext (&dirblk) == 0) { ptr = strchr (dirblk.ff_name, '.'); if (ptr) *ptr = '\0'; if ((dirblk.ff_attrib & FA_DIREC) == 0) { if (lptr) { lptr->suiv = (pglist *) m_alloue (sizeof (pglist)); lptr = lptr->suiv; } else { tete_pg = lptr = (pglist *) m_alloue (sizeof (pglist)); } lptr->suiv = NULL; strn_cpy (8, lptr->nom_pg, dirblk.ff_name); #if defined(__WINDOWS__) || defined(__LINUX__) ++nbpg; { char text[80]; sprintf (text, "%d: PG %s", nbpg, lptr->nom_pg); InitText (text); } #endif } } #ifdef __LINUX__ /* Loads the commands of system/commands.sys */ load_cmd (); #endif } void end_pg (void) { pglist *lptr; #ifdef __LINUX__ cmdlist *cptr; int voie; printf ("End PG ***\n"); for (voie = 0; voie < NBVOIES; voie++) { /* Close open ttys */ if (svoie[voie]->niv1 == N_MBL && svoie[voie]->niv2 == 20 && svoie[voie]->niv3 > 0) { printf ("Closing tty %d\n", svoie[voie]->niv3); close (svoie[voie]->niv3); } } while (tete_cmd) { cptr = tete_cmd; tete_cmd = cptr->next; m_libere (cptr->action, strlen (cptr->action) + 1); m_libere (cptr, sizeof (cmdlist)); } #endif while (tete_pg) { lptr = tete_pg; tete_pg = tete_pg->suiv; m_libere (lptr, sizeof (pglist)); } } void affich_pg (int tp) { #ifdef __LINUX__ load_pg (); #endif #ifdef __WINDOWS__ load_pg (); #endif #ifdef __FBBDOS__ fen *fen_ptr; pglist *lptr; int size, nb_pg = 0; load_pg (); lptr = tete_pg; while (lptr) { ++nb_pg; lptr = lptr->suiv; } if (nb_pg == 0) return; size = (nb_pg > 19 * 7) ? 19 : 1 + nb_pg / 7; lptr = tete_pg; deb_io (); nb_pg = 0; fen_ptr = open_win (10, 2, 76, 4 + size, INIT, "PG"); while (lptr) { cprintf ("%-8s ", lptr->nom_pg); lptr = lptr->suiv; } attend_caractere (tp); close_win (fen_ptr); fin_io (); #endif } fbb-7.04j/src/fbb_orb.c0100644000175100017510000006624307726646105012760 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Serveur de communication socket pour connection console * */ #include #include #include #include #include #include #include #include #include #define WAITINFO 0 #define WAITPASS 1 #define CONNECTED 2 #define DISCONNECT 3 extern void process (void); void orb_services (void); static void set_opt(char *command, char *value); /* extern void usleep(unsigned long); */ static int orb_fd = -1; typedef struct _OrbClient { int fd; int state; int monitor; int channel; int options; int infos; long mask; time_t cle; char callsign[12]; struct _OrbClient *next; } OrbClient; static OrbClient *client_head = NULL; static OrbClient *orb_add_client (void) { OrbClient *sptr; sptr = calloc (1, sizeof (OrbClient)); if (sptr == NULL) return (NULL); sptr->next = client_head; client_head = sptr; return (sptr); } static void orb_del_client (OrbClient * cptr) { OrbClient *sptr; OrbClient *prev; prev = NULL; sptr = client_head; while (sptr) { if (sptr == cptr) { if (prev) prev->next = sptr->next; else client_head = sptr->next; free (sptr); break; } prev = sptr; sptr = sptr->next; } } static int orb_new_connection (int fd) { int addr_len; struct sockaddr_in sock_addr; OrbClient *sptr; sptr = orb_add_client (); addr_len = sizeof (sock_addr); sptr->fd = accept (fd, (struct sockaddr *) &sock_addr, &addr_len); sptr->state = WAITINFO; return (sptr->fd); } static int send_data(int sock, char *datafile, char *datarequest, int len, int command) { int fd; int nb; char buffer[1024]; printf("sending file %s\n", datafile); buffer[0] = ORB_DATA; buffer[1] = command; buffer[2] = len % 256; buffer[3] = len >> 8; memcpy(buffer+4, datarequest, len); write(sock, buffer, len+4); fd = open(datafile, O_RDONLY); if (fd == -1) { buffer[2] = 0; buffer[3] = 0; write(sock, buffer, 4); return errno; } for (;;) { nb = read(fd, buffer+4, 1000); if (nb < 0) nb = 0; buffer[2] = nb % 256; buffer[3] = nb >> 8; write(sock, buffer, nb+4); printf("%d data sent\n", nb); if (nb == 0) break; } close(fd); unlink(datafile); return 0; } static long flength(char *filename) { struct stat bstat; if (stat(filename, &bstat) == -1) return 0L; return bstat.st_size; } static int send_data_buf(OrbClient * sptr, int service, char *command, char *data, int datalen) { char buffer[1024]; int length; length = strlen(command); strcpy(buffer+4, command); if ((length + datalen + 4) > 1024) return -1; if (datalen) { memcpy(buffer+4+length, data, datalen); length += datalen; } buffer[0] = ORB_DATA; buffer[1] = service; buffer[2] = length & 0xff; buffer[3] = length >> 8; write(sptr->fd, buffer, 4+length); return length; } static void orb_process_data (OrbClient * sptr) { int i, j; int nb; int lg; static char buffer[1024]; static char datafile[256]; static char datarequest[1024]; static int nbrcv = 0; static int rcv_fd; static int rcv_state = 0; char call[256]; char pass[256]; char *ptr; lg = 0; nb = read (sptr->fd, buffer + nbrcv, sizeof (buffer) - nbrcv); if (nb == -1) return; if (nb == 0) { editor = 0; /* Client is disconnected */ if (sptr->mask & ORB_CONSOLE) { /* Disconnect from console */ deconnexion (CONSOLE, 0); } else { close (sptr->fd); orb_del_client (sptr); } nbrcv = 0; return; } nbrcv += nb; again: if ((nbrcv >= 3) && (buffer[0] == ORB_REQUEST)) { unsigned int len; int mask; int old_mask = sptr->mask; int ack; char cmd[300]; /*commande */ switch (buffer[1]) { case 0: /* Changement de masque */ mask = buffer[2] & 0xff; ack = 0; if ((mask & ORB_CONSOLE) != (sptr->mask & ORB_CONSOLE)) { if (mask & ORB_CONSOLE) { FILE *fptr; if ((fptr = fopen (d_disque ("etat.sys"), "r+t")) != NULL) { fprintf (fptr, "%-6s-%X\n", cons_call.call, cons_call.num); ferme (fptr, 74); } /* Console connection */ if (v_tell && connect_tell ()) { music (0); ack = 1; } else if (!connect_console ()) { ack = 2; } else { ack = 1; } } else { /* Console deconnection */ deconnexion (CONSOLE, 0); ack = 0; nbrcv = 0; return; } buffer[0] = ORB_XFBBX; buffer[1] = 0; buffer[2] = 1; buffer[3] = 0; buffer[4] = ack; write (sptr->fd, buffer, 5); } if (ack != 2) /* Don't update mask if connection refused */ { sptr->mask = mask; if ((mask & ORB_MSGS) != (old_mask & ORB_MSGS)) { reset_msgs (); aff_msg_cons (); } if ((mask & ORB_STATUS) != (old_mask & ORB_STATUS)) { FbbMem (1); test_pactor(1); } if ((mask & ORB_NBCNX) != (old_mask & ORB_NBCNX)) fbb_list (1); if ((mask & ORB_LISTCNX) != (old_mask & ORB_LISTCNX)) fbb_list (1); } lg = 3; break; case SVC_DIR: /* Dir request */ if (nbrcv < 4) return; len = ((unsigned int) buffer[3] << 8) + (unsigned int) buffer[2]; if (nbrcv < len+4) return; if (sptr->state != CONNECTED) return; if (len < 256) { int nb; buffer[nbrcv] = '\0'; sprintf(datafile, "%sclientdata.txt", back2slash(DATADIR)); nb = 1+sprintf(datarequest, "%s%s", back2slash(CONFDIR), buffer+4); sprintf(cmd, "ls -oA %s | awk '{ print substr($1,1,1),$4,$8,$5\"-\"$6\"-\"$7 }' > %s 2>&1", datarequest, datafile); printf("system %s\n", cmd); system(cmd); nb += 1+sprintf(datarequest + nb, "%ld", flength(datafile)); send_data(sptr->fd, datafile, datarequest, nb, SVC_DIR); } lg = len+4; break; case SVC_RECV: /* File request */ if (nbrcv < 4) return; len = ((unsigned int) buffer[3] << 8) + (unsigned int) buffer[2]; if (nbrcv < len+4) return; if (sptr->state != CONNECTED) return; if (len < 256) { buffer[nbrcv] = '\0'; sprintf(datafile, "%sclientdata.txt", back2slash(DATADIR)); nb = 1+sprintf(datarequest, "%s%s", back2slash(CONFDIR), buffer+4); sprintf(cmd, "cp %s %s", datarequest, datafile); printf("system %s\n", cmd); system(cmd); nb += 1+sprintf(datarequest + nb, "%ld", flength(datafile)); send_data(sptr->fd, datafile, datarequest, nb, SVC_RECV); } lg = len+4; break; case SVC_SEND: /* File receive */ if (nbrcv < 4) return; len = ((unsigned int) buffer[3] << 8) + (unsigned int) buffer[2]; if (nbrcv < len+4) return; if (sptr->state != CONNECTED) return; if (len <= 1000) { switch (rcv_state) { case 0 : buffer[nbrcv] = '\0'; sprintf(datafile, "%sclientdata.txt", back2slash(DATADIR)); sprintf(datarequest, "%s%s", back2slash(CONFDIR), buffer+4); printf("receiving file %s\n", datafile); rcv_fd = open(datafile, O_CREAT|O_TRUNC|O_WRONLY, 0666); rcv_state = 1; break; case 1: if (len == 0) { char header[4]; /* End of file */ if (rcv_fd > 0) { close(rcv_fd); sprintf(cmd, "mv %s %s", datafile, datarequest); printf("system %s\n", cmd); system(cmd); test_fichiers = 1; } header[0] = ORB_DATA; header[1] = SVC_SEND; header[2] = 0; header[3] = 0; write(sptr->fd, header, 4); rcv_state = 0; break; } if (rcv_fd > 0) { nb = write(rcv_fd, buffer+4, len); printf("%d data received\n", len); if (nb <= 0) { close(rcv_fd); rcv_fd = -1; } } break; } } lg = len+4; break; case SVC_FWD: /* Pending forward request */ if (nbrcv < 4) return; len = ((unsigned int) buffer[3] << 8) + (unsigned int) buffer[2]; if (nbrcv < len+4) return; if (sptr->state != CONNECTED) return; if (len < 256) { char command[80]; char arg[80]; buffer[nbrcv] = '\0'; sscanf(buffer+4, "%s %s", command, arg); if (strcasecmp(command, "LIST") == 0) { sprintf(datafile, "%sclientdata.txt", back2slash(DATADIR)); strcpy(datarequest, "pending_forward.txt"); nb = 1+sprintf(datarequest, "%s%s", back2slash(CONFDIR), buffer+4); RequestPendingForward(datafile); nb += 1+sprintf(datarequest + nb, "%ld", flength(datafile)); send_data(sptr->fd, datafile, datarequest, nb, SVC_FWD); } else if (strcasecmp(command, "START") == 0) { sprintf(datarequest, "START %s", StartForward(atoi(arg))); send_data_buf(sptr, SVC_FWD, datarequest, NULL, 0); } else if (strcasecmp(command, "STOP") == 0) { sprintf(datarequest, "STOP %s", StopForward(atoi(arg))); send_data_buf(sptr, SVC_FWD, datarequest, NULL, 0); } } lg = len+4; break; case SVC_DISC: /* Disconnect request */ if (nbrcv < 4) return; len = ((unsigned int) buffer[3] << 8) + (unsigned int) buffer[2]; if (nbrcv < len+4) return; if (sptr->state != CONNECTED) return; if (len < 256) { char callsign[80]; int nChan; int bImm; int nb; buffer[nbrcv] = '\0'; nb = sscanf(buffer+4, "%d %s %d", &nChan, callsign, &bImm); if (nb == 3) disconnect_channel(nChan, bImm); } lg = len+4; break; case SVC_USER: /* users management */ if (nbrcv < 4) return; len = ((unsigned int) buffer[3] << 8) + (unsigned int) buffer[2]; if (nbrcv < len+4) return; if (sptr->state != CONNECTED) return; if (len < 256) { int length; char command[80]; char arg[80]; char *ptr; buffer[nbrcv] = '\0'; sscanf(buffer+4, "%s %s", command, arg); if (strcasecmp(command, "LIST") == 0) { sprintf(datafile, "%sclientdata.txt", back2slash(DATADIR)); strcpy(datarequest, "service.txt"); nb = 1+sprintf(datarequest, "%s%s", back2slash(CONFDIR), buffer+4); RequestUsersList(datafile); nb += 1+sprintf(datarequest + nb, "%ld", flength(datafile)); send_data(sptr->fd, datafile, datarequest, nb, SVC_USER); } else if (strcasecmp(command, "GET") == 0) { ptr = GetUserInfo(arg, &length); sprintf(datarequest, "USER %s %d\n", arg, length); send_data_buf(sptr, SVC_USER, datarequest, ptr, length); } else if (strcasecmp(command, "PUT") == 0) { int datalen = len; ptr = buffer+4; while (*ptr && (*ptr != '\n')) { ++ptr; --datalen; } if (*ptr == '\n') { ++ptr; PutUserInfo(arg, ptr, datalen); ptr = GetUserInfo(arg, &length); sprintf(datarequest, "USER %s %d\n", arg, length); send_data_buf(sptr, SVC_USER, datarequest, ptr, length); } } else if (strcasecmp(command, "NEW") == 0) { NewUserInfo(arg); ptr = GetUserInfo(arg, &length); sprintf(datarequest, "USER %s %d\n", arg, length); send_data_buf(sptr, SVC_USER, datarequest, ptr, length); } else if (strcasecmp(command, "DEL") == 0) { DelUserInfo(arg); } } lg = len+4; break; case SVC_MSG: /* messages management */ if (nbrcv < 4) return; len = ((unsigned int) buffer[3] << 8) + (unsigned int) buffer[2]; if (nbrcv < len+4) return; if (sptr->state != CONNECTED) return; if (len < 256) { int length; char command[80]; char arg[80]; char *ptr; buffer[nbrcv] = '\0'; sscanf(buffer+4, "%s %s", command, arg); if (strcasecmp(command, "LIST") == 0) { sprintf(datafile, "%sclientdata.txt", back2slash(DATADIR)); strcpy(datarequest, "service.txt"); nb = 1+sprintf(datarequest, "%s%s", back2slash(CONFDIR), buffer+4); RequestMsgsList(datafile); nb += 1+sprintf(datarequest + nb, "%ld", flength(datafile)); send_data(sptr->fd, datafile, datarequest, nb, SVC_MSG); } else if (strcasecmp(command, "GET") == 0) { ptr = GetMsgInfo(arg, &length); sprintf(datarequest, "MSG %s %d\n", arg, length); send_data_buf(sptr, SVC_MSG, datarequest, ptr, length); } else if (strcasecmp(command, "PUT") == 0) { int datalen = len; ptr = buffer+4; while (*ptr && (*ptr != '\n')) { ++ptr; --datalen; } if (*ptr == '\n') { ++ptr; PutMsgInfo(arg, ptr, datalen); ptr = GetMsgInfo(arg, &length); sprintf(datarequest, "MSG %s %d\n", arg, length); send_data_buf(sptr, SVC_MSG, datarequest, ptr, length); } } } lg = len+4; break; case SVC_MREQ: /* message request */ if (nbrcv < 4) return; len = ((unsigned int) buffer[3] << 8) + (unsigned int) buffer[2]; if (nbrcv < len+4) return; if (sptr->state != CONNECTED) return; if (len < 256) { char command[80]; char arg[80]; buffer[nbrcv] = '\0'; sscanf(buffer+4, "%s %s", command, arg); if (strcasecmp(command, "MSG") == 0) { sprintf(datafile, "%smessage.txt", back2slash(DATADIR)); mess_name(MESSDIR, atol(arg), datarequest); nb = 1+strlen(datarequest); sprintf(cmd, "cp %s %s", datarequest, datafile); printf("system %s\n", cmd); system(cmd); nb += 1+sprintf(datarequest + nb, "%ld", flength(datafile)); send_data(sptr->fd, datafile, datarequest, nb, SVC_MREQ); } } lg = len+4; break; case SVC_OPT: /* options management */ if (nbrcv < 4) return; len = ((unsigned int) buffer[3] << 8) + (unsigned int) buffer[2]; if (nbrcv < len+4) return; if (sptr->state != CONNECTED) return; if (len < 256) { char command[80]; char arg[80]; char val[80]; sptr->options = 1; buffer[nbrcv] = '\0'; *arg = *val = '\0'; sscanf(buffer+4, "%s %s %s", command, arg, val); if (strcasecmp(command, "GET") == 0) { orb_options(); } else if (strcasecmp(command, "SET") == 0) { set_opt(arg, val); } } lg = len+4; break; case SVC_PACTOR: /* pactor management */ if (nbrcv < 4) return; len = ((unsigned int) buffer[3] << 8) + (unsigned int) buffer[2]; if (nbrcv < len+4) return; if (sptr->state != CONNECTED) return; if (len < 256) { char command[80]; int val = 1; int port = 0; buffer[nbrcv] = '\0'; sscanf(buffer+4, "%s %d %d", command, &port, &val); if (strcasecmp(command, "SCAN") == 0) { CmdScan(port, val); } else if (strcasecmp(command, "CHO") == 0) { CmdCHO(port, 1); } else if (strcasecmp(command, "BRK") == 0) { CmdCHO(port, 0); } } lg = len+4; break; case SVC_INFO: /* channel information */ if (nbrcv < 4) return; len = ((unsigned int) buffer[3] << 8) + (unsigned int) buffer[2]; if (nbrcv < len+4) return; if (sptr->state != CONNECTED) return; if (len < 256) { char command[80]; int val = -1; buffer[nbrcv] = '\0'; sscanf(buffer+4, "%s %d", command, &val); sptr->infos = (val != -1); set_info_channel(val); } lg = len+4; break; default: if (nbrcv < 4) return; len = ((unsigned int) buffer[3] << 8) + (unsigned int) buffer[2]; if (nbrcv < len+4) return; lg = len+4; break; } } else { char *endptr; /* Check if the whole line is received */ buffer[nbrcv] = '\0'; endptr = strrchr (buffer, '\n'); if (endptr == NULL) return; editor = 0; lg = 1 + endptr - buffer; switch (sptr->state) { case WAITINFO: /* Mask of services */ sscanf (buffer, "%ld %d %s", &sptr->mask, &sptr->channel, call); call[11] = '\0'; strcpy (sptr->callsign, call); sptr->cle = time (NULL); sprintf (call, "%010ld", sptr->cle); write (sptr->fd, call, strlen (call)); sptr->state = WAITPASS; break; case WAITPASS: /* Callsign sans SSID */ strcpy (call, sptr->callsign); if ((ptr = strchr (call, '-'))) *ptr = '\0'; /* Password */ sscanf (buffer, "%s", pass); if (comp_passwd (call, pass, sptr->cle)) { orb_services(); cons_call.num = extind (strupr (sptr->callsign), cons_call.call); reset_msgs (); FbbMem (1); aff_msg_cons (); fbb_list (1); test_pactor(1); if (sptr->mask & ORB_CONSOLE) { FILE *fptr; if ((fptr = fopen (d_disque ("etat.sys"), "r+t")) != NULL) { fprintf (fptr, "%-6s-%X\n", cons_call.call, cons_call.num); ferme (fptr, 74); } /* Console connection */ if (v_tell && connect_tell ()) { music (0); } else if (!connect_console ()) { char *txt = "Console already connected !\n\n"; int len = strlen (txt) + 3; strcpy (buffer + 7, txt); /* Header */ buffer[0] = ORB_CONSOLE; buffer[1] = 0; buffer[2] = (len) & 0xff; buffer[3] = (len) >> 8; buffer[4] = CONSOLE; buffer[5] = W_CNST; buffer[6] = 0; write (sptr->fd, buffer, len + 4); close (sptr->fd); orb_del_client (sptr); } } sptr->state = CONNECTED; rcv_state = 0; } else { char *txt = "Callsign/Password error !\n\n"; int len = strlen (txt) + 3; strcpy (buffer + 7, txt); /* Header */ buffer[0] = ORB_CONSOLE; buffer[1] = 0; buffer[2] = (len) & 0xff; buffer[3] = (len) >> 8; buffer[4] = CONSOLE; buffer[5] = W_CNST; buffer[6] = 0; write (sptr->fd, buffer, len + 4); close (sptr->fd); orb_del_client (sptr); } break; case CONNECTED: if (sptr->mask & ORB_CONSOLE) { for (i = 0, j = 0; i < nbrcv; i++) { if (buffer[i] == '\r') continue; if (buffer[i] == '\n') buffer[j++] = '\r'; else buffer[j++] = buffer[i]; } console_inbuf (buffer, j); } break; } } if (lg < nbrcv) { nbrcv -= lg; memmove(buffer, buffer+lg, nbrcv); goto again; } nbrcv = 0; } static void orb_process (void) { int nb; int maxfd; fd_set tcp_read; fd_set tcp_write; fd_set tcp_excep; struct timeval to; OrbClient *sptr; if (orb_fd == -1) return; to.tv_sec = to.tv_usec = 0; FD_ZERO (&tcp_read); FD_ZERO (&tcp_write); FD_ZERO (&tcp_excep); maxfd = orb_fd; FD_SET (orb_fd, &tcp_read); sptr = client_head; while (sptr) { FD_SET (sptr->fd, &tcp_read); if (sptr->fd > maxfd) maxfd = sptr->fd; sptr = sptr->next; } nb = select (maxfd + 1, &tcp_read, NULL, NULL, &to); if (nb == -1) { perror ("orb_select"); return; } if (nb == 0) { /* nothing to do */ return; } /* To avoid network locks */ alarm(60); if (FD_ISSET (orb_fd, &tcp_read)) { /* New client connection */ orb_new_connection (orb_fd); } sptr = client_head; while (sptr) { /* On sauvegarde le next car le pointeur de client peut etre * libere pendant le traitement en cas de deconnexion */ OrbClient *ptemp = sptr->next; if (FD_ISSET (sptr->fd, &tcp_read)) { orb_process_data (sptr); is_idle = 0; } sptr = ptemp; } alarm(0); return; } int fbb_orb (char *service, int port) { int val; int len; struct sockaddr_in sock_addr; if ((orb_fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { perror ("socket_r"); return (0); } val = 1; len = sizeof (val); if (setsockopt (orb_fd, SOL_SOCKET, SO_REUSEADDR, (char *) &val, len) == -1) { perror ("opn_tcp : setsockopt SO_REUSEADDR"); } sock_addr.sin_family = AF_INET; sock_addr.sin_addr.s_addr = 0; sock_addr.sin_port = htons (port); if (bind (orb_fd, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) != 0) { perror ("opn_tcp : bind"); close (orb_fd); return (0); } if (listen (orb_fd, SOMAXCONN) == -1) { perror ("listen"); close (orb_fd); return (0); } fprintf (stderr, "xfbbC/X server running ...\n"); fprintf (stderr, "xfbbd ready and running ...\n"); fflush (stderr); for (;;) { orb_process (); process (); if (is_idle) { usleep (1); } else { is_idle = 1; } } return 1; } static void orb_send_data (char *buffer, int lg, int mask) { OrbClient *sptr = client_head; while (sptr) { if (sptr->mask & mask) { switch (mask) { case ORB_MONITOR: case ORB_CONSOLE: case ORB_CHANNEL: if (((mask == ORB_MONITOR) && (buffer[4] == 0xff)) || ((mask == ORB_CONSOLE) && (buffer[4] == 0))) { write (sptr->fd, buffer, lg); } /* if ((mask == ORB_CHANNEL) && (buffer[4] > 0) && (buffer[4] < 0xff)) */ if (mask == ORB_CHANNEL) { if ((sptr->channel == 0) || (sptr->channel == buffer[4])) write (sptr->fd, buffer, lg); } break; case ORB_XFBBX: if (sptr->mask & ORB_CONSOLE) write (sptr->fd, buffer, lg); break; default: write (sptr->fd, buffer, lg); break; } } sptr = sptr->next; } } void orb_write (int channel, char *data, int len, int color, int header) { int i, j; char *buffer; buffer = malloc (len + 8); if (buffer == NULL) return; for (i = 0, j = 7; i < len; i++) { if (data[i] == '\n') continue; if (data[i] == '\r') buffer[j++] = '\n'; else buffer[j++] = data[i]; } if (channel == CONSOLE) { /* Editor request ? */ if (editor_request) { int len = 1; char buf[80]; editor_request = 0; editor = 1; buf[0] = ORB_XFBBX; buf[1] = 0; buf[3] = 0; switch (reply) { case 1 : /* SR */ len += sprintf(buf+5, "%ld", svoie[CONSOLE]->enrcur); buf[4] = 4; break; case 3 : /* Sx */ buf[4] = 3; break; default: buf[4] = 0; break; } buf[2] = len; orb_send_data (buf, 4+len, ORB_XFBBX); } /* Header */ buffer[0] = ORB_CONSOLE; buffer[1] = 0; buffer[2] = (j - 4) & 0xff; buffer[3] = (j - 4) >> 8; /* Envoie les data de console au client */ buffer[4] = CONSOLE; buffer[5] = color; buffer[6] = header; orb_send_data (buffer, j, ORB_CONSOLE); } else if (channel == MMONITOR) { /* Header */ buffer[0] = ORB_MONITOR; buffer[1] = 0; buffer[2] = (j - 4) & 0xff; buffer[3] = (j - 4) >> 8; /* Envoie les data de monitoring au client */ buffer[4] = 0xff; buffer[5] = color; buffer[6] = header; orb_send_data (buffer, j, ORB_MONITOR); } else { /* Header */ buffer[0] = ORB_CHANNEL; buffer[1] = 0; buffer[2] = (j - 4) & 0xff; buffer[3] = (j - 4) >> 8; /* Envoie les data de monitoring au client */ buffer[4] = channel - 1; buffer[5] = color; buffer[6] = header; orb_send_data (buffer, j, ORB_CHANNEL); } free (buffer); } void orb_disc (void) { OrbClient *sptr = client_head; /* Deconnecte un client */ while (sptr) { if (sptr->mask & ORB_CONSOLE) { if (sptr->mask & ORB_XFBBX) { char buffer[5]; /* Envoie la commande de deconnection */ buffer[0] = ORB_XFBBX; buffer[1] = 0; buffer[2] = 1; buffer[3] = 0; buffer[4] = 0; write (sptr->fd, buffer, 5); sptr->mask &= ~ORB_CONSOLE; } else { close (sptr->fd); orb_del_client (sptr); } break; } sptr = sptr->next; } } void orb_services (void) { char buffer[260]; int i; printf("sending %d services\n", SVC_MAX-1); /* Header */ buffer[0] = ORB_DATA; buffer[1] = SVC_LIST; buffer[2] = SVC_MAX-1; /* Max 255 services */ buffer[3] = 0; /* One service per byte */ for (i = 1 ; i < SVC_MAX ; i++) buffer[4 + i - 1] = i; orb_send_data (buffer, 4 + SVC_MAX - 1, 0xffff); } void orb_con_list (int channel, char *ligne) { char buffer[256]; int len = strlen (ligne); /* Header */ buffer[0] = ORB_LISTCNX; buffer[1] = 0; buffer[2] = (len) & 0xff; buffer[3] = (len) >> 8; /* Envoie la ligne de connection du canal */ strcpy (buffer + 4, ligne); orb_send_data (buffer, len + 4, ORB_LISTCNX); } void orb_pactor_status(int port, int p_status) { char buffer[80]; int len; sprintf (buffer + 4, "%d %d", port, p_status); len = strlen (buffer + 4); /* Header */ buffer[0] = ORB_DATA; buffer[1] = SVC_PACTOR; buffer[2] = (len) & 0xff; buffer[3] = (len) >> 8; /* Send pactor status */ orb_send_data (buffer, len + 4, ORB_STATUS); } void orb_con_nb (int nb) { char buffer[80]; int len; sprintf (buffer + 4, "%d", nb); len = strlen (buffer + 4); /* Header */ buffer[0] = ORB_NBCNX; buffer[1] = 0; buffer[2] = (len) & 0xff; buffer[3] = (len) >> 8; /* Envoie le nombre de connections */ orb_send_data (buffer, len + 4, ORB_NBCNX); } void orb_nb_msg (int priv, int hold, int nbmess) { char buffer[80]; int len; sprintf (buffer + 4, "%d %d %d", priv, hold, nbmess); len = strlen (buffer + 4); /* Header */ buffer[0] = ORB_MSGS; buffer[1] = 0; buffer[2] = (len) & 0xff; buffer[3] = (len) >> 8; /* Envoie le nombre de messages */ orb_send_data (buffer, len + 4, ORB_MSGS); } void orb_status (long lmem, long gmem, long disk1, long disk2) { char buffer[80]; int len; sprintf (buffer + 4, "%ld %ld %ld %ld", lmem, gmem, disk1, disk2); len = strlen (buffer + 4); /* Header */ buffer[0] = ORB_STATUS; buffer[1] = 0; buffer[2] = (len) & 0xff; buffer[3] = (len) >> 8; /* Envoie les infos de status */ orb_send_data (buffer, len + 4, ORB_STATUS); } static void set_opt(char *command, char *value) { int val = atoi(value); int ok = 1; switch(*command) { case 'B' : bip = val; break; case 'G' : gate = val; break; case 'M' : sed = val; break; case 'T' : ok_tell = val; break; case 'X' : aff_inexport = val; break; case 'P' : aff_popsmtp = val; break; default : ok = 0; break; } if (ok) maj_options(); } void orb_options(void) { OrbClient *sptr = client_head; char *command = "OPT\n"; char buffer[256]; int nb = 0; nb += sprintf(buffer+nb, "B %d Connection bip\n", (bip) ? 1 : 0); nb += sprintf(buffer+nb, "G %d Gateway\n", (gate) ? 1 : 0); nb += sprintf(buffer+nb, "M %d Message Editor\n", (sed) ? 1 : 0); nb += sprintf(buffer+nb, "T %d Talk\n", (ok_tell) ? 1 : 0); nb += sprintf(buffer+nb, "X %d Im/export display\n", (aff_inexport) ? 1 : 0); nb += sprintf(buffer+nb, "P %d POP/SMTP display\n", (aff_popsmtp) ? 1 : 0); while (sptr) { /* Send information only to the right clients */ if (sptr->options) send_data_buf(sptr, SVC_OPT, command, buffer, nb); sptr = sptr->next; } } void orb_info(int val, char *str) { static char buffer[512]; static int nb = 0; if (str) { nb += sprintf(buffer+nb, "%d %s\n", val, str); } else if (nb > 0) { OrbClient *sptr = client_head; char *command = "INFO\n"; while (sptr) { /* Send information only to the right clients */ if (sptr->infos) send_data_buf(sptr, SVC_INFO, command, buffer, nb); sptr = sptr->next; } nb = 0; } } fbb-7.04j/src/forward.c0100644000175100017510000003336407726646105013027 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE FORWARD.C */ #include static int rcv_fwd (void); static void snd_fwd (void); static void snd_rev_fwd (void); static char *check_call (char *ptr) { char *scan = ptr; while (*scan > ' ') ++scan; if (*scan == '\0') scan = ptr; else { while ((*scan) && (isspace (*scan))) ++scan; if (isgraph(*scan) && !isalnum(*scan)) /* Pactor - ! ou % */ ++scan; if ((isdigit (*scan)) && (!isalnum (*(scan + 1)))) { ++scan; while ((*scan) && (!isalnum (*scan))) ++scan; } } return (scan); } static int connect_ok (char *ptr) { int i; int j; char *str; Forward *pfwd = pvoie->curfwd; static char *test[3] = {"Connected", "Failure", "Busy"}; if (pfwd->no_con == 1) return (1); for (j = 0; j < 5; j++) { for (i = 0; i < 3; i++) { if (j == 4) str = test[i]; else { str = pfwd->mesnode[j][i]; } if ((*str) && (strstr (ptr, str))) { return (i + 1); } } } return (0); } static int snd_mess_fwd_rli (void) { /* * Retour = 0 : pas de suite * = 1 : il y a une suite * = -1 : Plus de message */ if (mess_suiv (voiecur)) { libere_tread (voiecur); pvoie->enrcur = 0L; pvoie->t_read = (rd_list *) m_alloue (sizeof (rd_list)); pvoie->t_read->suite = NULL; pvoie->t_read->nmess = ptmes->numero; pvoie->t_read->pmess = ptmes; return (snd_mess (voiecur, 2)); } return (-1); } static void snd_fwd (void) { char *ptr = indd; char *scan, *st; char s[256]; int i, nobbs; long temps; Forward *pfwd = pvoie->curfwd; nobbs = pvoie->bbsfwd; switch (pvoie->niv3) { case 0: if (pfwd->no_con < 8) { switch (connect_ok (ptr)) { case 0: break; case 1: scan = check_call (pfwd->con_lig[pfwd->no_con - 1]); pvoie->sta.indicatif.num = extind (scan, pvoie->sta.indicatif.call); if (*pfwd->con_lig[pfwd->no_con]) { outln (pfwd->con_lig[pfwd->no_con], strlen (pfwd->con_lig[pfwd->no_con])); pfwd->no_con++; } else { ptr = s; pfwd->no_con = 8; strcpy (pvoie->dos_path, "\\"); connexion (voiecur); /* positionne ncur */ nouveau (voiecur); if (pvoie->ctnc) { program_fwd (1, 1, &(pvoie->ctnc), voiecur); } if (*pfwd->con_lig[1]) { *ptr++ = ' '; *ptr++ = '{'; i = 0; while (1) { scan = pfwd->con_lig[i] + 2; while (ISGRAPH (*scan)) *ptr++ = *scan++; if ((++i == 7) || (*pfwd->con_lig[i + 1] == '\0')) { *ptr++ = '}'; *ptr++ = '\0'; break; } else *ptr++ = ','; } } *ptr = '\0'; status (voiecur); connect_log (voiecur, s); #ifdef __FBBDOS__ trait (0, ""); #endif if (*pfwd->txt_con) out (pfwd->txt_con, strlen (pfwd->txt_con)); } libere_tread (voiecur); break; case 2: /* Failure */ pvoie->mode |= F_FOR; pvoie->deconnect = 6; break; case 3: /* Busy */ set_link (nobbs, 1); pvoie->nb_choix = 1; pvoie->mode |= F_FOR; pvoie->deconnect = 6; break; } break; } if (att_prompt ()) { set_link (nobbs, 1); pvoie->nb_choix = 1; pvoie->maj_ok = 1; st = idnt_fwd (); if (pvoie->prot_fwd & FWD_FBB) { outs (st, strlen (st)); pvoie->temp1 = -1; pvoie->temp2 = TRUE; maj_niv (pvoie->niv1, 5, 0); new_fwd (); } else if (pvoie->prot_fwd & FWD_XPRO) { outs (st, strlen (st)); maj_niv (N_XFWD, 0, 9); xfwd (); } else if (FOR (pvoie->mode)) { outs (st, strlen (st)); if (pvoie->clock == 2) maj_niv (pvoie->niv1, pvoie->niv2, 4); else maj_niv (pvoie->niv1, pvoie->niv2, 5); } else { switch (snd_mess_fwd_rli ()) { case 0: ch_niv3 (2); /* Pas de suite */ break; case 1: ch_niv3 (1); /* Ya une suite */ break; case -1: pvoie->deconnect = 6; /* Plus de message */ break; } } } break; case 1: if (snd_mess (voiecur, 2) == 0) ch_niv3 (2); break; case 2: if (att_prompt ()) { /* Supression du message eventuel */ sprintf (s, "F %ld V:%s [%ld]", ptmes->numero, pvoie->sta.indicatif.call, ptmes->taille); fbb_log (voiecur, 'M', s); if (fin_envoi_fwd (voiecur)) ++stat_fwd; switch (snd_mess_fwd_rli ()) { case 0: break; case 1: ch_niv3 (1); case -1: pvoie->deconnect = 6; break; } } break; case 4: if (att_prompt ()) { strcpy (s, "C "); strcat (s, date_mbl (temps = time (NULL))); strcat (s, " "); strcat (s, heure_mbl (temps)); outsln (s, strlen (s)); maj_niv (pvoie->niv1, pvoie->niv2, 5); } break; case 5: if (att_prompt ()) { /* Supression du message eventuel */ if (fin_envoi_fwd (voiecur)) { ++stat_fwd; sprintf (s, "F %ld V:%s [%ld]", ptmes->numero, pvoie->sta.indicatif.call, ptmes->taille); fbb_log (voiecur, 'M', s); } if (mess_suiv (voiecur)) { entete_envoi_fwd (voiecur); maj_niv (pvoie->niv1, pvoie->niv2, 6); } else { if (pvoie->rev_mode) { texte (T_MBL + 42); maj_niv (pvoie->niv1, 3, 0); } else pvoie->deconnect = 6; } } break; case 6: switch (toupper (*indd)) { case 'O': pvoie->t_read = (rd_list *) m_alloue (sizeof (rd_list)); pvoie->t_read->suite = NULL; pvoie->t_read->nmess = ptmes->numero; pvoie->t_read->pmess = ptmes; pvoie->enrcur = 0L; if (snd_mess (voiecur, 1) == 0) ch_niv3 (5); else ch_niv3 (7); break; case 'N': ch_niv3 (5); sprintf (s, "N B:%s V:%s", ptmes->bid, pvoie->sta.indicatif.call); fbb_log (voiecur, 'M', s); break; case 'R': ch_niv3 (5); sprintf (s, "R B:%s V:%s", ptmes->bid, pvoie->sta.indicatif.call); fbb_log (voiecur, 'M', s); break; case 'L': ch_niv3 (8); pvoie->mess_egal[pvoie->nb_egal] = ptmes->numero; ++pvoie->nb_egal; sprintf (s, "L B:%s V:%s", ptmes->bid, pvoie->sta.indicatif.call); fbb_log (voiecur, 'M', s); break; default: err_new_fwd (0, 9); /* pvoie->deconnect = 3; */ pvoie->deconnect = 6; break; } break; case 7: if (snd_mess (voiecur, 1) == 0) ch_niv3 (5); break; case 8: if (att_prompt ()) { /* message retarde */ if (mess_suiv (voiecur)) { entete_envoi_fwd (voiecur); maj_niv (pvoie->niv1, pvoie->niv2, 6); } else { if (pvoie->rev_mode) { texte (T_MBL + 42); maj_niv (pvoie->niv1, 3, 0); } else pvoie->deconnect = 6; } } break; } } /* * REVERSE - FORWARDING */ static void snd_rev_fwd (void) { int test; int res; switch (pvoie->niv3) { case 0: if (toupper (*indd) == 'S') { if (toupper (indd[1]) == 'X') { /* Forward xfwd */ maj_niv (N_XFWD, 1, 0); xfwd (); return; } ++indd; if (lit_com_fwd () == 0) { texte (T_MBL + 44); texte (T_MBL + 42); return; } res = deja_recu (ptmes, 1, &test); mark_reverse_bid (ptmes, 1, &test); switch (res) { case 0: texte (T_MBL + 46); maj_niv (pvoie->niv1, pvoie->niv2, 1); break; case 4: if (pvoie->mbl_ext) { outln ("REJECT", 6); texte (T_MBL + 42); return; } case 2: if (pvoie->mbl_ext) { outln ("LATER", 5); texte (T_MBL + 42); return; } case 1: texte (T_MBL + 45); texte (T_MBL + 42); /* supprimer de la liste des propositions */ return; } } else /* if (att_prompt()) */ pvoie->deconnect = 6; break; case 1: if (*indd) { rcv_titre (); maj_niv (pvoie->niv1, pvoie->niv2, 2); if (*indd) get_mess_fwd ('<', indd, nb_trait, 1); } break; case 2: get_mess_fwd ('<', data, nb_trait, 1); break; default: fbb_error (ERR_NIVEAU, "SND-REV-FWD", pvoie->niv3); break; } } void rcv_rev_fwd (void) { char s[256]; switch (pvoie->niv3) { case 0: appel_rev_fwd (TRUE); if (mess_suiv (voiecur)) { libere_tread (voiecur); entete_envoi_fwd (voiecur); ch_niv3 (1); } else { texte (T_MBL + 47); retour_menu (N_MBL); deconnexion (voiecur, 1); } break; case 1: switch (toupper (*indd)) { case 'O': pvoie->t_read = (rd_list *) m_alloue (sizeof (rd_list)); pvoie->t_read->suite = NULL; pvoie->t_read->nmess = ptmes->numero; pvoie->t_read->pmess = ptmes; pvoie->enrcur = 0L; if (snd_mess (voiecur, 1) == 0) ch_niv3 (2); else ch_niv3 (3); break; case 'N': ch_niv3 (2); sprintf (s, "N B:%s V:%s", ptmes->bid, pvoie->sta.indicatif.call); fbb_log (voiecur, 'M', s); break; case 'L': ch_niv3 (4); pvoie->mess_egal[pvoie->nb_egal] = ptmes->numero; ++pvoie->nb_egal; sprintf (s, "L B:%s V:%s", ptmes->bid, pvoie->sta.indicatif.call); fbb_log (voiecur, 'M', s); break; case 'R': ch_niv3 (2); sprintf (s, "R B:%s V:%s", ptmes->bid, pvoie->sta.indicatif.call); fbb_log (voiecur, 'M', s); break; default: err_new_fwd (0, 9); pvoie->deconnect = 6; /* retour_menu(N_MBL) ; */ break; } break; case 2: if (att_prompt ()) { /* Le message a ete envoye */ fin_envoi_fwd (voiecur); sprintf (s, "> %ld V:%s [%ld]", ptmes->numero, pvoie->sta.indicatif.call, ptmes->taille); fbb_log (voiecur, 'M', s); ++stat_fwd; if (mess_suiv (voiecur)) { entete_envoi_fwd (voiecur); ch_niv3 (1); } else { texte (T_MBL + 47); retour_menu (N_MBL); deconnexion (voiecur, 1); } } break; case 3: if (snd_mess (voiecur, 1) == 0) ch_niv3 (2); break; case 4: if (att_prompt ()) { /* Le message a ete retarde */ if (mess_suiv (voiecur)) { entete_envoi_fwd (voiecur); ch_niv3 (1); } else { texte (T_MBL + 47); retour_menu (N_MBL); deconnexion (voiecur, 1); } } break; } } static int sysop_mess (void) { return ((*ptmes->bbsv == '\0') && ((strcmp (ptmes->desti, "SYSOP") == 0) || (strcmp (ptmes->desti, admin) == 0))); } static int rcv_fwd (void) { int test; int len; int res; char *ptr; char clog = (pvoie->mode & F_FOR) ? 'W' : 'S'; switch (pvoie->niv3) { case 0: if (FOR (pvoie->mode)) { if (lit_com_fwd () == 0) { libere (voiecur); texte (T_MBL + 44); retour_menu (N_MBL); return (0); } res = deja_recu (ptmes, 1, &test); mark_reverse_bid (ptmes, 1, &test); switch (res) { case 0: texte (T_MBL + 46); maj_niv (pvoie->niv1, pvoie->niv2, 3); break; case 4: if (pvoie->mbl_ext) { outln ("REJECT", 6); libere (voiecur); retour_menu (N_MBL); return (0); } case 2: if (pvoie->mbl_ext) { outln ("LATER", 5); libere (voiecur); retour_menu (N_MBL); return (0); } case 1: texte (T_MBL + 45); libere (voiecur); retour_menu (N_MBL); /* supprimer de la liste des propositions */ return (0); } } else { len = 0; ptr = indd; while (ISGRAPH (*ptr)) { ++len; ++ptr; } if (len > 1) return (1); if (lit_com_fwd () == 0) { retour_mbl (); return (0); } if (sysop_mess ()) { if (pvoie->read_only) strcpy (ptmes->desti, admin); } else if (read_only ()) { outln ("Message to SYSOP only !", 23); retour_mbl (); return (0); } if (deja_recu (ptmes, 1, &test) == 1) { texte (T_MBL + 21); retour_mbl (); return (0); } maj_niv (15, 0, 1); texte (T_MBL + 5); } break; case 1: if (!rcv_titre ()) { retour_mbl (); } else { maj_niv (15, 0, 2); texte (T_MBL + 6); if ((sed) && (EditorOff) && (voiecur == CONSOLE)) { aff_etat ('E'); #ifdef __LINUX__ if (daemon_mode) editor_request = 1; #endif reply = 3; send_buf (voiecur); pvoie->enrcur = 0L; #ifdef __WINDOWS__ maj_niv (N_MBL, 3, 0); if (win_edit () == 5) end_win_edit (); #endif #ifdef __LINUX__ if (!daemon_mode) { maj_niv (N_MBL, 3, 0); if (xfbb_edit () == 5) end_xfbb_edit (); } #endif #ifdef __FBBDOS__ maj_niv (N_MBL, 3, 0); if (mini_edit () == 5) end_mini_edit (); #endif } } break; case 2: get_mess_fwd (clog, indd, nb_trait, 0); break; case 3: if (!rcv_titre ()) { retour_mbl (); } else { maj_niv (pvoie->niv1, pvoie->niv2, 4); if (*indd) { get_mess_fwd (clog, indd, nb_trait, 0); } } break; case 4: get_mess_fwd (clog, indd, nb_trait, 0); break; default: fbb_error (ERR_NIVEAU, "RCV-FWD", pvoie->niv3); break; } return (0); } int fwd (void) { int error = 0; df ("fwd", 0); switch (pvoie->niv2) { case 0: error = rcv_fwd (); break; case 1: rcv_rev_fwd (); break; case 2: snd_fwd (); break; case 3: snd_rev_fwd (); break; case 5: new_fwd (); break; default: fbb_error (ERR_NIVEAU, "FWD", pvoie->niv2); break; } ff (); return (error); } fbb-7.04j/src/fwdovl1.c0100644000175100017510000004374207726646105012746 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE FORWARDING OVERLAY 1 */ #include #define MAXNOT 10 static char *BID_STRING = "%ld_%s"; static char *ALT_STRING = "%ld-%s"; typedef struct pnot { int type[MAXNOT]; char texte[MAXNOT][41]; struct pnot *suite; } snot; static int is_not (snot *, int, char *); static int test_forward_nts (int); static void libere_not (snot *); static int nb_bbs; long next_num (void) { char type; unsigned record; unsigned num_indic; if (ptmes->numero == 0L) { ptmes->numero = ++nomess; if ((ptmes->numero % 0x10000L) == 0) ptmes->numero = ++nomess; pvoie->mess_recu = 0; insnoeud (ptmes->desti, &num_indic); type = ptmes->type; ptmes->type = '\0'; ouvre_dir (); write_dir (0, ptmes); record = length_dir (); write_dir (record, ptmes); ferme_dir (); ptmes->type = type; insmess (record, num_indic, ptmes->numero); } return (ptmes->numero); } static int host_bbs (bullist * pbull) { int retour = 0; ind_noeud *pnoeud; unsigned no_indic; FILE *fptr; info frec; if ((is_serv (pbull->desti)) || (strcmp (pbull->desti, "SYSOP") == 0) || (!find (pbull->desti))) return (2); var_cpy (0, "\0"); if ((retour = route_wp_home (pbull)) != 0) { route_wp_hier (pbull); var_cpy (0, "WP"); } else { pnoeud = insnoeud (pbull->desti, &no_indic); if (pnoeud->coord != 0xffff) { fptr = ouvre_nomenc (); fseek (fptr, (long) pnoeud->coord * sizeof (frec), 0); fread (&frec, sizeof (info), 1, fptr); ferme (fptr, 39); if (*frec.home) { strcpy (pbull->bbsv, frec.home); retour = 1; var_cpy (0, "H"); } } } return (retour); } int chercher_voie (nom) char *nom; { int i; /* en sortie : -1 si nom n'est pas connecte, numero de voie si connecte */ for (i = 1; i < NBVOIES - 1; i++) if ((svoie[i]->sta.connect) && (indcmp (svoie[i]->sta.indicatif.call, nom))) return (i); return (-1); } void make_bid (void) { char ligne[80]; long num; char *bid_str = BID_STRING; if (std_header & 1024) bid_str = ALT_STRING; if (!isalnum (*ptmes->bid)) { if ((*pvoie->mess_bid) && ((std_header & 64) == 0)) strn_cpy (12, ligne, pvoie->mess_bid); else if (pvoie->mess_num > 0L) { num = (pvoie->mess_num % 0x10000L); sprintf (ligne, bid_str, num, bbs_via (pvoie->mess_home)); } else { num = (ptmes->numero % 0x10000L); sprintf (ligne, bid_str, num, mycall); } strn_cpy (12, ptmes->bid, ligne); } } int fwd_get (register char *buffer) { if (EMS_FWD_OK ()) { return (read_exms_string (FORWARD, buffer)); } if (*fwd_scan == '\032') return (0); while ((*buffer++ = *fwd_scan++) != '\0'); return (1); } #define BBS_LEN 6 static void in_bbs (char *bbs) { int i; char *ptr = data; for (i = 0; i < nb_bbs; i++) { if (strcmp (bbs, ptr) == 0) return; ptr += (BBS_LEN + 1); } strn_cpy (BBS_LEN, ptr, bbs); ++nb_bbs; } static void out_bbs (void) { int i; char *ptr = data; if (nb_bbs == 0) out (" ?????? ", 8); else { qsort ((void *) data, nb_bbs, BBS_LEN + 1, (int (*)(const void *, const void *)) strcmp); for (i = 0; i < nb_bbs; i++) { out (" ", 1); out (ptr, strlen (ptr)); ptr += (BBS_LEN + 1); } out (" ", 2); } } int already_forw (char *masque, int nobbs) { return (masque[(nobbs - 1) / 8] & (1 << ((nobbs - 1) % 8))); } void set_bit_fwd (char *masque, int nobbs) { if (nobbs) masque[(nobbs - 1) / 8] |= (1 << ((nobbs - 1) % 8)); } void clr_bit_fwd (char *masque, int nobbs) { if (nobbs) masque[(nobbs - 1) / 8] &= (~(1 << ((nobbs - 1) % 8))); } static int is_not (snot * t_not, int type, char *texte) { int nb; char *ptr; while (t_not) { for (nb = 0; nb < MAXNOT; nb++) { ptr = t_not->texte[nb]; if (*ptr == '\0') break; if ((t_not->type[nb] == type) && (strmatch (texte, ptr))) { return (1); } } t_not = t_not->suite; } return (0); } static void libere_not (snot * t_not) { snot *p_not; /* Libere la listes NOT */ while (t_not) { p_not = t_not->suite; m_libere (t_not, sizeof (snot)); t_not = p_not; } } void libere_route (int voie) { Svoie *vptr = svoie[voie]; Route *r_ptr; while ((r_ptr = vptr->r_tete) != NULL) { vptr->r_tete = r_ptr->suite; m_libere (r_ptr, sizeof (Route)); } } int test_forward (int valid) { char *pcom; char ligne[80], combuf[80]; int nobbs = 0, type, nb, i, lig = 0; long num; int route = 0, fwd_ok = 0; int not_b = 0, not_g = 0, not_h = 0; int ping_pong = 0; int route_bbs = 0; char *bbs_v; snot *t_not, *p_not; char *bid_str = BID_STRING; if (ptmes->type == 'T') return (test_forward_nts (valid)); if (std_header & 1024) bid_str = ALT_STRING; t_not = p_not = NULL; nb = MAXNOT; bbs_v = bbs_via (ptmes->bbsv); nb_bbs = 0; rewind_fwd (); if ((ptmes->type != 'B') && (strcmp (ptmes->desti, "SYSOP") != 0)) pvoie->messdate = 0L; /* TEST SUR LES BULLETINS */ if ((pvoie->messdate == 0L) || ((pvoie->messdate) && ((time (NULL) - pvoie->messdate) < (86400L * nb_jour_val)))) { while (fwd_get (combuf)) { pcom = combuf; ++lig; switch (type = *pcom++) { case '!': /* Not ! */ if (!route) break; switch (type = *pcom++) { case 'B': case 'F': case 'G': case 'H': if (nb == MAXNOT) { if (p_not) { p_not->suite = (snot *) m_alloue (sizeof (snot)); p_not = p_not->suite; } else { t_not = p_not = (snot *) m_alloue (sizeof (snot)); } for (i = 0; i < MAXNOT; i++) *(p_not->texte[i]) = '\0'; p_not->suite = NULL; nb = 0; } p_not->type[nb] = type; strn_cpy (40, p_not->texte[nb], pcom); ++nb; break; } break; case 'A': /* recuperer le No et le nom de la BBS destinataire */ route = 0; route_bbs = 0; nobbs = num_bbs (pcom); if (is_route (pcom)) { set_bit_fwd (ptmes->forw, nobbs); break; } strcpy (ligne, pcom); if (already_forw (ptmes->forw, nobbs)) break; route = 1; libere_not (t_not); t_not = p_not = NULL; nb = MAXNOT; not_b = not_g = not_h = 0; break; case 'G': /* indication de groupe */ if (!route) break; route_bbs = 0; if ((*bbs_v) && (ptmes->status == '$')) { if ((not_g) || (is_not (t_not, type, bbs_v))) { not_g = 1; } else if (strmatch (bbs_v, pcom)) { if (indcmp (pvoie->sta.indicatif.call, ligne) == 0) { if (!(FOR (pvoie->mode))) { in_bbs (ligne); } set_bit_fwd (ptmes->fbbs, nobbs); fwd_ok = 1; } else { set_bit_fwd (ptmes->forw, nobbs); } } } break; case 'H': /* indication de Hierarchie */ if (!route) break; route_bbs = 0; if ((*ptmes->bbsv) && (ptmes->status != '$')) { if ((not_h) || (is_not (t_not, type, ptmes->bbsv))) { not_h = 1; } else if (strmatch (ptmes->bbsv, pcom)) { if (((pvoie->mode & F_FOR) == 0) || (indcmp (pvoie->sta.indicatif.call, ligne) == 0)) { set_bit_fwd (ptmes->fbbs, nobbs); fwd_ok = 1; if (!(FOR (pvoie->mode))) { in_bbs (ligne); } } else { /* Ping Pong ! */ /* dde_warning(W_PPG); */ ping_pong = 1; } } } break; case 'B': /* indication de BBS */ if (!route) break; route_bbs = 1; if ((*bbs_v) && (ptmes->status != '$')) { if ((not_b) || (is_not (t_not, type, bbs_v))) { not_b = 1; } else if (strmatch (bbs_v, pcom)) { if (((pvoie->mode & F_FOR) == 0) || (indcmp (pvoie->sta.indicatif.call, ligne) == 0)) { set_bit_fwd (ptmes->fbbs, nobbs); fwd_ok = 1; if (!(FOR (pvoie->mode))) { in_bbs (ligne); } } else { /* Ping Pong ! */ /* dde_warning(W_PPG); */ ping_pong = 1; } } } break; case 'F': /* indication de routage */ if (!route) break; if (is_not (t_not, type, pcom)) break; if ((*bbs_v == '\0') && (find (ptmes->desti))) { /* Redirection d'un destinataire prive */ if ((!not_b) && (strmatch (ptmes->desti, pcom))) { if (((pvoie->mode & F_FOR) == 0) || (indcmp (pvoie->sta.indicatif.call, ligne) == 0)) { set_bit_fwd (ptmes->fbbs, nobbs); fwd_ok = 1; if (!(FOR (pvoie->mode))) { in_bbs (ligne); } } else { /* Ping Pong ! */ /* dde_warning(W_PPG); */ ping_pong = 1; } } } else if (route_bbs == 0) { /* Routage sur le destinataire */ if ((!not_b) && (strmatch (ptmes->desti, pcom))) { if (indcmp (pvoie->sta.indicatif.call, ligne) == 0) { set_bit_fwd (ptmes->fbbs, nobbs); fwd_ok = 1; if (!(FOR (pvoie->mode))) { in_bbs (ligne); } } } } break; default: break; } } } else { ptmes->status = 'X'; } if (*(ptmes->bid) == '\0') strcpy (ptmes->bid, " "); if (!FOR (pvoie->mode)) { if (fwd_ok) { texte (T_MBL + 40); out_bbs (); } } if ((valid) && (*ptmes->bid)) { if (*ptmes->bid == ' ') { if ((*pvoie->mess_bid) && ((std_header & 64) == 0)) strn_cpy (12, ptmes->bid, pvoie->mess_bid); else if (pvoie->mess_num > 0L) { num = (pvoie->mess_num % 0x10000L); sprintf (ligne, bid_str, num, bbs_via (pvoie->mess_home)); } else { num = (ptmes->numero % 0x10000L); sprintf (ligne, bid_str, num, mycall); } strn_cpy (12, ptmes->bid, ligne); } if (!FOR (pvoie->mode)) { if (ptmes->type == 'P') out ("Mid: $R ", 9); else out ("Bid: $R ", 9); } if (valid == 1) w_bid (); } if ((ping_pong) && (!fwd_ok)) dde_warning (W_PPG); libere_not (t_not); libere_route (voiecur); return (fwd_ok); } static int test_forward_nts (int valid) { char *pcom; char desti[80], ligne[80], combuf[80]; /* char wtexte[256] ; */ int nobbs = 0, type, nb, i, lig = 0; long num; int route = 0, fwd_ok = 0; int not_z = 0; int ping_pong = 0; snot *t_not, *p_not; char *bid_str = BID_STRING; if (std_header & 1024) bid_str = ALT_STRING; t_not = p_not = NULL; nb = MAXNOT; strcpy (desti, ptmes->desti); rewind_fwd (); if ((pvoie->messdate == 0L) || ((pvoie->messdate) && ((time (NULL) - pvoie->messdate) < (86400L * nb_jour_val)))) { while (fwd_get (combuf)) { pcom = combuf; ++lig; switch (type = *pcom++) { case '!': /* Not ! */ if (!route) break; switch (type = *pcom++) { case 'Z': if (nb == MAXNOT) { if (p_not) { p_not->suite = (snot *) m_alloue (sizeof (snot)); p_not = p_not->suite; } else { t_not = p_not = (snot *) m_alloue (sizeof (snot)); } for (i = 0; i < MAXNOT; i++) *(p_not->texte[i]) = '\0'; p_not->suite = NULL; nb = 0; } p_not->type[nb] = type; strn_cpy (40, p_not->texte[nb], pcom); ++nb; break; } break; case 'A': /* recuperer le No et le nom de la BBS destinataire */ route = 0; nobbs = num_bbs (pcom); if (is_route (pcom)) { set_bit_fwd (ptmes->forw, nobbs); break; } strcpy (ligne, pcom); if (already_forw (ptmes->forw, nobbs)) break; route = 1; libere_not (t_not); t_not = p_not = NULL; nb = MAXNOT; not_z = 0; break; case 'Z': /* indication de route */ if (!route) break; if ((not_z) || (is_not (t_not, type, desti))) { not_z = 1; } else if (strmatch (desti, pcom)) { if (((pvoie->mode & F_FOR) == 0) || (indcmp (pvoie->sta.indicatif.call, ligne) == 0)) { set_bit_fwd (ptmes->fbbs, nobbs); fwd_ok = 1; if (!(FOR (pvoie->mode))) { in_bbs (ligne); } } else { /* Ping Pong ! */ ping_pong = 1; } } break; default: break; } } } else { ptmes->status = 'X'; } if (!FOR (pvoie->mode)) { if (fwd_ok) { texte (T_MBL + 40); out_bbs (); } } if (*(ptmes->bid) == '\0') strcpy (ptmes->bid, " "); if ((valid) && (!FOR (pvoie->mode))) out (" ", 2); if ((valid) && (*ptmes->bid)) { if (*ptmes->bid == ' ') { if ((*pvoie->mess_bid) && ((std_header & 64) == 0)) strn_cpy (12, ptmes->bid, pvoie->mess_bid); else if (pvoie->mess_num > 0L) { num = (pvoie->mess_num % 0x10000L); sprintf (ligne, bid_str, num, bbs_via (pvoie->mess_home)); } else { num = (ptmes->numero % 0x10000L); sprintf (ligne, bid_str, num, mycall); } strn_cpy (12, ptmes->bid, ligne); } if (!FOR (pvoie->mode)) { if (ptmes->type == 'P') out ("Mid: $R ", 9); else out ("Bid: $R ", 9); } if (valid != 2) w_bid (); } if ((ping_pong) && (!fwd_ok)) dde_warning (W_PPG); libere_not (t_not); libere_route (voiecur); return (fwd_ok); } int reacheminement (void) { static int boucle = 0; int achemine_trouve; int nts_trouve; int route_bbs; int type = 0; int nb; int i; char *pcom; char combuf[80]; char ligne[257]; char desti[10]; char *bbs_v; int not_b = 0, not_g = 0, not_h = 0, not_z = 0; snot *t_not, *p_not; df ("reacheminement", 0); pvoie->warning = 0; route_bbs = 0; t_not = p_not = NULL; nb = MAXNOT; strcpy (desti, ptmes->desti); bbs_v = bbs_via (ptmes->bbsv); if (hiecmp (mypath, ptmes->bbsv)) { *ptmes->bbsv = '\0'; ff (); return (1); } /* S'il y a une route est specifiee, l'acheminement existe-t-il ? */ achemine_trouve = (*ptmes->bbsv == '\0'); nts_trouve = (ptmes->type != 'T'); if (!nts_trouve) { /* L'acheminement est trouve, routage sur le desti ... */ achemine_trouve = TRUE; } else if (achemine_trouve) { switch (host_bbs (ptmes)) { case 2: break; case 1: if ((!FOR (pvoie->mode)) && (ptmes->type != 'B') && (*ptmes->bbsv)) texte (T_MBL + 41); /* l'acheminement existe-t-il pour le home BBS ? */ achemine_trouve = 0; break; case 0: if ((!FOR (pvoie->mode)) && (EMS_WPG_OK ()) && (find (ptmes->desti)) && (*ptmes->bbsv == '\0')) texte (T_MBL + 56); } } if (hiecmp (mypath, ptmes->bbsv)) { *ptmes->bbsv = '\0'; ff (); return (1); } if (cherche_route (ptmes)) { if (!FOR (pvoie->mode)) { texte (T_MBL + 41); } } bbs_v = bbs_via (ptmes->bbsv); rewind_fwd (); while (fwd_get (combuf)) { pcom = combuf; switch (*pcom++) { case '!': /* Not ! */ switch (type = *pcom++) { case 'B': case 'G': case 'H': case 'Z': case 'F': if (nb == MAXNOT) { if (p_not) { p_not->suite = (snot *) m_alloue (sizeof (snot)); p_not = p_not->suite; } else { t_not = p_not = (snot *) m_alloue (sizeof (snot)); } for (i = 0; i < MAXNOT; i++) *(p_not->texte[i]) = '\0'; p_not->suite = NULL; nb = 0; } p_not->type[nb] = type; strn_cpy (40, p_not->texte[nb], pcom); ++nb; break; } break; case 'A': route_bbs = 0; libere_not (t_not); t_not = p_not = NULL; nb = MAXNOT; not_b = not_g = not_h = not_z = 0; case 'B': /* recuperer le nom de la BBS destinataire */ route_bbs = 1; strcpy (ligne, pcom); if ((not_b) || (is_not (t_not, type, bbs_v))) { not_b = 1; break; } if ((ptmes->status != '$') && (!achemine_trouve) && (strmatch (bbs_v, pcom))) { achemine_trouve = TRUE; } break; case 'H': /* test des hierarchies */ route_bbs = 0; if ((not_h) || (is_not (t_not, type, bbs_v))) { not_h = 1; break; } if ((ptmes->status != '$') && (!achemine_trouve) && (strmatch (ptmes->bbsv, pcom))) { achemine_trouve = TRUE; } break; case 'G': /* test du groupe */ route_bbs = 0; if ((not_g) || (is_not (t_not, type, bbs_v))) { not_g = 1; break; } if ((ptmes->status == '$') && (!achemine_trouve) && (strmatch (bbs_v, pcom))) { achemine_trouve = TRUE; } break; case 'Z': /* Route NTS */ route_bbs = 1; if ((not_z) || (is_not (t_not, type, desti))) { not_z = 1; break; } if ((ptmes->type == 'T') && (!nts_trouve) && (strmatch (desti, pcom))) nts_trouve = TRUE; break; case 'F': /* chercher les messages de l'OM associe a la BBS */ if (is_not (t_not, type, pcom)) break; if ((*(ptmes->bbsv) == '\0') && (strmatch (ptmes->desti, pcom))) { /* (indcmp(ptmes->desti, pcom))) { */ if ((route_bbs) && (find (ptmes->desti))) { strcpy (ptmes->bbsv, ligne); } achemine_trouve = TRUE; if (cherche_route (ptmes)) { if ((!FOR (pvoie->mode)) && (ptmes->type != 'B')) { texte (T_MBL + 41); } } } break; default: break; } } libere_not (t_not); if (!achemine_trouve) { dde_warning (W_ROU); if (!FOR (pvoie->mode)) texte (T_MBL + 49); } if (!nts_trouve) { dde_warning (W_NTS); if (!FOR (pvoie->mode)) { strcpy (ligne, ptmes->bbsv); strcpy (ptmes->bbsv, desti); texte (T_MBL + 49); strcpy (ptmes->bbsv, ligne); } } ff (); boucle = 0; return (1); } fbb-7.04j/src/fwdovl2.c0100644000175100017510000005761107726646105012747 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE FORWARDING OVERLAY 2 */ #include static int tst_line (char *, int); static int tst_var (char *); char *idnt_fwd (void) { static char buffer[25]; char *ptr = buffer; *ptr++ = '['; *ptr++ = 'F'; *ptr++ = 'B'; *ptr++ = 'B'; *ptr++ = '-'; *ptr++ = '0' + MAJEUR; *ptr++ = '.'; *ptr++ = '0' + MINEUR / 10; *ptr++ = '0' + MINEUR % 10; #ifdef LETTRE *ptr++ = LETTRE; #endif *ptr++ = '-'; *ptr++ = 'A'; if (pvoie->prot_fwd & FWD_FBB) { if (pvoie->prot_fwd & FWD_BIN) { *ptr++ = 'B'; if (pvoie->prot_fwd & FWD_BIN1) *ptr++ = '1'; } *ptr++ = 'F'; } *ptr++ = 'H'; *ptr++ = 'M'; if (pvoie->mbl_ext) *ptr++ = 'R'; if (pvoie->prot_fwd & FWD_XPRO) *ptr++ = 'X'; *ptr++ = '$'; *ptr++ = ']'; *ptr++ = '\r'; *ptr++ = '\0'; return (buffer); } #ifdef __LINUX__ int nbcan_linux (void) { int nbcan = 0; int i; for (i = 1; i < NBPORT; i++) if (S_LINUX (i)) nbcan += p_port[i].nb_voies; return (nbcan); } #endif int nbcan_hst (void) { int nbcan = 0; int i; for (i = 1; i < NBPORT; i++) if ((HST (i)) && (p_port[i].ccanal != 0)) nbcan += p_port[i].nb_voies; return (nbcan); } int nbcan_drsi (void) { int nbcan = 0; int i; for (i = 1; i < NBPORT; i++) if (DRSI (i)) nbcan += p_port[i].nb_voies; return (nbcan); } int nbcan_bpq (void) { int nbcan = 0; int i; for (i = 1; i < NBPORT; i++) if (BPQ (i)) nbcan += p_port[i].nb_voies; return (nbcan); } int ch_voie (int port, int canal) { /* * Cherche une voie libre sur un port. * Commence par la derniere voie du port * * Si canal != 0, essaye d'allouer le canal specifie. */ int i, j; if (port == 0) { if (svoie[INEXPORT]->sta.connect) return (-1); return (1); } if (save_fic) return (-1); if (p_port[port].pvalid == 0) return (-1); if (DRSI (port)) { if (port_free (port) == 0) return (-1); if (canal) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == canal) && (DRSI (no_port (j))) && (!svoie[j]->sta.connect) && (!voie_forward (j))) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; init_fb_mess (j); return (j); } } } else { for (i = nbcan_drsi (); i > 0; i--) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == i) && (DRSI (no_port (j))) && (!svoie[j]->sta.connect) && (!voie_forward (j))) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; init_fb_mess (j); return (j); } } } } } else if (BPQ (port)) { if (port_free (port) == 0) return (-1); if (canal) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == canal) && (BPQ (no_port (j))) && (!svoie[j]->sta.connect) && (!voie_forward (j))) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; init_fb_mess (j); return (j); } } } else { for (i = nbcan_bpq (); i > 0; i--) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == i) && (BPQ (no_port (j))) && (!svoie[j]->sta.connect) && (!voie_forward (j))) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; init_fb_mess (j); return (j); } } } } } #ifdef __LINUX__ else if (S_LINUX (port)) { if (port_free (port) == 0) return (-1); if (canal) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == canal) && (S_LINUX (no_port (j))) && (!svoie[j]->sta.connect) && (!voie_forward (j))) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; init_fb_mess (j); return (j); } } } else { for (i = nbcan_linux (); i > 0; i--) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == i) && (S_LINUX (no_port (j))) && (!svoie[j]->sta.connect) && (!voie_forward (j))) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; init_fb_mess (j); return (j); } } } } } #endif if (HST (port)) { int com = p_port[port].ccom; if (port_free (port) == 0) return (-1); if (p_port[port].ccanal == 0) { /* Port Pactor. Cherche la voie correspondante */ for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == PACTOR_CH) && (HST (no_port (j))) && (p_port[no_port (j)].ccom == com) && (!svoie[j]->sta.connect) && (!voie_forward (j))) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; init_fb_mess (j); return (j); } } return (-1); } if (canal) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == canal) && (HST (no_port (j))) && (p_port[no_port (j)].ccom == com) && (!svoie[j]->sta.connect) && (!voie_forward (j))) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; init_fb_mess (j); return (j); } } } else { for (i = nbcan_hst (); i > 0; i--) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == i) && (HST (no_port (j))) && (p_port[no_port (j)].ccom == com) && (!svoie[j]->sta.connect) && (!voie_forward (j))) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; init_fb_mess (j); return (j); } } } } } else { if (canal) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.port == port) && (svoie[j]->affport.canal == canal) && (!svoie[j]->sta.connect) && (!voie_forward (j))) { for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; init_fb_mess (j); return (j); } } } else { for (i = p_port[port].nb_voies; i > 0; i--) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.port == port) && (svoie[j]->affport.canal == i) && (!svoie[j]->sta.connect) && (!voie_forward (j))) { for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; init_fb_mess (j); return (j); } } } } } return (-1); } static char *check_call (char *ptr) { char *scan = ptr; while (*scan > ' ') ++scan; if (*scan == '\0') scan = ptr; else { while ((*scan) && (isspace (*scan))) ++scan; if (isgraph(*scan) && !isalnum(*scan)) /* Pactor - ! ou % */ ++scan; if ((isdigit (*scan)) && (!isalnum (*(scan + 1)))) { ++scan; while ((*scan) && (!isalnum (*scan))) ++scan; } } return (scan); } int connect_fwd (int voie, Forward * pfwd) { int nb; stat_fwd = 0; nb = connect_station (voie, 0, pfwd->con_lig[0]); svoie[voie]->niv1 = N_FORW; svoie[voie]->niv2 = 2; svoie[voie]->niv3 = 0; if ((DEBUG) || (!p_port[no_port (voie)].pvalid)) { pfwd->forward = -1; } return (nb); } int connect_station (int voie, int echo, char *ptr) { int port = no_port (voie); char buffer[256]; char *scan = check_call (ptr); int nb = 0, sav_voie = voiecur; svoie[voie]->debut = time (NULL); svoie[voie]->finf.lang = langue[0]->numlang; if ((DEBUG) || (!p_port[no_port (voie)].pvalid)) return (0); selvoie (voie); svoie[voie]->sta.indicatif.num = extind (scan, svoie[voie]->sta.indicatif.call); strcpy (buffer, ptr); deb_io (); switch (p_port[port].typort) { case TYP_DED: /* DED */ if (DRSI (port)) { if (strchr (ptr, ':') == NULL) { while (ISGRAPH (*ptr)) ++ptr; while (isspace (*ptr)) ++ptr; sprintf (buffer, "C %d:%s", p_port[port].ccanal, ptr); } } tnc_commande (voie, buffer, SNDCMD); break; case TYP_PK: /* PK232 */ buffer[1] = 'O'; tnc_commande (voie, buffer, SNDCMD); break; case TYP_HST: /* PTC-II */ case TYP_FLX: tnc_commande (voie, buffer, SNDCMD); break; #ifndef __LINUX__ case TYP_MOD: /* MODEM */ md_no_echo (voie); svoie[voie]->sta.stat = 1; strtok (buffer, " "); strtok (NULL, " "); scan = strtok (NULL, " "); if (scan) md_send (no_port (voie), var_txt (scan)); svoie[voie]->maj_ok = 0; break; #endif case TYP_KAM: /* KAM */ kam_commande (voie, buffer); break; #ifdef __LINUX__ case TYP_SCK: /* AX25 */ tnc_commande (voie, buffer, SNDCMD); break; #else case TYP_BPQ: /* BPQ */ command = 1; sta_drv (voie, CMDE, (void *) &command); break; #endif #ifdef __LINUX__ case TYP_TCP: /* TELNET */ case TYP_ETH: /* ETHER-LINK */ tnc_commande (voie, buffer, SNDCMD); break; #endif #ifdef __WINDOWS__ case TYP_ETH: /* ETHER-LINK */ { tnc_commande (voie, buffer, SNDCMD); } break; case TYP_TCP: /* TELNET */ { tnc_commande (voie, buffer, SNDCMD); } break; case TYP_AGW: /* AX25 */ tnc_commande (voie, buffer, SNDCMD); break; #endif } fin_io (); /* Au cas ou pas de SID ... */ svoie[voie]->fbb = 0; svoie[voie]->mbl_ext = 0; svoie[voie]->sta.connect = 1; svoie[voie]->maj_ok = 0; selvoie (sav_voie); if ((echo) && (nb)) outln (buffer, nb); status (voie); return (nb); } static int tst_line (char *ptr, int val) { int nb; while ((*ptr) && (!isdigit (*ptr))) ptr++; while (*ptr) { nb = 0; while ((*ptr) && (!ISGRAPH (*ptr))) ptr++; if (*ptr == '*') return (FALSE); while (isdigit (*ptr)) { nb *= 10; nb += (*ptr++ - '0'); } while ((*ptr) && (!ISGRAPH (*ptr))) ptr++; if (isalpha (*ptr)) { if (val == nb) return (TRUE); else return (FALSE); } switch (*ptr++) { case ',': if (val == nb) return (TRUE); break; case '-': if (val >= nb) { nb = 0; while ((*ptr) && (!ISGRAPH (*ptr))) ptr++; while (isdigit (*ptr)) { nb *= 10; nb += (*ptr++ - '0'); } if (val <= nb) return (TRUE); } break; case '\n': case 0: if (val == nb) return (TRUE); return (FALSE); default: #ifdef ENGLISH cprintf ("Error in time list \r\n"); #else cprintf ("Erreur liste horaire\r\n"); #endif return (FALSE); } } return (FALSE); } void swap_port (char *port_name) { int port; int trouve = 0; strupr (port_name); for (port = 1; port < NBPORT; port++) { if (p_port[port].pvalid) { if (strcmp (port_name, p_port[port].freq) == 0) { port_name[0] = port + '@'; trouve = 1; break; } } } if ((!trouve) && (port_name[1] != '\0')) { if (!operationnel) { /* Erreur, le port n'existe pas ... */ char buf[80]; sprintf (buf, "Error : port \"%s\" in forward file does not exist", port_name); win_message (5, buf); } port_name[0] = 'A'; } port_name[1] = '\0'; } int tst_fwd (char *ptr, int nobbs, long h_time, int port, int *nb_choix, int reverse, int cur_port) { char temp[40]; int i, choix; int val; while (isspace (*ptr)) ++ptr; switch (val = toupper (*ptr)) { case 'C': /* Choix links */ if (nobbs) { while ((*ptr) && (!isdigit (*ptr))) ptr++; choix = (int) *ptr - '0'; if ((nb_choix) && (choix > *nb_choix)) { *nb_choix = choix; } if (choix == get_link (nobbs)) { return (val); } } return (FALSE); case 'D': /* Choix jour */ ++ptr; return ((tst_line (ptr, jour (h_time))) ? val : FALSE); case 'N': /* Choix No du jour */ ++ptr; return ((tst_line (ptr, nojour (h_time))) ? val : FALSE); case 'F': /* Choix port libre */ while (ISGRAPH (*ptr)) ++ptr; while (isspace (*ptr)) ++ptr; if (*ptr) { strn_cpy (39, temp, ptr); swap_port (temp); if (find (strupr (temp))) { for (i = 0; i < NBVOIES; i++) { if ((svoie[i]->sta.connect) && (strcmp (svoie[i]->sta.indicatif.call, temp) == 0)) { return (FALSE); } } } else { port = *temp - '@'; for (i = 0; i < NBVOIES; i++) { if ((svoie[i]->sta.connect) && (no_port (i) == port)) { return (FALSE); } } } } else { for (i = 0; i < NBVOIES; i++) { if ((svoie[i]->sta.connect) && (no_port (i) == port)) { return (FALSE); } } } return (val); case 'G': /* Choix heure GMT */ ++ptr; return ((tst_line (ptr, gmt_heure (h_time))) ? val : FALSE); case 'H': /* Choix heure locale */ ++ptr; return ((tst_line (ptr, heure (h_time))) ? val : FALSE); case 'M': /* Forward manuel */ ++ptr; return ((reverse) ? val : FALSE); case 'P': while (ISGRAPH (*ptr)) ++ptr; while (isspace (*ptr)) ++ptr; i = -2; if (*ptr) { strn_cpy (39, temp, ptr); swap_port (temp); i = *temp - '@'; } return ((i == cur_port) ? val : FALSE); case 'V': /* Test variable environnement */ ++ptr; return ((tst_var (ptr)) ? val : FALSE); default: return ((tst_line (ptr, heure (h_time))) ? val : FALSE); } } static int tst_var (char *chaine) { char var[80]; char val[80]; char *env; sscanf (chaine, "%s %s", var, val); env = getenv (var); if (env == NULL) return (0); return (strcmp (env, val) == 0); } void analyse_idnt (char *chaine) { char *ptr; int fin = 0; unsigned lprot_fwd = FWD_MBL; sup_ln (chaine); pvoie->sid = 1; pvoie->fbb = 1; pvoie->mbl_ext = 0; pvoie->mode |= F_FOR; if (pvoie->timout == time_n) pvoie->timout = time_b; ptr = strrchr (chaine, '-'); if (ptr) ++ptr; else ptr = chaine + 1; while (!fin) { switch (*ptr++) { case '\0': case ']': case '-': fin = 1; break; case 'H': pvoie->mode |= F_HIE; break; case 'A': pvoie->mode |= F_ACQ; break; case 'B': lprot_fwd |= FWD_BIN; if (isdigit (*ptr)) { if ((*ptr >= '1') && (bin_fwd == 2)) { pvoie->fbb = 2; lprot_fwd |= FWD_BIN1; } ++ptr; } break; case 'C': if (pvoie->clock) pvoie->clock = 2; break; case 'F': lprot_fwd |= FWD_FBB; break; case 'M': pvoie->mode |= F_MID; break; case 'R': pvoie->mbl_ext = 1; break; case 'X': lprot_fwd |= FWD_XPRO; break; case '$': pvoie->mode |= F_BID; break; default: break; } } if (lprot_fwd & FWD_FBB) { pvoie->mode |= F_FBB; /* Protocole FBB valide */ if (lprot_fwd & FWD_BIN) { pvoie->mode |= F_BIN; /* Transfert binaire valide */ } } lprot_fwd &= pvoie->prot_fwd; if ((lprot_fwd & FWD_XPRO) && (std_header & 512)) { /* XFwd prioritaire */ pvoie->mode &= (~(F_FBB | F_BIN)); lprot_fwd &= (~FWD_FBB); } if ((lprot_fwd & FWD_BIN) == 0) { lprot_fwd &= (~FWD_BIN1); } if ((lprot_fwd & FWD_FBB) == 0) { lprot_fwd &= (~(FWD_BIN | FWD_BIN1)); } pvoie->prot_fwd = lprot_fwd; aff_forward (); } int att_prompt (void) { char *ptr = indd; int modex = FALSE; int error = 0; if (*indd == '!') { incindd (); new_om = -1; accept_cnx (); return (FALSE); } if ((pvoie->nb_prompt == 0) && (*indd == '[')) modex = TRUE; if (*indd == '*') error++; while (nb_trait--) { if ((error) && (*ptr == '*')) { if (++error == 4) pvoie->deconnect = 4; break; } else error = 0; if (*ptr == '\r') { if ((pvoie->nb_prompt == 0) && (*(ptr - 1) == ']') && (modex)) { *ptr = '\0'; analyse_idnt (indd); /* Choisit le protocole en fonction des options */ /* si les deux protocoles FBB et XFWD sont OK */ if ((pvoie->prot_fwd & FWD_FBB) && (pvoie->prot_fwd & FWD_XPRO)) { if (std_header & 512) { /* XFwd prioritaire */ pvoie->prot_fwd &= (~(FWD_FBB | FWD_BIN | FWD_BIN1)); } else { /* FBB prioritaire */ pvoie->prot_fwd &= (~FWD_XPRO); } } } else if (*(ptr - 1) == '>') { if (pvoie->nb_prompt > 0) --pvoie->nb_prompt; else { if (pvoie->sid == 0) { /* Pas de SID recu -> ni fbb, ni xfwd */ pvoie->prot_fwd = 0; } return TRUE; } } else modex = FALSE; } ++ptr; } return FALSE; } static int is_duplicate_forward (int nobbs) { Forward *pfwd; int port; int nb_bbs = 0; for (port = 0; port < NBPORT; port++) { if (p_port[port].pvalid) { pfwd = p_port[port].listfwd; while (pfwd) { if (pfwd->no_bbs == nobbs) ++nb_bbs; pfwd = pfwd->suite; } } } return (nb_bbs > 1); } int mess_suiv (int voie) /* * Y a-t-il encore un message ? * Si oui, typ_mess, n_mess, enrdeb et enrcur sont mis a jour. retour TRUE . * Si non, retour FALSE . */ { long no; df ("mess_suiv", 1); if (save_fic) { ++pvoie->sta.ack; svoie[voie]->deconnect = 6; ff (); return (0); } if (svoie[voie]->bbsfwd == 0) { ff (); return (0); } /* teste si un forward est deja en cours -> pas de proposition */ if (is_duplicate_forward (svoie[voie]->bbsfwd)) { ff (); return (0); } while ((no = msg_fwd_suiv ((int) svoie[voie]->bbsfwd, svoie[voie]->maxfwd, svoie[voie]->oldfwd, svoie[voie]->typfwd, voie)) != 0L) { if (ch_record (ptmes, no, '\0')) { if ((ptmes->status == 'N') || (ptmes->status == 'Y') || (ptmes->status == '$')) { ff (); return (TRUE); } } /* Le message n'existe plus : supression de la liste */ clear_fwd (no); } ff (); return (FALSE); } void program_tnc (int voie, char *ptr) { int nb; char buffer[300]; switch (p_port[no_port (voie)].typort) { case TYP_DED: /* DED */ case TYP_HST: /* PTC */ case TYP_FLX: if (*ptr == 'B') { ++ptr; while ((*ptr) && (!ISGRAPH (*ptr))) ++ptr; nb = atoi (ptr); if ((nb >= 30) && (nb <= 250)) svoie[voie]->paclen = nb; else cprintf ("INVALID VALUE: %s\r\n", ptr); } else { if ((!DEBUG) && (p_port[no_port (voie)].pvalid)) { strcpy (buffer, ptr); tnc_commande (voie, buffer, ECHOCMD); if (*buffer) { cprintf ("%s\r\n", buffer); } } } break; case TYP_PK: /* PK232 */ if ((*ptr == 'B') && (!isgraph (*(ptr + 1)))) { ++ptr; while ((*ptr) && (!ISGRAPH (*ptr))) ++ptr; nb = atoi (ptr); if ((nb >= 10) && (nb <= 250)) svoie[voie]->paclen = nb; else cprintf ("INVALID VALUE: %s\r\n", ptr); } else { if ((!DEBUG) && (p_port[no_port (voie)].pvalid)) tnc_commande (voie, ptr, ECHOCMD); } break; case TYP_KAM: /* KAM */ if ((*ptr == 'B') && (!isgraph (*(ptr + 1)))) { ++ptr; while ((*ptr) && (!ISGRAPH (*ptr))) ++ptr; nb = atoi (ptr); if ((nb >= 30) && (nb <= 250)) svoie[voie]->paclen = nb; else cprintf ("INVALID VALUE: %s\r\n", ptr); } else { if ((!DEBUG) && (p_port[no_port (voie)].pvalid)) kam_commande (voie, ptr); } break; case TYP_BPQ: /* BPQ */ if ((*ptr == 'B') && (!isgraph (*(ptr + 1)))) { ++ptr; while ((*ptr) && (!ISGRAPH (*ptr))) ++ptr; nb = atoi (ptr); if ((nb == 0) || ((nb >= 30) && (nb <= 250))) svoie[voie]->paclen = nb; else cprintf ("INVALID VALUE: %s\r\n", ptr); } break; #ifdef __WINDOWS__ case TYP_AGW: /* AGW */ if (*ptr == 'B') { ++ptr; while ((*ptr) && (!ISGRAPH (*ptr))) ++ptr; nb = atoi (ptr); if ((nb >= 30) && (nb <= 250)) svoie[voie]->paclen = nb; else cprintf ("INVALID VALUE: %s\r\n", ptr); } else { if ((!DEBUG) && (p_port[no_port (voie)].pvalid)) { strcpy (buffer, ptr); tnc_commande (voie, buffer, ECHOCMD); if (*buffer) { cprintf ("%s\r\n", buffer); } } } break; #endif } } void program_fwd (int affiche, int fwd, typ_pfwd ** ptnc, int voie) { char *ptr; typ_pfwd *pcurr, *ptemp; #ifdef __LINUX__ typ_pfwd *prev; int done; int nbdos; char *list[25]; /* 25 taches DOS max */ #endif #ifdef __WINDOWS__ typ_pfwd *prev; int done; int nbdos; char *list[25]; /* 25 taches DOS max */ #endif #ifdef __FBBDOS__ char s[80]; fen *fen_ptr; #endif pcurr = *ptnc; if (pcurr == NULL) return; #if defined(__WINDOWS__) prev = NULL; while (pcurr) { ptr = pcurr->chaine; if (voie) { done = 0; if (pcurr->type) { /* Commande DOS */ if (strncmpi (ptr, "PTCTRX", 6) == 0) { ptctrx (no_port (voie), ptr); done = 1; } /* DLL Actions */ else if (call_dll (ptr, NO_REPORT_MODE, NULL, 0, NULL) != -1) { done = 1; } } else { /* Programm TNC */ if (fwd) program_tnc (voie, ptr); done = 1; } } else done = 1; if (done) { /* Enleve la cammande de la liste */ ptemp = pcurr; if (prev) { prev->suiv = pcurr->suiv; pcurr = pcurr->suiv; } else { /* Tete de liste ... */ *ptnc = pcurr = pcurr->suiv; } m_libere (ptemp, sizeof (typ_pfwd)); } else { prev = pcurr; pcurr = pcurr->suiv; } } /* Runs the DOS actions */ pcurr = *ptnc; if (pcurr == NULL) return; nbdos = 0; while (pcurr) { ptr = pcurr->chaine; if (voie) { if (pcurr->type) { if (nbdos < 25) list[nbdos++] = pcurr->chaine; } } pcurr = pcurr->suiv; } if (nbdos) call_nbdos (list, nbdos, NO_REPORT_MODE, NULL, TOOLDIR, NULL); /* Frees the list */ while (pcurr) { ptemp = pcurr; pcurr = pcurr->suiv; m_libere (ptemp, sizeof (typ_pfwd)); } #endif #if defined(__LINUX__) prev = NULL; while (pcurr) { ptr = pcurr->chaine; if (voie) { done = 0; if (pcurr->type) { /* Commande DOS */ if (strncmpi (ptr, "PTCTRX", 6) == 0) { ptctrx (no_port (voie), ptr); done = 1; } } else { /* Programm TNC */ if (fwd) program_tnc (voie, ptr); done = 1; } } else done = 1; if (done) { /* Enleve la cammande de la liste */ ptemp = pcurr; if (prev) { prev->suiv = pcurr->suiv; pcurr = pcurr->suiv; } else { /* Tete de liste ... */ *ptnc = pcurr = pcurr->suiv; } m_libere (ptemp, sizeof (typ_pfwd)); } else { prev = pcurr; pcurr = pcurr->suiv; } } /* Runs the DOS actions */ pcurr = *ptnc; if (pcurr == NULL) return; nbdos = 0; while (pcurr) { ptr = pcurr->chaine; if (voie) { if (pcurr->type) { if (nbdos < 25) list[nbdos++] = pcurr->chaine; } } pcurr = pcurr->suiv; } if (nbdos) call_nbdos (list, nbdos, NO_REPORT_MODE, NULL, TOOLDIR, NULL); /* Frees the list */ while (pcurr) { ptemp = pcurr; pcurr = pcurr->suiv; m_libere (ptemp, sizeof (typ_pfwd)); } #endif #ifdef __FBBDOS__ if (affiche) { sprintf (s, "TNC Prog. Ch %d", voie); fen_ptr = open_win (50, 8, 73, 21, INIT, s); } while (pcurr) { ptr = pcurr->chaine; if (voie) { if (pcurr->type) { /* Commande DOS */ if (strncmpi (ptr, "PTCTRX", 6) == 0) { ptctrx (no_port (voie), ptr); } else { send_dos (pcurr->type, ptr, NULL); } } else { /* Programm TNC */ if (fwd) { if (affiche) cprintf ("%s\r\n", ptr); program_tnc (voie, ptr); } } } ptemp = pcurr; pcurr = pcurr->suiv; m_libere (ptemp, sizeof (typ_pfwd)); } #endif *ptnc = NULL; #ifdef __FBBDOS__ if (affiche) { sleep_ (1); close_win (fen_ptr); } #endif } fbb-7.04j/src/fwdovl3.c0100644000175100017510000006327107726646105012747 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE FORWARDING OVERLAY 3 */ #include static void seek_fwd (unsigned pos) { if (EMS_FWD_OK ()) seek_exms_string (FORWARD, (long) pos); else fwd_scan = fwd_file + pos; } void rewind_fwd (void) { seek_fwd (0); } static unsigned tell_fwd (void) { if (EMS_FWD_OK ()) return (unsigned) (tell_exms_string (FORWARD)); else return (unsigned) (fwd_scan - fwd_file); } void param_tnc (int type, typ_pfwd ** ptnc, char *cmde) { typ_pfwd *p; if (*ptnc == NULL) { *ptnc = (typ_pfwd *) m_alloue (sizeof (typ_pfwd)); p = *ptnc; } else { p = *ptnc; while (p->suiv) p = p->suiv; p->suiv = (typ_pfwd *) m_alloue (sizeof (typ_pfwd)); p = p->suiv; } p->suiv = NULL; n_cpy (78, p->chaine, cmde); p->type = type; } void libere_tnc (typ_pfwd ** ptnc) { typ_pfwd *pcurr, *ptemp; pcurr = *ptnc; while (pcurr) { ptemp = pcurr; pcurr = pcurr->suiv; m_libere (ptemp, sizeof (typ_pfwd)); } *ptnc = NULL; } int n_bbs (char *bbs) { char *ptr = bbs_ptr; int nb = 1; while (nb <= NBBBS) { if (strncmp (ptr, bbs, 6) == 0) return (nb); ++nb; ptr += 7; } return (0); } int num_bbs (char *bbs) { int nb = n_bbs (strupr (bbs)); char bbs_nom[10]; char s[80]; if (nb == 0 && !svoie[CONSOLE]->sta.connect) { strn_cpy (6, bbs_nom, bbs); #ifdef ENGLISH sprintf (s, "Unknown BBS %s in BBS.SYS file ", bbs_nom); #else sprintf (s, " BBS %s inconnue dans BBS.SYS ", bbs_nom); #endif win_message (2, s); } return (nb); } int get_link (int no_bbs) { if (no_bbs) return ((int) *(bbs_ptr + 6 + 7 * (no_bbs - 1))); else return (1); } void set_link (int no_bbs, int choix) { if (no_bbs) *(bbs_ptr + 6 + 7 * (no_bbs - 1)) = (char) choix; } static int fwd_libre (int nobbs, int noport) { int test; Forward *pfwd = p_port[noport].listfwd; test = already_forw (p_port[noport].fwd, nobbs); if (test == 0) { while (pfwd) { if (nobbs == pfwd->no_bbs) return (0); pfwd = pfwd->suite; } return (1); } else return (0); } int what_port (int n_bbs) { int temp; int trouve = 0; int fin = 0; int nobbs = 0; int cptif = 0; int fwdlig = 0; int dans_bloc = 0; int nbchoix = 1; long h_time = time (NULL); int port = -1; char combuf[80]; char *pcom; /* init_bbs() ; */ rewind_fwd (); while (!fin) { if (fwd_get (combuf) == 0) { fin = TRUE; break; } pcom = combuf; ++fwdlig; switch (*pcom++) { case 'E': /* ENDIF */ --cptif; break; case 'I': ++cptif; if (tst_fwd (pcom, nobbs, h_time, 0, &nbchoix, 0, -1) == FALSE) { temp = cptif - 1; while (cptif != temp) { if (fwd_get (combuf) == 0) { fin = TRUE; break; } pcom = combuf; ++fwdlig; switch (*pcom++) { case 'I': ++cptif; break; case 'E': --cptif; break; case '@': if (cptif == (temp + 1)) ++temp; /* else */ break; default: break; } } } break; case '@': /* ELSE */ temp = cptif - 1; while (cptif != temp) { if (fwd_get (combuf) == 0) { fin = TRUE; break; } pcom = combuf; ++fwdlig; switch (*pcom++) { case 'I': ++cptif; break; case 'E': --cptif; break; default: break; } } break; case 'P': /* Indication du port de forward */ if (dans_bloc) { *pcom = toupper (*pcom); port = *pcom - '@'; } break; case 'A': dans_bloc = port = 1; nobbs = num_bbs (pcom); trouve = (nobbs == n_bbs); break; case '-': nobbs = dans_bloc = 0; if (trouve) fin = 1; break; } } return (port); } void appel_fwd (Forward * pfwd, int noport) { uchar max, old, typ; char nombbs[80]; char combuf[80]; char *ptr; char *pcom; char mesnoeud[4][3][20]; int mesnum; int i, nobbs, port, voie = 0, temp, choix, canal; int reverse, fin, retour, con_fwd, dde_clk; int trouve, dans_bloc, fbb_mode, t_o, nbchoix; int reverse_mode, val, dans_test_port; int data_mode = 1; int nb_prompt = 0; char s[80]; #ifdef __FBBDOS__ fen *fen_ptr; #endif typ_pfwd *ptnc; typ_pfwd *ctnc; atfwd *nbmess; long h_time = time (NULL); char p_route[NB_P_ROUTE][7]; df ("appel_fwd", 3); ctnc = NULL; pfwd->lastpos = pfwd->fwdpos; do { for (i = 0; i < NB_P_ROUTE; i++) *p_route[i] = '\0'; seek_fwd (pfwd->fwdpos); /* fwd_scan = fwd_file + pfwd->fwdpos; */ ptnc = NULL; nobbs = 0; dans_test_port = 0; port = 1; reverse = pfwd->reverse; fin = FALSE; retour = 0; con_fwd = FALSE; trouve = 0; dans_bloc = 0; fbb_mode = -1; dde_clk = t_o = 0; nbchoix = 1; while (!trouve) { if (fwd_get (combuf) == 0) { fin = TRUE; retour = 0; pfwd->reverse = 0; break; } pcom = combuf; ++pfwd->fwdlig; switch (*pcom++) { case 'E': /* ENDIF */ if (dans_test_port == pfwd->cptif) dans_test_port = 0; --pfwd->cptif; break; case '@': /* ELSE */ temp = pfwd->cptif - 1; while (pfwd->cptif != temp) { if (fwd_get (combuf) == 0) { fin = TRUE; break; } pcom = combuf; ++pfwd->fwdlig; switch (*pcom++) { case 'I': ++pfwd->cptif; break; case 'E': --pfwd->cptif; break; default: break; } } break; case 'I': ++pfwd->cptif; if ((val = tst_fwd (pcom, nobbs, h_time, port, NULL, pfwd->reverse, noport)) == FALSE) { temp = pfwd->cptif - 1; while (pfwd->cptif != temp) { if (fwd_get (combuf) == 0) { fin = TRUE; break; } pcom = combuf; ++pfwd->fwdlig; switch (*pcom++) { case 'I': ++pfwd->cptif; break; case 'E': --pfwd->cptif; break; case '@': if (pfwd->cptif == (temp + 1)) ++temp; break; default: break; } } } else if (val == 'P') { dans_test_port = pfwd->cptif; } break; case 'D': if ((!dans_bloc) && ((port == noport) || (dans_test_port))) { if (strncmpi (pcom, "PTCTRX", 6) == 0) { ptctrx (port, pcom); } else { #ifdef __WINDOWS__ if (call_dll (pcom, NO_REPORT_MODE, NULL, 0, NULL) == -1) call_nbdos (&pcom, 1, NO_REPORT_MODE, NULL, NULL, NULL); #endif #ifdef __FBBDOS__ send_dos (1, pcom, NULL); #endif #ifdef __LINUX__ call_nbdos (&pcom, 1, NO_REPORT_MODE, NULL, TOOLDIR, NULL); #endif } } break; case 'L': if ((!dans_bloc) && ((port == noport) || (dans_test_port))) program_tnc (no_voie (noport, 1), pcom); break; case 'X': if ((!dans_bloc) && ((port == noport) || (dans_test_port))) { if (strncmpi (pcom, "PTCTRX", 6) == 0) { ptctrx (port, pcom); } else { #ifdef __WINDOWS__ if (call_dll (pcom, NO_REPORT_MODE, NULL, 0, NULL) == -1) call_nbdos (&pcom, 1, NO_REPORT_MODE, NULL, NULL, NULL); #endif #ifdef __FBBDOS__ send_dos (2, pcom, NULL); #endif #ifdef __LINUX__ call_nbdos (&pcom, 1, NO_REPORT_MODE, NULL, TOOLDIR, NULL); #endif } } break; case 'P': /* Indication du port de forward */ *pcom = toupper (*pcom); port = *pcom - '@'; break; case 'A': dans_bloc = 1; strcpy (nombbs, pcom); nobbs = num_bbs (nombbs); if ((chercher_voie (nombbs) == -1) && (!pfwd->fin_fwd) && (fwd_libre (nobbs, noport)) && ((*pfwd->fwdbbs == '\0') || (strcmp (pfwd->fwdbbs, nombbs) == 0))) { trouve = 1; } break; case '-': nobbs = dans_bloc = 0; break; } } pfwd->con_lig[0][0] = '\0'; pfwd->txt_con[0] = '\0'; for (mesnum = 0; mesnum < 4; mesnum++) for (i = 0; i < 3; i++) *mesnoeud[mesnum][i] = '\0'; mesnum = 0; max = 0xff; old = 0; typ = '\0'; port = 1; canal = 0; pfwd->no_con = 0; for (i = 0; i < 8; i++) *pfwd->con_lig[i] = '\0'; if (!fin) { /* Valide le flag forward de la bbs */ set_bit_fwd (p_port[noport].fwd, nobbs); reverse_mode = 1; while ((!fin) && (fwd_get (combuf))) { pcom = combuf; ++pfwd->fwdlig; switch (*pcom++) { case '!': /* Not */ break; case 'B': /* Nom de la BBS destinataire */ break; case 'C': /* sauvegarde du texte de connnexion */ if (pfwd->no_con < 8) { n_cpy (79, pfwd->con_lig[pfwd->no_con], pcom); pfwd->no_con++; } break; case 'd': /* commande DOS */ param_tnc (1, &ctnc, pcom); break; case 'D': param_tnc (1, &ptnc, pcom); break; case 'E': /* ENDIF */ if (dans_test_port == pfwd->cptif) dans_test_port = 0; --pfwd->cptif; break; case 'F': /* OM associe a la BBS */ break; case 'G': /* indicateur de groupe */ break; case 'H': /* indicateur de hierarchie */ break; case 'I': /* IF */ ++pfwd->cptif; if ((val = tst_fwd (pcom, nobbs, h_time, port, &nbchoix, pfwd->reverse, noport)) == FALSE) { temp = pfwd->cptif - 1; while (pfwd->cptif != temp) { if (fwd_get (combuf) == 0) { fin = TRUE; break; } pcom = combuf; ++pfwd->fwdlig; switch (*pcom++) { case 'I': ++pfwd->cptif; break; case 'E': --pfwd->cptif; break; case '@': if (pfwd->cptif == (temp + 1)) /* code folded from here */ ++temp; /* unfolding */ break; default: break; } } } else if (val == 'P') { dans_test_port = pfwd->cptif; } break; case 'J': /* Selection des messages "data" */ data_mode = atoi (pcom); break; case 'K': /* Canal preselectionne */ canal = atoi (pcom); break; case 'l': /* Ligne de commande TNC (connection) */ param_tnc (0, &ctnc, pcom); break; case 'L': /* Ligne de commande TNC */ param_tnc (0, &ptnc, pcom); break; case 'M': /* Pas de reverse */ reverse_mode = 0; break; case 'N': /* Pas de forward FBB */ /* 1 = FBB */ /* 2 = FBB+BIN */ /* 4 = FBB+BIN+RESUME */ /* 8 = XFWD */ fbb_mode = (atoi (pcom) << 1) + 1; if (fbb_mode & 8) fbb_mode |= 7; else if (fbb_mode & 4) fbb_mode |= 3; break; case 'O': /* Time-out en forward */ t_o = atoi (pcom) * 60; break; case 'P': /* Indication du port de forward */ *pcom = toupper (*pcom); port = *pcom - '@'; break; case 'Q': /* Interdiction Reverse */ break; case 'R': /* reverse forwarding */ reverse = TRUE; break; case 'S': /* critere de selection des messages Noeuds */ if (mesnum == 4) break; sscanf (pcom, "%s %s %s", mesnoeud[mesnum][0], mesnoeud[mesnum][1], mesnoeud[mesnum][2]); ++mesnum; break; case 'T': /* limite la taille du fichier forwarde */ while (*pcom) { if (toupper (*pcom) == 'M') { ++pcom; max = (uchar) atoi (pcom); while (isdigit (*pcom)) ++pcom; } else if (toupper (*pcom) == 'O') { ++pcom; old = (uchar) atoi (pcom); while (isdigit (*pcom)) ++pcom; } else if (toupper (*pcom) == 'P') { typ |= FWD_PRIV; ++pcom; } else if (toupper (*pcom) == 'S') { typ |= FWD_SMALL; ++pcom; } else if (toupper (*pcom) == 'D') { typ |= FWD_DUPES; ++pcom; } else if (isdigit (*pcom)) { max = (uchar) atoi (pcom); while (isdigit (*pcom)) ++pcom; } else ++pcom; } break; case 'U': /* Routage prioritaire */ if ((ptr = strtok (pcom, " \t")) != NULL) { strn_cpy (6, p_route[0], ptr); i = 1; while ((ptr = strtok (NULL, " \t")) != NULL) { strn_cpy (6, p_route[i], ptr); ++i; if (i == NB_P_ROUTE) break; } } break; case 'V': /* texte envye en connexion */ strcpy (pfwd->txt_con, pcom); break; case 'W': if (isdigit (*pcom)) nb_prompt = atoi (pcom); else nb_prompt = 1; break; case 'x': /* commande DOS */ param_tnc (2, &ctnc, pcom); break; case 'X': /* commande DOS */ param_tnc (2, &ptnc, pcom); break; case 'Y': /* Mise a l'heure PMS */ dde_clk = 1; break; case 'Z': /* NTS */ break; case '@': /* ELSE */ temp = pfwd->cptif - 1; while (pfwd->cptif != temp) { if (fwd_get (combuf) == 0) { fin = TRUE; break; } pcom = combuf; ++pfwd->fwdlig; switch (*pcom++) { case 'I': ++pfwd->cptif; break; case 'E': --pfwd->cptif; break; default: break; } } break; case '*': case '#': /* ligne commentaire */ break; case '-': /* fin de bloc - passage BBS a connecter suivante */ /************ ???????????? ***************/ /* pfwd->fwdpos = (unsigned) (fwd_scan - fwd_file) ; */ pfwd->fwdpos = tell_fwd (); if ((noport == port) && ((voie = ch_voie (port, canal)) >= 0) && ((((nbmess = attend_fwd (nobbs, max, old, typ, data_mode)) != 0L) || (reverse)))) { deb_io (); sprintf (s, "Forward %d %s", nobbs, nombbs); #ifdef __FBBDOS__ fen_ptr = open_win (45, 5, 68, 18, INIT, s); #endif #ifdef ENGLISH if (max < 0xff) cprintf ("Max size : %u Kb\n\r", max); #else if (max < 0xff) cprintf ("Taille max %u Kb\n\r", max); #endif #ifdef ENGLISH if (typ & FWD_SMALL) cprintf ("Smallest first \n\r"); #else if (typ & FWD_SMALL) cprintf ("Envoi par taille\n\r"); #endif if (nbmess) { #ifdef ENGLISH cprintf ("\nPrivate : %d\r\n", nbmess->nbpriv); cprintf ("Bulletins : %d\r\n", nbmess->nbbul); #else cprintf ("\nPrivs : %d\r\n", nbmess->nbpriv); cprintf ("Bulletins : %d\r\n", nbmess->nbbul); #endif } else cprintf ("\nReverse\r\n"); /* il y a des messages a forwarder - connexion */ if (*pfwd->con_lig[0]) { cprintf ("Link %d\r\n", get_link (nobbs)); program_fwd (1, 1, &ptnc, voie); svoie[voie]->ctnc = ctnc; ctnc = NULL; svoie[voie]->nb_prompt = nb_prompt; svoie[voie]->nb_choix = nbchoix; svoie[voie]->cur_choix = (uchar) get_link (nobbs); svoie[voie]->curfwd = pfwd; svoie[voie]->maxfwd = max; svoie[voie]->oldfwd = old; svoie[voie]->typfwd = typ; svoie[voie]->bbsfwd = (uchar) nobbs; svoie[voie]->rev_mode = reverse_mode; svoie[voie]->data_mode = data_mode; if (dde_clk) svoie[voie]->clock = 1; for (mesnum = 0; mesnum < 4; mesnum++) for (i = 0; i < 3; i++) n_cpy (19, pfwd->mesnode[mesnum][i], mesnoeud[mesnum][i]); pvoie->sid = 0; if (fbb_mode == -1) { svoie[voie]->fbb = bin_fwd; svoie[voie]->prot_fwd = prot_fwd; } else { if (fbb_mode & FWD_BIN) svoie[voie]->fbb = bin_fwd; svoie[voie]->prot_fwd = prot_fwd & fbb_mode; } if (t_o) cprintf ("Time out %d mn\r\n", t_o / 60); if (t_o == time_n) ++t_o; if (t_o) svoie[voie]->timout = t_o; con_fwd = TRUE; retour = voie; } else { choix = get_link (nobbs); if (choix < (int) nbchoix) { ++choix; set_link (nobbs, choix); clr_bit_fwd (p_port[noport].fwd, nobbs); pfwd->fwdpos = pfwd->lastpos; } else set_link (nobbs, 1); retour = -1; } for (i = 0; i < NB_P_ROUTE; i++) { if (*p_route[i]) cprintf ("Prio : %s\r\n", p_route[i]); strcpy (svoie[voie]->p_route[i], p_route[i]); } #ifdef __FBBDOS__ if (pfwd->reverse) { sleep_ (1); } close_win (fen_ptr); #endif fin_io (); } else { retour = -1; } fin = TRUE; break; } } } if (con_fwd) { pfwd->no_bbs = nobbs; if (noport) { if (connect_fwd (voie, pfwd) != 0) { dec_voie (voie); retour = -1; } else { pfwd->no_con = 1; } } else { if (!mail_out (pfwd->con_lig[0])) retour = -1; /* retour = -1 ; */ } } libere_tnc (&ptnc); if (ctnc) libere_tnc (&ctnc); } while (retour == -1); if (!retour) { *pfwd->fwdbbs = '\0'; } pfwd->forward = retour; aff_forward (); ff (); } int appel_rev_fwd (int affiche) { int i; int temp, nobbs, retour = FALSE, fin = FALSE, ligne = 0, cptif = 0; int reverse = 1; char nombbs[80]; char combuf[80]; char *pcom; char *ptr; #ifdef __FBBDOS__ fen *fen_ptr; #endif typ_pfwd *ptnc; atfwd *nbmess; long h_time = time (NULL); df ("appel_rev_fwd", 1); ptnc = NULL; pvoie->data_mode = 1; /* init_bbs() ; */ pvoie->bbsfwd = 0; rewind_fwd (); while (TRUE) { if (fwd_get (combuf) == 0) { ff (); return (FALSE); } pcom = combuf; ++ligne; if (*pcom++ == 'A') { port = 1; strcpy (nombbs, pcom); nobbs = num_bbs (nombbs); if (indcmp (nombbs, pvoie->sta.indicatif.call)) { break; } } } for (i = 0; i < NB_P_ROUTE; i++) *(pvoie->p_route[i]) = '\0'; pvoie->maxfwd = 0xff; pvoie->oldfwd = 0; pvoie->typfwd = 0; pvoie->bbsfwd = (uchar) nobbs; deb_io (); #ifdef __FBBDOS__ if (affiche == 1) { sprintf (s, "Reverse %d %s", nobbs, nombbs); fen_ptr = open_win (45, 5, 68, 18, INIT, s); } #endif while ((!fin) && (fwd_get (combuf))) { pcom = combuf; ++ligne; switch (*pcom++) { case '!': /* Not */ break; case 'B': /* recuperer le nom de la BBS destinataire */ break; case 'C': /* sauvegarde du texte de connexion */ break; case 'l': /* Ligne de commande TNC */ break; case 'O': pvoie->timout = atoi (pcom) * 60; if (affiche == 1) cprintf ("Time out %d mn\r\n", pvoie->timout / 60); break; case 'd': /* commande DOS */ case 'x': /* commande DOS */ case 'P': /* Indication du port de forward */ case 'D': /* Commande DOS */ case 'K': /* Canal preselectionne */ case 'M': /* Pas de reverse */ case 'N': /* Mode FBB inactif */ case 'R': /* Reverse */ case 'S': /* Chaines identification */ case 'V': /* Texte connexion */ case 'X': /* Commande DOS */ case 'Y': /* Mise a l'heure */ case 'Z': /* NTS */ break; case 'Q': /* Interdit le reverse */ reverse = 0; break; case 'E': /* ENDIF */ --cptif; break; case 'F': /* chercher les messages de l'OM associe a la BBS */ break; case 'G': /* Indicateur de groupe */ break; case 'H': /* indicateur de hierarchie */ break; case 'I': /* IF */ ++cptif; if (tst_fwd (pcom, nobbs, h_time, 0, NULL, 1, -1) == FALSE) { temp = cptif - 1; while (cptif != temp) { if (fwd_get (combuf) == 0) { fin = TRUE; break; } pcom = combuf; switch (*pcom++) { case 'I': ++cptif; break; case 'E': --cptif; break; case '@': if (cptif == (temp + 1)) ++temp; break; default: break; } } } break; case 'J': /* Selection des messages "data" */ pvoie->data_mode = atoi (pcom); break; case 'T': /* limite la taille du fichier forwarde */ while (*pcom) { if (toupper (*pcom) == 'M') { ++pcom; pvoie->maxfwd = (uchar) atoi (pcom); while (isdigit (*pcom)) ++pcom; } else if (toupper (*pcom) == 'O') { ++pcom; pvoie->oldfwd = (uchar) atoi (pcom); while (isdigit (*pcom)) ++pcom; } else if (toupper (*pcom) == 'P') { pvoie->typfwd |= FWD_PRIV; ++pcom; } else if (toupper (*pcom) == 'S') { pvoie->typfwd |= FWD_SMALL; ++pcom; } else if (toupper (*pcom) == 'D') { pvoie->typfwd |= FWD_DUPES; ++pcom; } else if (isdigit (*pcom)) { pvoie->maxfwd = (uchar) atoi (pcom); while (isdigit (*pcom)) ++pcom; } else ++pcom; } break; case 'U': /* Routage prioritaire */ if ((ptr = strtok (pcom, " \t")) != NULL) { strn_cpy (6, pvoie->p_route[0], ptr); i = 1; while ((ptr = strtok (NULL, " \t")) != NULL) { strn_cpy (6, pvoie->p_route[i], ptr); ++i; if (i == NB_P_ROUTE) break; } } break; case '@': /* ELSE */ temp = cptif - 1; while (cptif != temp) { if (fwd_get (combuf) == 0) { fin = TRUE; break; } pcom = combuf; ++ligne; switch (*pcom++) { case 'I': ++cptif; break; case 'E': --cptif; break; default: break; } } break; case '*': case '#': /* ligne commentaire */ break; case '-': /* fin de bloc - envoi du reverse forwarding */ if ((reverse) && ((nbmess = attend_fwd (nobbs, pvoie->maxfwd, pvoie->oldfwd, pvoie->typfwd, pvoie->data_mode)) != 0L)) { if (affiche == 1) { #ifdef ENGLISH cprintf ("\nPrivate : %d\r\n", nbmess->nbpriv); cprintf ("Bulletins : %d\r\n", nbmess->nbbul); #else cprintf ("\nPrivs : %d\r\n", nbmess->nbpriv); cprintf ("Bulletins : %d\r\n", nbmess->nbbul); #endif for (i = 0; i < NB_P_ROUTE; i++) { if (*pvoie->p_route[i]) cprintf ("Prio : %s\r\n", pvoie->p_route[i]); } } retour = 1; } else retour = 0; fin = TRUE; break; } } libere_tnc (&ptnc); #ifdef __FBBDOS__ if (affiche) { if (pvoie->reverse) { sleep_ (1); } close_win (fen_ptr); } #endif fin_io (); ff (); return (retour); } void prog_rev_tnc (int voie) { int i; int temp, nobbs, fin = FALSE, ligne = 0, cptif = 0; int port = 1; char nombbs[80]; char combuf[80]; char *pcom; typ_pfwd *ptnc; long h_time = time (NULL); ptnc = NULL; nobbs = 0; rewind_fwd (); while (TRUE) { if (fwd_get (combuf) == 0) { return; } pcom = combuf; ++ligne; if (*pcom++ == 'A') { port = 1; strcpy (nombbs, pcom); nobbs = num_bbs (nombbs); if (indcmp (nombbs, svoie[voie]->sta.indicatif.call)) { break; } } } for (i = 0; i < NB_P_ROUTE; i++) *(svoie[voie]->p_route[i]) = '\0'; svoie[voie]->maxfwd = 0xff; svoie[voie]->oldfwd = 0; svoie[voie]->typfwd = 0; deb_io (); while ((!fin) && (fwd_get (combuf))) { pcom = combuf; ++ligne; switch (*pcom++) { case '!': /* Not */ break; case 'B': /* recuperer le nom de la BBS destinataire */ break; case 'C': /* sauvegarde du texte de connexion */ break; case 'l': /* Ligne de commande TNC */ param_tnc (0, &ptnc, pcom); break; case 'O': break; case 'd': /* commande DOS */ param_tnc (1, &ptnc, pcom); break; case 'x': /* commande DOS */ param_tnc (2, &ptnc, pcom); break; case 'P': /* Indication du port de forward */ *pcom = toupper (*pcom); port = *pcom - '@'; break; case 'K': /* Canal preselectionne */ case 'M': /* Pas de reverse */ case 'N': /* Mode FBB inactif */ case 'R': /* Reverse */ case 'S': /* Chaines identification */ case 'V': /* Texte connexion */ case 'Y': /* Mise a l'heure */ case 'Z': /* NTS */ break; case 'Q': /* Interdit le reverse */ break; case 'E': /* ENDIF */ --cptif; break; case 'F': /* chercher les messages de l'OM associe a la BBS */ break; case 'G': /* Indicateur de groupe */ break; case 'H': /* indicateur de hierarchie */ break; case 'I': /* IF */ ++cptif; if (tst_fwd (pcom, nobbs, h_time, 0, NULL, 1, -1) == FALSE) { temp = cptif - 1; while (cptif != temp) { if (fwd_get (combuf) == 0) { fin = TRUE; break; } pcom = combuf; switch (*pcom++) { case 'I': ++cptif; break; case 'E': --cptif; break; case '@': if (cptif == (temp + 1)) ++temp; break; default: break; } } } break; case 'T': /* limite la taille du fichier forwarde */ break; case 'U': /* Routage prioritaire */ break; case '@': /* ELSE */ temp = cptif - 1; while (cptif != temp) { if (fwd_get (combuf) == 0) { fin = TRUE; break; } pcom = combuf; ++ligne; switch (*pcom++) { case 'I': ++cptif; break; case 'E': --cptif; break; default: break; } } break; case '*': case '#': /* ligne commentaire */ break; case '-': /* fin de bloc - envoi du reverse forwarding */ if ((port == no_port (voie)) && (ptnc)) { program_fwd (1, 1, &ptnc, voie); } fin = 1; break; } } libere_tnc (&ptnc); fin_io (); } fbb-7.04j/src/fwdovl4.c0100644000175100017510000003756307726646105012755 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE FORWARDING OVERLAY 4 */ #include static long t_msg_fwd_suiv (int, uchar, uchar, uchar, int, char *); #ifdef __FBBDOS__ static char *expand_path (char *cmde) { struct stat statbuf; char str[256]; char *path; /* Cherche en direct */ if (stat (cmde, &statbuf) == 0) { path = cmde; return (path); } sprintf (str, "%s.EXE", cmde); if (stat (str, &statbuf) == 0) { path = str; return (path); } sprintf (str, "%s.COM", cmde); if (stat (str, &statbuf) == 0) { path = str; return (path); } sprintf (str, "%s.BAT", cmde); if (stat (str, &statbuf) == 0) { path = str; return (path); } /* Cherche avec le path */ path = searchpath (cmde); if (path == NULL) { sprintf (str, "%s.EXE", cmde); path = searchpath (str); } if (path == NULL) { sprintf (str, "%s.COM", cmde); path = searchpath (str); } if (path == NULL) { sprintf (str, "%s.BAT", cmde); path = searchpath (str); } /* if (path == NULL) { dprintf("Pas trouve {%s}\n", str); } */ return (path); } #endif /* * send_dos : envoie une commande MsDos * * Type = 0 : * 1 : Sauvegarde la fenetre BBS et affiche le message d'erreur * 2 : Affiche le message d'erreur * 3 : Pas d'affichage, de sauvegarde et de retour. * 4 : Redirige les sorties sur EXECUTE.$$$ et retourne le contenu * 5 : Sauvegarde de la fenetre, pas d'affichage et de retour. */ int send_dos (int type, char *commande, char *data) { #ifdef __LINUX__ return (-1); #endif #ifdef __WINDOWS__ int err; char log[256]; strcpy (log, commande); if (data) { strcat (log, " "); strcat (log, data); } err = fbb_exec (log); return (err); #endif #ifdef __FBBDOS__ static char option[] = "/C"; char *arg[40]; char log[256]; char deroute[80]; char *path; int duplic, oldstdout, oldstderr; int err, i = 0; fen *sav_fen; int errtemp; int disk; int ofst; char cur_dir[MAXPATH]; int n; if (!*commande) return (0); log[0] = (type == 1) ? 'D' : 'X'; log[1] = ' '; strn_cpy (70, log + 2, commande); fbb_log (voiecur, 'D', log); arg[i++] = getenv ("COMSPEC"); arg[i++] = option; arg[i++] = strtok (commande, " "); while ((arg[i] = strtok (NULL, " ")) != NULL) ++i; if (data) { arg[i++] = data; arg[i] = NULL; } path = expand_path (arg[2]); if (path == NULL) return (-1); arg[2] = path; ofst = 2; if (strstr (arg[2], ".BAT")) { ofst = 0; } deb_io (); disk = getdisk (); strcpy (cur_dir, "X:\\"); cur_dir[0] = 'A' + disk; getcurdir (0, cur_dir + 3); operationnel = FALSE; if ((type == 1) || (type == 5)) { sav_fen = create_win (1, 1, 80, h_screen); if (EGA) ega_close (); puttxt (fen_dos); puttext_info (&(fen_dos->sav_mod)); break_ok (); err = spawnv (P_WAIT, arg[ofst], arg + ofst); if (err == -1) { ofst = 0; err = spawnv (P_WAIT, arg[ofst], arg + ofst); } break_stop (); errtemp = errno; gettext_info (&(fen_dos->sav_mod)); gettxt (1, 1, 80, 25, fen_dos->ptr); if (EGA) ega_open (); close_win (sav_fen); } else { if (type == 4) { /* redirige stdout et stderr sur le fichier EXECUTE.$$$ */ sprintf (deroute, "%s\\EXECUTE.$$$", getcwd (log, 80)); duplic = open (deroute, O_CREAT | O_RDWR, S_IWRITE | S_IREAD); } else { duplic = open ("NUL", O_WRONLY, S_IWRITE | S_IREAD); } oldstdout = dup (1); oldstderr = dup (2); dup2 (duplic, 1); dup2 (duplic, 2); close (duplic); break_ok (); err = spawnv (P_WAIT, arg[ofst], arg + ofst); if (err == -1) { ofst = 0; err = spawnv (P_WAIT, arg[ofst], arg + ofst); } break_stop (); errtemp = errno; dup2 (oldstdout, 1); dup2 (oldstderr, 2); close (oldstdout); close (oldstderr); if (type == 4) { if (err != -1) { outfich (deroute); } unlink (deroute); } } operationnel = TRUE; setdisk (disk); chdir (cur_dir); if ((type < 3) && (err == -1)) { strcpy (log, "DOS Error : "); for (n = ofst; n < i; n++) { strcat (log, arg[n]); strcat (log, " "); } errno = errtemp; perror (log); } fin_io (); return (err); #endif } /* ok_fwd = 0 -> Le message n'est pas marque 'F' */ /* Si nobbs = 0 -> raz flags fwd */ void sup_fwd (long num, int ok_fwd, uchar nobbs) { int i, pos, mode; int del = 0; unsigned num_indic; bullist bul; ind_noeud *noeud; mess_noeud *mptr; lfwd *ptr_fwd = tete_fwd; recfwd *prec = NULL; pos = 0; deb_io (); if (fast_fwd) { while (1) { if (pos == NBFWD) { ptr_fwd = ptr_fwd->suite; if (ptr_fwd == NULL) break; pos = 0; } prec = &ptr_fwd->fwd[pos]; if (prec->nomess == num) break; pos++; } } if ((mptr = findmess (num)) != NULL) { ouvre_dir (); read_dir (mptr->noenr, &bul); if (nobbs <= NBBBS) { if (nobbs) { /* Bulletin : Marque la BBS */ if (fast_fwd) clr_bit_fwd (prec->fbbs, nobbs); clr_bit_fwd (bul.fbbs, nobbs); set_bit_fwd (bul.forw, nobbs); } else { /* Prive : Marque et supprime les autres routes */ for (i = 0; i < NBMASK; i++) { bul.forw[i] = bul.fbbs[i]; bul.fbbs[i] = '\0'; } /* Supprime le MID */ if (del) delete_bid (bul.bid); } } /* Supprime le message binaire si forwarde */ if (!fwd_mask (bul.fbbs)) { if (ok_fwd) { noeud = insnoeud (bul.desti, &num_indic); if (bul.status == 'N') --(noeud->nbnew); bul.status = 'F'; } if (fast_fwd) { prec->type = '\0'; prec->bin = '\0'; } mode = pvoie->binary; set_binary (voiecur, 1); /************** Verifier si pas en cours d'envoi ! *********************/ del = 1; for (i = 1; i < NBVOIES; i++) { if ((svoie[i]->sta.connect) && (i != voiecur) && (FOR (svoie[i]->mode)) && (svoie[i]->entmes.numero == num)) { del = 0; } } if (del) supp_mess (num); /* supprime le fichier binaire eventuellement */ set_binary (voiecur, mode); aff_msg_cons (); } write_dir (mptr->noenr, &bul); ferme_dir (); } else if (fast_fwd) { for (i = 0; i < NBMASK; i++) prec->fbbs[i] = '\0'; } fin_io (); } /* Cherche si le destinataire existe dans la base et route sur son homebbs */ void entete_envoi_fwd (int voie) { /* envoie la ligne de commande acheminant message vers bbs */ char s[80]; char type; char *bbs_v; if (HIE (svoie[voie]->mode)) bbs_v = svoie[voie]->entmes.bbsv; else bbs_v = bbs_via (svoie[voie]->entmes.bbsv); type = svoie[voie]->entmes.type; if ((type == 'A') && (!ACQ (svoie[voie]->mode))) type = 'P'; sprintf (s, "S%c %s", type, svoie[voie]->entmes.desti); outs (s, strlen (s)); if (*bbs_v) { sprintf (s, " @ %s", bbs_v); outs (s, strlen (s)); } if (*svoie[voie]->entmes.exped) { sprintf (s, " < %s", svoie[voie]->entmes.exped); outs (s, strlen (s)); } if (*(svoie[voie]->entmes.bid)) { if (((svoie[voie]->entmes.status == '$') && (BID (svoie[voie]->mode))) || (MID (svoie[voie]->mode)) || (strcmp (svoie[voie]->entmes.desti, "SYSOP") == 0) ) { sprintf (s, " $%s", svoie[voie]->entmes.bid); outs (s, strlen (s)); } } cr (); } void entete_fwd (int voie) { char *s; char header[160]; s = svoie[voie]->entmes.titre; outsln (s, strlen (s)); deb_io (); make_header (&(svoie[voie]->entmes), header); entete_mess_fwd (&(svoie[voie]->entmes), header); outs (msg_header, strlen (msg_header)); aff_etat ('E'); send_buf (voiecur); fin_io (); } int fin_envoi_fwd (int voie) { /* Si N de message nul retour */ if (svoie[voie]->entmes.numero == 0L) return (FALSE); /* teste si le message est encore a forwarder et enleve de la liste */ if ((svoie[voie]->entmes.status == '$') || (multi_prive)) sup_fwd (svoie[voie]->entmes.numero, TRUE, svoie[voie]->bbsfwd); else sup_fwd (svoie[voie]->entmes.numero, TRUE, 0); return (TRUE); } atfwd *attend_fwd (int nobbs, uchar max, uchar old, uchar typ, int data_mode) { int pos, noctet, ok = 0; char cmpmsk; static atfwd nbmess; recfwd *prec; lfwd *ptr_fwd = tete_fwd; time_t date = time(NULL) - 3600L * (long)old; unsigned offset = 0; bloc_mess *bptr = tete_dir; bullist ligne; pos = 0; noctet = (nobbs - 1) / 8; cmpmsk = 1 << ((nobbs - 1) % 8); nbmess.nbpriv = nbmess.nbbul = nbmess.nbkb = 0; if (fast_fwd) { while (1) { if (pos == NBFWD) { ptr_fwd = ptr_fwd->suite; if (ptr_fwd == NULL) break; pos = 0; } prec = &ptr_fwd->fwd[pos]; pos++; if (prec->type) { if ((data_mode == 0) && (prec->bin)) continue; if ((data_mode == 3) && (!prec->bin)) continue; if ((data_mode == 2) && (prec->bin) && (!PRIVATE (prec->type))) continue; if ((prec->fbbs[noctet] & cmpmsk) && (prec->date <= date) && (prec->kb <= max)) { if (PRIVATE (prec->type)) { ++nbmess.nbpriv; ok = 1; nbmess.nbkb += prec->kb; } else if (!(typ & FWD_PRIV)) { ++nbmess.nbbul; ok = 1; nbmess.nbkb += prec->kb; } } } } } else { ouvre_dir (); while (bptr) { if (bptr->st_mess[offset].noenr) { read_dir (bptr->st_mess[offset].noenr, &ligne); if (ligne.type) { int kb = (int) (ligne.taille >> 10); if ((data_mode == 0) && (ligne.bin)) ; else if ((data_mode == 3) && (!ligne.bin)) ; else if ((data_mode == 2) && (ligne.bin) && (!PRIVATE (ligne.type))) ; else if ((ligne.fbbs[noctet] & cmpmsk) && (ligne.date <= date) && (kb <= max)) { if (PRIVATE (ligne.type)) { ++nbmess.nbpriv; ok = 1; nbmess.nbkb += kb; } else if (!(typ & FWD_PRIV)) { ++nbmess.nbbul; ok = 1; nbmess.nbkb += kb; } } } } if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } } } return ((ok) ? &nbmess : NULL); } static int is_egal (long numero) { int i; int nb = pvoie->nb_egal; if (nb > NB_DEL) nb = NB_DEL; for (i = 0; i < nb; i++) { if (pvoie->mess_egal[i] == numero) return (1); } return (0); } int not_in_bloc (long numero, int voie) { if (pvoie->niv1 == N_XFWD) return (not_in_xfwd_mess (numero, voie)); else return (not_in_fb_mess (numero, voie)); } static long t_msg_fwd_suiv (int nobbs, uchar max, uchar old, uchar typ, int voie, char *test) { int pos, noctet; int data_mode = svoie[voie]->data_mode; char cmpmsk; recfwd *prec; recfwd *psel; lfwd *ptr_fwd; time_t date = time(NULL) - 3600L * (long)old; unsigned offset = 0; bloc_mess *bptr = tete_dir; bullist bul; bullist sel; int fsel; int skb; noctet = (nobbs - 1) / 8; cmpmsk = 1 << ((nobbs - 1) % 8); if (fast_fwd) { ptr_fwd = tete_fwd; psel = NULL; pos = 0; while (1) { if (pos == NBFWD) { ptr_fwd = ptr_fwd->suite; if (ptr_fwd == NULL) break; pos = 0; } prec = &ptr_fwd->fwd[pos]; pos++; /* Message en cours d'edition */ if ((reply == 4) && (svoie[CONSOLE]->enrcur == prec->nomess)) continue; if ((data_mode == 0) && (prec->bin)) continue; if ((data_mode == 3) && (!prec->bin)) continue; if ((data_mode == 2) && (prec->bin) && (!PRIVATE (prec->type))) continue; if (is_egal (prec->nomess)) { continue; } if ((prec->type) && (prec->fbbs[noctet] & cmpmsk) && (prec->date <= date) && (prec->kb <= max) && (not_in_bloc (prec->nomess, voie))) { if (typ & FWD_SMALL) { if (PRIVATE (prec->type)) { if ((!psel) || (!PRIVATE (psel->type)) || (psel->kb > prec->kb)) psel = prec; } else if ((!(typ & FWD_PRIV)) && ((!psel) || (!PRIVATE (psel->type)))) { if ((test == NULL) || (strncmp (test, prec->bbsv, 6) == 0)) { if ((!psel) || (psel->kb > prec->kb)) psel = prec; } } } else { if (PRIVATE (prec->type)) { if ((!psel) || (!PRIVATE (psel->type)) || (psel->kb > prec->kb)) /* if ((!psel) || (prec->nomess < psel->nomess)) */ psel = prec; } else if ((!(typ & FWD_PRIV)) && ((!psel) || (!PRIVATE (psel->type)))) { if ((test == NULL) || (strncmp (test, prec->bbsv, 6) == 0)) { if ((!psel) || (prec->nomess < psel->nomess)) { psel = prec; } } } } } } if ((psel) && (typ & FWD_PRIV) && (!PRIVATE (psel->type))) psel = NULL; if ((psel) && (!PRIVATE (psel->type)) && (test) && (strncmp (test, psel->bbsv, 6) != 0)) psel = NULL; return ((psel) ? psel->nomess : 0L); } else { fsel = 0; skb = 0; memset (&sel, 0, sizeof (bullist)); ouvre_dir (); while (bptr) { if (bptr->st_mess[offset].noenr) { read_dir (bptr->st_mess[offset].noenr, &bul); if (bul.type) { int kb = (int) (bul.taille >> 10); if ((reply == 4) && (svoie[CONSOLE]->enrcur == bul.numero)) continue; if ((data_mode == 0) && (bul.bin)) continue; if ((data_mode == 3) && (!bul.bin)) continue; if ((data_mode == 2) && (bul.bin) && (!PRIVATE (bul.type))) continue; if (!is_egal (bul.numero)) { if ((bul.type) && (bul.fbbs[noctet] & cmpmsk) && (bul.date <= date) && (kb <= max) && (not_in_bloc (bul.numero, voie))) { if (typ & FWD_SMALL) { if (PRIVATE (bul.type)) { if ((!fsel) || (!PRIVATE (sel.type)) || (skb > kb)) { sel = bul; fsel = 1; skb = kb; } } else if ((!(typ & FWD_PRIV)) && ((!fsel) || (!PRIVATE (sel.type)))) { if ((test == NULL) || (strncmp (test, bul.bbsv, 6) == 0)) { if ((!fsel) || (skb > kb)) { sel = bul; fsel = 1; skb = kb; } } } } else { if (PRIVATE (bul.type)) { if ((!fsel) || (!PRIVATE (sel.type)) || (skb > kb)) /* if ((!psel) || (bul.nomess < psel->nomess)) */ { sel = bul; fsel = 1; skb = kb; } } else if ((!(typ & FWD_PRIV)) && ((!fsel) || (!PRIVATE (sel.type)))) { if ((test == NULL) || (strncmp (test, bul.bbsv, 6) == 0)) { if ((!fsel) || (bul.numero < sel.numero)) { sel = bul; fsel = 1; skb = kb; } } } } } } } } if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } } if ((typ & FWD_PRIV) && (!PRIVATE (sel.type))) fsel = 0; if ((fsel) && (!PRIVATE (sel.type)) && (test) && (strncmp (test, sel.bbsv, 6) != 0)) fsel = 0; return ((fsel) ? sel.numero : 0L); } } long msg_fwd_suiv (int nobbs, uchar max, uchar old, uchar typ, int voie) { int i; long numero; for (i = 0; i < NB_P_ROUTE; i++) { if (*pvoie->p_route[i]) { numero = t_msg_fwd_suiv (nobbs, max, old, typ, voie, pvoie->p_route[i]); if (numero) { return (numero); } } else break; } numero = t_msg_fwd_suiv (nobbs, max, old, typ, voie, NULL); return (numero); } fbb-7.04j/src/fwdovl5.c0100644000175100017510000003315307726646105012745 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE FORWARDING OVERLAY 5 */ #include #define MPAR MESSDIR typedef struct { long val; int num; char bbs[7]; char bid[13]; long taille; } Rec_enc; #define MAX_ENCOURS 20 typedef struct type_encours { Rec_enc enc[MAX_ENCOURS]; struct type_encours *next; } Encours; static Encours *tete_encours = NULL; static long part_num; static char *r_bloc (int numero) { Broute *pcur = tbroute; df ("r_bloc", 1); #ifndef __WINDOWS__ if (EMS_HRT_OK ()) { ff (); return (sel_bloc (HROUTE, numero)); } #endif while (numero--) { pcur = pcur->suiv; if (pcur == NULL) { ff (); return (NULL); } } ff (); return (pcur->b_route); } static int r_bloc_size (void) { return (EMS_HRT_OK ()? EMS_BLOC : MAX_BROUTE); } static char *new_bloc_route (void) { char *ptr; Broute *pcur = tbroute; df ("new_bloc_route", 0); #ifndef __WINDOWS__ if (EMS_HRT_OK ()) { ptr = new_bloc (HROUTE); } else { #endif if (pcur) { while (pcur->suiv) pcur = pcur->suiv; pcur->suiv = (Broute *) m_alloue (sizeof (Broute)); pcur = pcur->suiv; } else { pcur = tbroute = (Broute *) m_alloue (sizeof (Broute)); } pcur->suiv = NULL; ptr = pcur->b_route; #ifndef __WINDOWS__ } #endif ff (); return (ptr); } void cree_routes (void) { int pos; int len; int nb_routes = 0; FILE *fptr; char *mptr; char status; char ligne[80]; char hroute[80]; int numero = 0; int max_broute = r_bloc_size (); if (!h_ok) return; df ("cree_routes", 0); new_bloc_route (); if ((fptr = fopen (d_disque ("HROUTE.SYS"), "rt")) != NULL) { #ifdef ENGLISH cprintf ("H-ROUTES set-up... \r\n"); #else cprintf ("Initialisation des H-ROUTES\r\n"); #endif mptr = r_bloc (numero); if (mptr) { memset (mptr, 0, r_bloc_size ()); pos = 0; while (fgets (ligne, 80, fptr)) { status = '#'; strupr (ligne); sscanf (ligne, "%c %s", &status, hroute); if (status == '#') continue; len = strlen (hroute) + 2; if ((pos + len) >= max_broute) { new_bloc_route (); mptr = r_bloc (++numero); if (mptr == NULL) break; memset (mptr, 0, r_bloc_size ()); pos = 0; } *mptr++ = status; strcpy (mptr, hroute); mptr += (len - 1); pos += len; if ((nb_routes % 100) == 0) cprintf ("\r%d routes", nb_routes); ++nb_routes; } } ferme (fptr, 76); cprintf ("\r%d routes\r\n", nb_routes); } ff (); } static void kill_file_route (char *route) { FILE *fptr; char ligne[80]; char hroute[80]; long pos = 0L; char type; df ("kill_file_route", 2); if ((fptr = fopen (d_disque ("HROUTE.SYS"), "r+t")) != NULL) { while (fgets (ligne, 80, fptr)) { sscanf (ligne, "%c %s", &type, hroute); if ((type == 'V') && (strcmp (hroute, route) == 0)) { fseek (fptr, pos, 0); fputc ('#', fptr); break; } pos = ftell (fptr); } ferme (fptr, 75); } ff (); } static void new_file_route (char *route) { FILE *fptr; char ligne[80]; df ("new_file_route", 2); if ((fptr = fappend (d_disque ("HROUTE.SYS"), "b")) != NULL) { sprintf (ligne, "V %s\r\n", route); fputs (ligne, fptr); ferme (fptr, 74); } ff (); } static void new_route (char *route) { char *scan; char *mptr = NULL; int len; register unsigned pos = 0; int numero = 0; int max_broute = r_bloc_size (); /* char temp[80]; */ df ("new_route", 2); len = strlen (route) + 2; while ((scan = r_bloc (numero)) != NULL) { pos = 0; for (;;) { mptr = scan; if (*scan == '\0') break; while (*scan) { ++scan; ++pos; } ++scan; ++pos; if (pos >= max_broute) break; } ++numero; } if ((pos + len) >= max_broute) { new_bloc_route (); mptr = r_bloc (numero); memset (mptr, 0, r_bloc_size ()); } *mptr++ = 'V'; strcpy (mptr, route); new_file_route (route); ff (); } int cherche_route (bullist * pbull) { char *ptr; int trouve = 0; char *scan; char *mptr = NULL; char stat; register unsigned pos; int numero = 0; int max_broute = r_bloc_size (); df ("cherche_route", 2); if ((*pbull->bbsv == '\0') || (strchr (pbull->bbsv, '.'))) { ff (); return (0); } if (route_wp_hier (pbull)) { var_cpy (0, "WP"); ff (); return (1); } if (!h_ok) { ff (); return (0); } var_cpy (0, "H"); while ((scan = r_bloc (numero)) != NULL) { pos = 0; for (;;) { stat = *scan++; ++pos; mptr = scan; if (stat == '\0') break; ptr = pbull->bbsv; for (;;) { if ((!isalnum (*scan)) && (*ptr == '\0')) trouve = 1; if (*scan != *ptr) break; ++scan; ++ptr; ++pos; } if (trouve) break; while (*scan) { ++scan; ++pos; } ++scan; ++pos; if (pos >= max_broute) break; } if (trouve) break; ++numero; } if (trouve) { strn_cpy (40, pbull->bbsv, mptr); } ff (); return (trouve); } char *extend_bbs (char *bbs) { static char ext_bbs[41]; bullist bull; df ("extend_bbs", 2); strn_cpy (40, bull.bbsv, bbs); strn_cpy (6, bull.desti, bbs); if (cherche_route (&bull)) { strn_cpy (40, ext_bbs, bull.bbsv); return (ext_bbs); } ff (); return (bbs); } static void add_route (char *route) { char *ptr; int trouve = 0; char stat = '\0'; char *scan; char *mptr = NULL; char *bbsv; register unsigned pos; int numero = 0; int max_broute = r_bloc_size (); df ("add_route", 2); bbsv = bbs_via (strupr (route)); while ((scan = r_bloc (numero)) != NULL) { pos = 0; for (;;) { stat = *scan++; ++pos; mptr = scan; if (stat == '\0') break; ptr = bbsv; for (;;) { if ((!isalnum (*scan)) && (*ptr == '\0')) trouve = 1; if (*scan != *ptr) break; ++scan; ++ptr; ++pos; } if (trouve) break; while (*scan) { ++scan; ++pos; } ++scan; ++pos; if (pos >= max_broute) break; } if (trouve) break; ++numero; } if (trouve) { if ((stat != 'P') && (strcmp (route, mptr) != 0)) { kill_file_route (mptr); while (*mptr) *mptr++ = '@'; new_route (route); } } else { new_route (route); } ff (); } int hupdate (void) { Hroute *pcurr; df ("hupdate", 0); if (throute) { aff_etat ('W'); pcurr = throute; if (strchr (throute->route, '.')) add_route (throute->route); throute = throute->suiv; m_libere (pcurr, sizeof (Hroute)); aff_etat ('A'); } ff (); return (throute != NULL); } /* Teste si la route existe dans les headers */ int is_route (char *route) { Route *r_ptr = pvoie->r_tete; char *ptr; int nb; df ("is_route", 2); while (r_ptr) { for (nb = 0; nb < NBROUTE; nb++) { ptr = r_ptr->call[nb]; if (*ptr == '\0') break; if (strcmp (route, ptr) == 0) { ff (); return (1); } } r_ptr = r_ptr->suite; } ff (); return (0); } void old_part (char *bbs, char *bid) { int pos; Encours *eptr = tete_encours; df ("old_part", 4); *pvoie->sr_fic = '\0'; /* Cherche l'entree */ while (eptr) { for (pos = 0; pos < MAX_ENCOURS; pos++) { if (*eptr->enc[pos].bbs == '\0') continue; if ((strcmp (eptr->enc[pos].bbs, bbs) == 0) && (strcmp (eptr->enc[pos].bid, bid) == 0)) { sprintf (pvoie->sr_fic, "%s%08ld.TMP", MPAR, eptr->enc[pos].val); break; } } eptr = eptr->next; } if (*pvoie->sr_fic == '\0') { fbb_error (ERR_CREATE, bid, 0); } ff (); } void mod_part (char *bbs, long size, char *bid) { int pos; char file[80]; Encours *eptr = tete_encours; df ("mod_part", 6); /* Cherche l'entree */ while (eptr) { for (pos = 0; pos < MAX_ENCOURS; pos++) { if (*eptr->enc[pos].bbs == '\0') continue; if ((strcmp (eptr->enc[pos].bbs, bbs) == 0) && (strcmp (eptr->enc[pos].bid, bid) == 0)) { if (size == 0L) { *eptr->enc[pos].bbs = 0; sprintf (file, "%s%08ld.TMP", MPAR, eptr->enc[pos].val); unlink (file); } else { eptr->enc[pos].taille = size; } break; } } eptr = eptr->next; } ff (); } static void add_part (long part_val, char *bbs, long size, char *bid) { int fin = 0; int pos = 0; Encours *eptr = tete_encours; df ("add_part", 8); if (!eptr) { tete_encours = eptr = (Encours *) m_alloue (sizeof (Encours)); } /* Cherche une entree libre */ while (eptr) { for (pos = 0; pos < MAX_ENCOURS; pos++) { if (*eptr->enc[pos].bbs == 0) { fin = 1; break; } } if (fin) break; if (!eptr->next) { eptr->next = (Encours *) m_alloue (sizeof (Encours)); } eptr = eptr->next; } strn_cpy (13, eptr->enc[pos].bid, bid); strn_cpy (6, eptr->enc[pos].bbs, bbs); eptr->enc[pos].val = part_val; eptr->enc[pos].taille = size; ff (); } int part_file (char *bbs, char *bid) { int fd; df ("part_file", 4); part_num = (part_num + 1L) & 0x3ffffffL; sprintf (pvoie->sr_fic, "%s%08ld.TMP", MPAR, part_num); add_part (part_num, bbs, 0L, bid); fd = open (pvoie->sr_fic, O_WRONLY | O_CREAT | O_BINARY, S_IREAD | S_IWRITE); if (fd == -1) { write_error (pvoie->sr_fic); ff (); return (0); } if (write (fd, bbs, 7) != 7) { write_error (pvoie->sr_fic); ff (); return (0); } if (write (fd, bid, 13) != 13) { write_error (pvoie->sr_fic); ff (); return (0); } close (fd); ff (); return (1); } void del_part (int voie, char *bid) { int pos; char file[80]; Encours *eptr = tete_encours; df ("del_part", 2); while (eptr) { for (pos = 0; pos < MAX_ENCOURS; pos++) { if (*eptr->enc[pos].bbs == 0) continue; if (strcmp (eptr->enc[pos].bid, bid) == 0) { int v; *eptr->enc[pos].bbs = 0; sprintf (file, "%s%08ld.TMP", MPAR, eptr->enc[pos].val); for (v = 1; v < NBVOIES; v++) { if (v == voie) continue; if ((svoie[v]->sta.connect) && (strcmp (file, svoie[v]->sr_fic) == 0)) break; } if (v == NBVOIES) unlink (file); /* else { char buffer[80]; sprintf(buffer, "del_part ch %d : %s found on %d", voie, file, v); write_error(buffer); } */ } } eptr = eptr->next; } ff (); } void end_parts (void) { Encours *eptr; while (tete_encours) { eptr = tete_encours; tete_encours = tete_encours->next; m_libere (eptr, sizeof (Encours)); } } void init_part (void) { int fd; int test; char path[80]; char file[80]; char bid[14]; char call[7]; bullist bul; struct ffblk dirblk; df ("init_part", 0); part_num = time (NULL); memset (&bul, 0, sizeof (bullist)); sprintf (path, "%s*.TMP", MPAR); if (findfirst (path, &dirblk, FA_DIREC)) { ff (); return; } do { if ((dirblk.ff_attrib & FA_DIREC) == 0) { sprintf (file, "%s%s", MPAR, dirblk.ff_name); if ((fd = open (file, O_RDONLY)) > 0) { if ((read (fd, call, 7) == 7) && (read (fd, bid, 13) == 13)) { strcpy (bul.bid, bid); if ((dirblk.ff_fsize == 20) || (deja_recu (&bul, 1, &test))) { unlink (file); } else { struct tm *tm; time_t temps = time (NULL); int jour; int delai; jour = dirblk.ff_fdate & 0x1f; tm = gmtime (&temps); delai = tm->tm_mday - jour; if (jour < 0) jour += 31; if (jour > 15) unlink (file); else add_part (atol (dirblk.ff_name), call, dirblk.ff_fsize - 20, bid); } } close (fd); } } } while (findnext (&dirblk) == 0); ff (); } /* Teste si les messages sont en partie recus pour la BBS concernee */ void part_recu (bullist * fb_mess, int nb, int *t_res) { Encours *eptr; int i, pos; df ("part_recu", 5); for (i = 0; i < nb; i++) { eptr = tete_encours; while (eptr) { for (pos = 0; pos < MAX_ENCOURS; pos++) { if (*eptr->enc[pos].bbs == '\0') continue; if ((strcmp (pvoie->sta.indicatif.call, eptr->enc[pos].bbs) == 0) && (strcmp (fb_mess[i].bid, eptr->enc[pos].bid) == 0)) { if ((t_res[i] == 1) || (t_res[i] == 4)) /* NO ou REJ */ { del_part (voiecur, fb_mess[i].bid); } else if (eptr->enc[pos].taille) { if (t_res[i] != 2) /* OK ou HELD */ { t_res[i] = 3; fb_mess[i].taille = eptr->enc[pos].taille; } } else { del_part (voiecur, fb_mess[i].bid); } } } eptr = eptr->next; } } ff (); } void print_part (void) { int pos; int ok = 0; char stemp[80]; Encours *eptr = tete_encours; df ("print_part", 0); /* Cherche l'entree */ while (eptr) { for (pos = 0; pos < MAX_ENCOURS; pos++) { if (*eptr->enc[pos].bbs == '\0') continue; sprintf (stemp, "BBS %-6s - BID %-12s (%ld bytes received)", eptr->enc[pos].bbs, eptr->enc[pos].bid, eptr->enc[pos].taille); outln (stemp, strlen (stemp)); ok = 1; } eptr = eptr->next; } if (!ok) outln ("None", 4); ff (); } fbb-7.04j/src/fwdovl6.c0100644000175100017510000003245207726646105012747 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE FORWARDING OVERLAY 6 */ #include static int lit_champ (char *, int, int); static void lit_fich (char *, int); void entete_saisie (void) { pvoie->msgtete = NULL; ptmes->taille = 0L; pvoie->messdate = time (NULL); pvoie->mess_recu = 0; pvoie->entete = 1; pvoie->header = 0; pvoie->mess_num = -1; *pvoie->mess_bid = '\0'; strn_cpy (39, pvoie->mess_home, mypath); del_temp (voiecur); } int rcv_titre (void) { #define MAX_TITRE 60 int nb = MAX_TITRE; char *scan; entete_saisie (); /* Efface un eventuel fichier existant */ scan = ptmes->titre; while ((*indd) && (*indd != '\n') && (*indd != '\r')) { if ((nb) && (*indd != 0x1a)) { nb--; *scan++ = *indd; } ++indd; } if (*indd) ++indd; *scan = '\0'; if ((!FOR (pvoie->mode)) && (nb == MAX_TITRE)) { texte (T_MBL + 21); return (0); } return (1); } static int swap_get (char *buffer) { if (*swap_scan == '\032') return (0); while ((*buffer++ = *swap_scan++) != '\0'); return (1); } static void swapp_champ (bullist * pbul, char *nouveau, char sw_champ) { switch (sw_champ) { case '@': strn_cpy (40, pbul->bbsv, nouveau); break; case '>': strn_cpy (6, pbul->desti, nouveau); break; case '<': strn_cpy (6, pbul->exped, nouveau); break; } } int swapp_bbs (bullist * pbul) { char champ; char sw_champ; char ligne[81], ancien[80], nouveau[80]; char *optr = nouveau; int ret = 0; df ("swapp_bbs", 2); swap_scan = swap_file; while (swap_get (ligne)) { *ancien = *nouveau = '\0'; champ = sw_champ = '\0'; if (sscanf (ligne, "%c%s %c%s\n", &champ, ancien, &sw_champ, nouveau)) { optr = nouveau; if (sw_champ == '\0') sw_champ = champ; switch (sw_champ) { case '@': case '>': case '<': break; default: sprintf (ligne, "%c%s", sw_champ, nouveau); sw_champ = champ; optr = ligne; } switch (champ) { case '@': /* if (indcmp (pbul->bbsv, ancien)) */ if (hiecmp (pbul->bbsv, ancien)) { swapp_champ (pbul, optr, sw_champ); /* ret = 1; */ } break; case '>': if (indcmp (pbul->desti, ancien)) { swapp_champ (pbul, optr, sw_champ); /* ret = 1; */ } break; case '<': if (indcmp (pbul->exped, ancien)) { swapp_champ (pbul, optr, sw_champ); /* ret = 1; */ } break; } } if (ret) { break; } } /* if (indcmp (mycall, bbs_via (pbul->bbsv))) */ if (hiecmp (mypath, pbul->bbsv)) { *pbul->bbsv = '\0'; ret = 0; } ff (); return (ret); } void ini_champs (int voie) { int i; svoie[voie]->entmes.status = 'N'; svoie[voie]->entmes.type = ' '; svoie[voie]->entmes.taille = 0L; svoie[voie]->entmes.bin = 0; svoie[voie]->m_ack = 0; svoie[voie]->messdate = time (NULL); svoie[voie]->mess_num = -1; svoie[voie]->entmes.numero = 0L; svoie[voie]->entmes.theme = 0; *(svoie[voie]->mess_bid) = '\0'; *(svoie[voie]->entmes.desti) = '\0'; *(svoie[voie]->entmes.bbsv) = '\0'; *(svoie[voie]->entmes.bbsf) = '\0'; *(svoie[voie]->entmes.bid) = '\0'; *(svoie[voie]->appendf) = '\0'; for (i = 0; i < NBMASK; i++) { svoie[voie]->entmes.fbbs[i] = svoie[voie]->entmes.forw[i] = '\0'; } strn_cpy (6, svoie[voie]->entmes.exped, svoie[voie]->sta.indicatif.call); } int lit_com_fwd (void) { ini_champs (voiecur); return (scan_com_fwd ()); } int scan_com_fwd (void) { char exped[10]; int autotype = 0; sup_ln (indd); //strupr (indd); if (!is_room ()) { outln ("*** Disk full !", 15); return (0); } if (ISGRAPH (*indd)) { *indd = toupper (*indd); if ((*indd == 'T') || (*indd == 'B') || (*indd == 'P') || (FOR (pvoie->mode)) || (BBS (pvoie->finf.flags))) { ptmes->type = *indd; } else if ((*indd == 'E') || (isdigit (*indd))) ptmes->type = 'E'; ++indd; } if (!is_espace (indd)) { texte (T_ERR + 2); return (0); } incindd (); if (!lit_champ (ptmes->desti, 6, 1)) return (0); if (ptmes->type == ' ') { if ((find (ptmes->desti)) || (is_serv (ptmes->desti))) { ptmes->type = 'P'; } else { ptmes->type = 'B'; } autotype = 1; } if (*indd == ' ') incindd (); /* Transforme le 1er "AT" en "@" */ if (strlen (indd) > 3) { if ((indd[0] == 'A') && (indd[1] == 'T') && (isspace (indd[2]))) { indd[0] = '@'; indd[1] = ' '; } } while (*indd) { switch (*indd) { case '@': incindd (); if (!lit_champ (ptmes->bbsv, 31, 2)) return (0); if (*indd == ' ') incindd (); if ((ptmes->type != 'P') && (ptmes->type != 'T') && (!isdigit (ptmes->type))) { ptmes->type = 'B'; } break; case '<': incindd (); if (!lit_champ (exped, 6, 1)) return (0); if (*exped) { if ((strcmp (exped, pvoie->sta.indicatif.call) != 0) && (!forward_auth (voiecur))) { varx[0][0] = '<'; varx[0][1] = '\0'; texte (T_ERR + 9); return (0); } strcpy (ptmes->exped, exped); } if (*indd == ' ') incindd (); break; case '+': if (!droits (ACCESDOS)) { if (!(FOR (pvoie->mode))) { varx[0][0] = '+'; varx[0][1] = '\0'; texte (T_ERR + 9); } return (0); } incindd (); lit_fich (pvoie->appendf, 79); if (access (pvoie->appendf, 0) != 0) { texte (T_ERR + 11); return (FALSE); } if (*indd == ' ') incindd (); break; case '$': incindd (); if (*indd) { if (!lit_champ (ptmes->bid, 12, 0)) return (0); } else sprintf (ptmes->bid, " "); if (*indd == ' ') incindd (); break; default: if (*indd != '\r') { if (!(FOR (pvoie->mode))) { varx[0][0] = *indd; varx[0][1] = '\0'; texte (T_ERR + 9); } return (0); } ++indd; break; } } if (*ptmes->desti == '\0') { if (!(FOR (pvoie->mode))) texte (T_ERR + 6); return (0); } /* Prive sur routage de groupe ! */ if ((*ptmes->bbsv) && (ptmes->type != 'T') && (!msg_find (bbs_via (ptmes->bbsv))) && (find (ptmes->desti))) { if ((strcmp ("SYSOP", ptmes->desti) != 0) && (strcmp ("WP", ptmes->desti) != 0) && (!(FOR (pvoie->mode)))) { texte (T_MBL + 21); return (0); } } ptmes->status = 'N'; if (*ptmes->bbsv) { if ((autotype) && (ptmes->type == 'P') && (!find (ptmes->desti)) && (!find (bbs_via (ptmes->bbsv)))) ptmes->type = 'B'; if ((*ptmes->bbsv) && (!find (bbs_via (ptmes->bbsv))) && (((ptmes->type != 'P') && (ptmes->type != 'A')) || (strcmp (ptmes->desti, "SYSOP") == 0) || (strcmp ("WP", ptmes->desti) == 0))) { ptmes->status = '$'; } } swapp_bbs (ptmes); if ((*ptmes->bbsv == '\0') && (ptmes->type == 'P')) { pvoie->m_ack = 1; } if (!addr_check (ptmes->bbsv)) { return (0); } if (!reacheminement ()) return (0); if ((*ptmes->bbsv == '\0') && (ptmes->type == 'A')) { ptmes->type = 'P'; } if (!is_bid (ptmes->bid)) { return (0); } return (1); } static int rej_get (char *buffer) { if (*rej_scan == '\032') return (0); while ((*buffer++ = *rej_scan++) != '\0'); return (1); } static int tst_mes_ems (int mode, bullist * ptmes) { long taille; int retour = 0; unsigned record = 0; Rej_rec rej; while (read_rej (record, &rej)) { if (rej.mode == mode) { taille = (long) rej.size * 1000L; retour = ( ((rej.type == '*') || (rej.type == ptmes->type)) && (strmatch (ptmes->exped, rej.exped)) && (strmatch (bbs_via (ptmes->bbsv), rej.via)) && (strmatch (ptmes->desti, rej.desti)) && (strmatch (ptmes->bid, rej.bid)) && (ptmes->taille >= taille) ); if (retour) break; } ++record; } return (retour); } static int tst_mes (int mode, bullist * ptmes) { if (ptmes->type == 'A') return (0); if (EMS_REJ_OK ()) { return (tst_mes_ems (mode, ptmes)); } else { char chaine[82], smode[20], type[20], exped[20]; char via[50], desti[20], bid[20]; long taille; int retour = 0; rej_scan = rej_file; while (rej_get (chaine)) { sscanf (chaine, "%s %s %s %s %s %s %ld", smode, type, exped, via, desti, bid, &taille); if (toupper (*smode) != mode) continue; taille *= 1000; retour = ( ((type[0] == '*') || (type[0] == ptmes->type)) && (strmatch (ptmes->exped, exped)) && (strmatch (bbs_via (ptmes->bbsv), via)) && (strmatch (ptmes->desti, desti)) && (strmatch (ptmes->bid, bid)) && (ptmes->taille >= taille) ); if (retour) break; } return (retour); } } int rejet (bullist * ptmes) { int retour; retour = tst_mes ('R', ptmes); if ((svoie[voiecur]->fbb >= 2) || (svoie[voiecur]->mbl_ext)) return ((retour) ? 4 : 0); else return ((retour) ? 1 : 0); } int retenu (bullist * ptmes) { int retour; retour = tst_mes ('H', ptmes); if (svoie[voiecur]->fbb >= 2) return ((retour) ? 5 : 0); else return (0); } int hold (bullist * ptmes) { int retenu = 0; if ((!pvoie->header) || (pvoie->mode == 0)) { retenu = tst_mes ('L', ptmes); } if (!retenu) { retenu = tst_mes ('H', ptmes); } return (retenu); } /* * Mode = 0 : Tous caracteres entre 0x21 et 0xff * Mode = 1 : champ sans '@' ni '.' * Mode = 2 : champ d'adresse hierarchique sans '@' * */ static int lit_champ (char *champ, int nb, int mode) { int i; int error = 0; char *str = indd; char last = '\0'; while ((*indd) && (!isspace (*indd))) { if (!ISGRAPH (*indd)) { error = 1; break; } if (mode == 1) { if (((std_header & 1) == 0) && (*indd == '@')) { break; } if (*indd == '.') { error = 1; break; } } else if (mode == 2) { if (*indd == '@') { error = 1; break; } } if (--nb < 0) break; *champ++ = toupper(*indd); last = *indd++; } *champ = '\0'; if (nb < 0) error = 2; if ((mode == 2) && ((std_header & 2) == 0) && (last == '.')) error = 1; if (!error) return (1); if (FOR (pvoie->mode)) return (0); for (i = 0; i < 40; ++str) { if (isspace (*str)) break; varx[0][i++] = toupper (*str); } varx[0][i] = '\0'; switch (error) { case 1: /* Champ errone */ texte (T_ERR + 17); break; case 2: /* Champ trop long */ texte (T_ERR + 16); break; } return (0); } static void lit_fich (char *champ, int nb) { while ((nb--) && (ISGRAPH (*indd))) { *champ++ = *indd++; } *champ = '\0'; } void ch_bbs (int mode, char ifwd[NBBBS][7]) { int i, bbs, tempif, cptif = 0, nb_fwd = 0; char nombbs[80]; char combuf[80]; char *pcom; /* init_bbs() ; */ bbs = 0; for (i = 0; i < NBMASK * 8; i++) *ifwd[i] = '\0'; rewind_fwd (); while (fwd_get (combuf)) { pcom = combuf; switch (*pcom++) { case 'A': /* recuperer le nom de la BBS destinataire */ strcpy (nombbs, pcom); bbs = num_bbs (nombbs); strn_cpy (6, ifwd[bbs - 1], nombbs); nb_fwd++; break; case 'E': /* ENDIF */ if (!mode) --cptif; break; case 'I': /* IF */ if (mode) break; ++cptif; if (tst_fwd (pcom, bbs, time (NULL), 0, NULL, 1, -1) == FALSE) { tempif = cptif - 1; while (cptif != tempif) { if (fwd_get (combuf) == 0) { break; } pcom = combuf; switch (*pcom++) { case 'I': ++cptif; break; case 'E': --cptif; break; case '@': if (cptif == (tempif + 1)) ++tempif; break; default: break; } } } break; case '@': /* ELSE */ if (mode) break; if (cptif == 0) break; tempif = cptif - 1; while (cptif != tempif) { if (fwd_get (combuf) == 0) { break; } pcom = combuf; switch (*pcom++) { case 'I': ++cptif; break; case 'E': --cptif; break; default: break; } } break; default: break; } if (nb_fwd == NBMASK * 8) break; } } int test_linked (void) { strupr (sup_ln (indd)); if ((pvoie->aut_linked) && (strncmp (indd, "LINKED TO ", 10) == 0)) { strtok (indd, " "); libere_zones_allouees (voiecur); /* Vide les eventuelles listes */ maj_niv (0, 0, 0); con_voie (voiecur, indd); return (1); } return (0); } void clear_fwd (long numero) { recfwd *prec; int pos = 0; lfwd *ptr_fwd = tete_fwd; if (fast_fwd) { while (1) { if (pos == NBFWD) { ptr_fwd = ptr_fwd->suite; if (ptr_fwd == NULL) break; pos = 0; } prec = &ptr_fwd->fwd[pos]; if ((prec->type) && (prec->nomess == numero)) { prec->type = '\0'; break; } pos++; } } } fbb-7.04j/src/fwdovl7.c0100644000175100017510000004033707726646105012751 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE FORWARDING OVERLAY 7 */ #include static int all_digit (char *); static void maint_bid (char *); void delete_bid (char *bid) { FILE *fptr; bidfwd fwbid; int pos; int i; char *ptr; pos = search_bid (bid); if (bid_ptr) { ptr = bid_ptr + ((pos - 1) * BIDCOMP); for (i = 0; i < BIDCOMP; i++, *ptr++ = '\0'); } else if (EMS_BID_OK ()) { delete_exms_bid (pos); } if ((fptr = fopen (d_disque ("WFBID.SYS"), "r+b")) != NULL) { ptmes->type = '\0'; ptmes->numero = 0L; *ptmes->bid = '\0'; fseek (fptr, (long) pos * sizeof (bidfwd), 0); fwrite (&fwbid, sizeof (fwbid), 1, fptr); fclose (fptr); } } int dec_fwd (char *bbs) { Forward *pfwd; int port, noport; int voie; int nobbs; strupr (sup_ln (bbs)); if ((isdigit (*bbs)) && (!ISGRAPH (*(bbs + 1)))) { noport = *bbs - '0'; if (noport == 9) { /* Stoppe le forward sur tous les ports */ *bbs = '\0'; for (port = 1; port < NBPORT; port++) { if (p_port[port].pvalid) { pfwd = p_port[port].listfwd; while (pfwd) { if (pfwd->forward) { if (pfwd->forward > 0) { deconnexion (pfwd->forward, 1); deconnexion (pfwd->forward, 1); deconnexion (pfwd->forward, 1); svoie[pfwd->forward]->curfwd = NULL; } *pfwd->fwdbbs = '\0'; pfwd->forward = 0; pfwd->fwdpos = 0; pfwd->fin_fwd = pfwd->cptif = pfwd->fwdlig = 0; pfwd->reverse = 0; } pfwd = pfwd->suite; } } } } else if (noport >= 0) { /* Selectionne un port */ *bbs = '\0'; if (p_port[noport].pvalid) { pfwd = p_port[noport].listfwd; while (pfwd) { if (pfwd->forward) { if (pfwd->forward > 0) { deconnexion (pfwd->forward, 1); deconnexion (pfwd->forward, 1); deconnexion (pfwd->forward, 1); svoie[pfwd->forward]->curfwd = NULL; } *pfwd->fwdbbs = '\0'; pfwd->forward = 0; pfwd->fwdpos = 0; pfwd->fin_fwd = pfwd->cptif = pfwd->fwdlig = 0; pfwd->reverse = 0; } pfwd = pfwd->suite; } } } } else { nobbs = num_bbs (bbs); if (nobbs) { /* Selectionne une BBS */ noport = -1; for (port = 1; port < NBPORT; port++) { if (p_port[port].pvalid) { pfwd = p_port[port].listfwd; while (pfwd) { if (pfwd->no_bbs == nobbs) { if (pfwd->forward > 0) { voie = pfwd->forward; if (svoie[voie]->sta.connect) { deconnexion (voie, 1); deconnexion (voie, 1); deconnexion (voie, 1); } else { /* Incident, la voie n'est pas connecte */ pfwd->forward = -1; pfwd->no_bbs = 0; } } noport = port; break; } pfwd = pfwd->suite; } } } } else noport = -2; } aff_forward (); return (noport); } static int all_digit (char *ptr) { while (*ptr) { if (!isdigit (*ptr)) return (0); ++ptr; } return (1); } static void maint_bid (char *ptr) { FILE *fptr; bidfwd fwbid; char choix = '?'; char bid[25]; char s[80]; int err = 0; int pos; ptr[20] = '\0'; if (sscanf (ptr, "%s %c", bid, &choix) == 0) err = 1; strupr (bid); if (!err) { pos = search_bid (bid); switch (choix) { case '?': if (pos) { if ((fptr = fopen (d_disque ("WFBID.SYS"), "r+b")) != NULL) { fseek (fptr, (long) pos * sizeof (bidfwd), 0); fread (&fwbid, sizeof (fwbid), 1, fptr); sprintf (s, "$:%s #:%ld T:%c", fwbid.fbid, fwbid.numero, fwbid.mode); outsln (s, strlen (s)); fclose (fptr); } else texte (T_ERR + 19); } else texte (T_ERR + 19); break; case '+': if (!pos) { ptmes->type = 'M'; ptmes->numero = 0L; strn_cpy (12, ptmes->bid, bid); w_bid (); } break; case '-': if (pos) { delete_bid (bid); } else texte (T_ERR + 19); break; default: err = 1; break; } } if (err) texte (T_ERR + 0); } void fwd_value (char *maxfwd, char *typfwd, char *typdat) { int cptif; int nobbs = 0; int temp; int i; char combuf[80]; char *pcom; long h_time = time (NULL); for (i = 0; i <= NBBBS; i++) { maxfwd[i] = 0xff; typfwd[i] = 0; typdat[i] = 1; } cptif = 0; rewind_fwd (); while (fwd_get (combuf)) { pcom = combuf; switch (*pcom++) { case 'A': /* BBS destinataire */ nobbs = num_bbs (pcom); break; case 'E': /* ENDIF */ --cptif; break; case 'I': /* IF */ ++cptif; if (tst_fwd (pcom, nobbs, h_time, 0, NULL, 1, -1) == FALSE) { temp = cptif - 1; while (cptif != temp) { if (fwd_get (combuf) == 0) break; pcom = combuf; switch (*pcom++) { case 'I': ++cptif; break; case 'E': --cptif; break; case '@': if (cptif == (temp + 1)) ++temp; break; default: break; } } } break; case 'J': /* Selection des messages "data" */ typdat[nobbs] = atoi (pcom); break; case 'T': /* limite la taille du fichier forwarde */ while (*pcom) { if (toupper (*pcom) == 'M') { ++pcom; maxfwd[nobbs] = (uchar) atoi (pcom); while (isdigit (*pcom)) ++pcom; } else if (toupper (*pcom) == 'O') { ++pcom; while (isdigit (*pcom)) ++pcom; } else if (toupper (*pcom) == 'P') { typfwd[nobbs] |= FWD_PRIV; ++pcom; } else if (toupper (*pcom) == 'S') { typfwd[nobbs] |= FWD_SMALL; ++pcom; } else if (toupper (*pcom) == 'D') { typfwd[nobbs] |= FWD_DUPES; ++pcom; } else if (isdigit (*pcom)) { maxfwd[nobbs] = (uchar) atoi (pcom); while (isdigit (*pcom)) ++pcom; } else ++pcom; } break; case '@': /* ELSE */ temp = cptif - 1; while (cptif != temp) { if (fwd_get (combuf) == 0) break; pcom = combuf; switch (*pcom++) { case 'I': ++cptif; break; case 'E': --cptif; break; default: break; } } break; case '*': case '#': /* ligne commentaire */ break; case '-': /* fin de bloc */ break; } } } static void no_route (int c_r) { #ifdef ENGLISH out ("No route ", 12); #else out ("Pas de route", 12); #endif if (c_r) cr (); } int maint_fwd (void) { int c, voie, nobbs, trouve = 0, err = 0; int noport, port_fwd, reverse = 0; int nb; long nmess; char bbs[80], s[80]; char filename[MAXPATH]; atfwd *nbmess; char *ptr; char maxfwd[NBBBS + 1]; char typfwd[NBBBS + 1]; char typdat[NBBBS + 1]; strupr (indd); c = *indd++; if (!teste_espace ()) err = 2; ptr = indd; switch (c) { case 'A': /* Mark a message to be forwarded to a BBS */ if (err) break; if ((nmess = lit_chiffre (1)) != 0L) { if (sscanf (indd, "%s", bbs) != 1) texte (T_ERR + 0); else if (!ch_record (ptmes, nmess, '\0')) { ptmes->numero = nmess; texte (T_ERR + 10); } else if ((nobbs = num_bbs (bbs)) == 0) texte (T_ERR + 0); else { indd = ptr; set_bit_fwd (ptmes->fbbs, nobbs); clr_bit_fwd (ptmes->forw, nobbs); if (*(ptmes->bbsv) == '\0') strn_cpy (40, ptmes->bbsv, bbs); if (ptmes->status == 'F') { if (ptmes->type == 'B') ptmes->status = '$'; else { ptmes->status = 'Y'; } } maj_rec (nmess, ptmes); clear_fwd (nmess); ins_fwd (ptmes); mbl_disbul (); } } break; case 'B': /* Print the forward list of messages forwarded to a BBS */ if (*indd) { char maxfwd[NBBBS + 1]; char typfwd[NBBBS + 1]; char typdat[NBBBS + 1]; fwd_value (maxfwd, typfwd, typdat); if ((nobbs = num_bbs (sup_ln (indd))) == 0) { texte (T_ERR + 0); break; } pvoie->typlist = 1; print_fwd (nobbs, maxfwd[nobbs], 0, typfwd[nobbs], typdat[nobbs]); err = 3; } else { texte (T_ERR + 7); } break; case 'C': /* Forward check : Gives the route */ if (*indd) { if (err) break; ini_champs (voiecur); sup_ln (indd); strn_cpy (40, s, indd); ptr = bbs_via(indd); if (find (ptr)) { ptmes->type = 'P'; ptmes->status = 'N'; strn_cpy (40, ptmes->bbsv, s); } else if (all_digit (ptr)) { ptmes->type = 'T'; ptmes->status = 'N'; strn_cpy (6, ptmes->desti, indd); } else { ptmes->type = 'B'; ptmes->status = '$'; strn_cpy (40, ptmes->bbsv, s); } if (!test_forward (0)) no_route (0); cr (); } else { err = 0; nobbs = 0; } break; /* case 'K' : break ; */ case 'D': /* Un-mark a message to be forwarded to a BBS */ if (err) break; if ((nmess = lit_chiffre (1)) != 0L) { if (sscanf (indd, "%s", bbs) != 1) texte (T_ERR + 0); else if (!ch_record (ptmes, nmess, '\0')) { ptmes->numero = nmess; texte (T_ERR + 10); } else if ((nobbs = num_bbs (bbs)) == 0) texte (T_ERR + 0); else { indd = ptr; clr_bit_fwd (ptmes->fbbs, nobbs); set_bit_fwd (ptmes->forw, nobbs); if (*(ptmes->bbsv) == '\0') strn_cpy (40, ptmes->bbsv, bbs); maj_rec (nmess, ptmes); clear_fwd (nmess); ins_fwd (ptmes); mbl_disbul (); } } break; case 'G': /* Print the maessages partly sent */ err = 0; print_part (); break; case 'H': /* Prints the H-Route of a BBS */ if (*indd) { if (err) break; strn_cpy (40, ptmes->bbsv, indd); if (cherche_route (ptmes)) { texte (T_MBL + 41); } else no_route (1); } break; case 'I': /* BID maintenance */ if (*indd) { if (err) break; maint_bid (indd); } break; case 'L': /* Lists the pending forward */ if (*indd) { if (err) break; if ((nobbs = num_bbs (sup_ln (indd))) == 0) { texte (T_ERR + 0); break; } } else { err = 0; nobbs = 0; } if (!affiche_forward (nobbs)) texte (T_MBL + 3); break; case 'M': /* Import BBS forwarding from file*/ /* Read the callsign and the filename */ nb = sscanf (indd, "%s %s", bbs, filename); if (nb <= 0) texte (T_ERR + 7); else if (nb == 1) texte (T_ERR + 20); else if (nb == 2) { int fd; int sav_voie; if ((fd = open(filename, S_IREAD)) != -1) close(fd); else { strcpy(pvoie->appendf, filename); texte (T_ERR + 11); break; } /* Import channel free ? */ if ((!is_room ()) || (svoie[INEXPORT]->sta.connect) || (inexport)) { break; } sav_voie = voiecur; extind(bbs, svoie[INEXPORT]->sta.indicatif.call) ; svoie[INEXPORT]->sta.indicatif.num = 0 ; strcpy(io_fich, filename); mail_ch = INEXPORT; selvoie(mail_ch) ; pvoie->sta.connect = inexport = 4 ; pvoie->enrcur = 0L ; pvoie->debut = time(NULL); pvoie->mode = F_FOR | F_HIE | F_BID | F_MID ; pvoie->finf.lang = langue[0]->numlang ; aff_event(voiecur, 1); maj_niv(N_MBL, 99, 0) ; mbl_emul(); selvoie(sav_voie) ; outln("OK", 2); } else texte (T_ERR + 0); break; case 'N': /* Gives the forwarding status of a message */ if (err) break; mbl_disbul (); break; case 'P': /* Gives the swap information */ if (err) break; indd[50] = '\0'; ini_champs (voiecur); #define DIEZE "#" strcpy (ptmes->exped, DIEZE); strcpy (ptmes->bbsv, DIEZE); strcpy (ptmes->desti, DIEZE); nb = sscanf (indd, "%c %s", (char *)&c, s); if (nb == 2) { switch (c) { case '<': strn_cpy (6, ptmes->exped, s); swapp_bbs (ptmes); if (strcmp (ptmes->exped, s) == 0) strcpy (ptmes->exped, DIEZE); break; case '>': strn_cpy (6, ptmes->desti, s); swapp_bbs (ptmes); if (strcmp (ptmes->desti, s) == 0) strcpy (ptmes->desti, DIEZE); break; case '@': strn_cpy (6, ptmes->bbsv, s); swapp_bbs (ptmes); if (strcmp (ptmes->bbsv, s) == 0) strcpy (ptmes->bbsv, DIEZE); break; default: c = 0; break; } if (c > 0) { swapp_bbs (ptmes); if (*ptmes->exped != '#') { sprintf (s, "< %s ", ptmes->exped); out (s, strlen (s)); trouve = 1; } if (*ptmes->bbsv != '#') { sprintf (s, "@ %s ", ptmes->bbsv); out (s, strlen (s)); trouve = 1; } if (*ptmes->desti != '#') { sprintf (s, "> %s ", ptmes->desti); out (s, strlen (s)); trouve = 1; } if (trouve) cr (); } else texte (T_ERR + 0); } else texte (T_ERR + 0); break; case 'S': /* Forward stop */ if (err) break; if (*indd) { int save_voie = voiecur; switch (noport = dec_fwd (indd)) { case -1: sprintf (s, "BBS %s is not forwarding", indd); break; case -2: sprintf (s, "Unknown BBS %s", indd); break; default: if (*indd) sprintf (bbs, "with %s ", indd); else *bbs = '\0'; sprintf (s, "Stopping forwarding %son port %d", bbs, noport); break; } selvoie (save_voie); outln (s, strlen (s)); } else { texte (T_ERR + 7); } break; case 'T': /* Pending forward */ fwd_value (maxfwd, typfwd, typdat); if (*indd) { if ((nobbs = num_bbs (sup_ln (indd))) == 0) { texte (T_ERR + 0); break; } if ((nbmess = attend_fwd (nobbs, maxfwd[nobbs], 0, typfwd[nobbs], typdat[nobbs])) != 0L) { sprintf (s, "%s: %dP /%dB - %d KB", indd, nbmess->nbpriv, nbmess->nbbul, nbmess->nbkb); outln (s, strlen (s)); trouve = 1; } } else { ptr = bbs_ptr; for (nobbs = 1; nobbs <= NBBBS; ++nobbs, ptr += 7) { if ((nbmess = attend_fwd (nobbs, maxfwd[nobbs], 0, typfwd[nobbs], typdat[nobbs])) != 0L) { n_cpy (6, bbs, ptr); sprintf (s, "%-6s : %2dP /%3dB - %d KB", bbs, nbmess->nbpriv, nbmess->nbbul, nbmess->nbkb); outln (s, strlen (s)); trouve = 1; } } } if (!trouve) texte (T_MBL + 3); err = 0; break; case 'U': /* Disconnect a forwarding channel */ if (err) break; if (isdigit (*indd)) { voie = atoi (indd) + 1; if ((voie > 0) && (voie < NBVOIES) && (svoie[voie]->sta.connect)) { sprintf (s, "Disconnecting channel %d", virt_canal (voie)); force_deconnexion (voie, 1); } else { sprintf (s, "Channel %d is not connected", virt_canal (voie)); } outln (s, strlen (s)); } else texte (T_ERR + 3); break; case 'V': /* Strat message scanning */ p_forward = 1; maj_options (); init_buf_fwd (); init_buf_swap (); init_buf_rej (); init_bbs (); aff_nbsta (); outln ("Message scanning ok", 19); err = 0; break; case 'R': /* Start reverse forwarding */ reverse = 1; case 'W': /* Start forwarding */ if (err) break; if (*indd) { switch (noport = val_fwd (indd, &port_fwd, reverse)) { case -1: sprintf (s, "No forwarding channel available on port %d", port_fwd); break; case -2: sprintf (s, "No port defined for %s", indd); break; case -3: sprintf (s, "Unknown BBS %s", indd); break; case -4: sprintf (s, "BBS %s already connected", indd); break; default: sprintf (s, "Forwarding %s on port %d", indd, noport); break; } outln (s, strlen (s)); } else { texte (T_ERR + 7); } break; default: err = 1; --indd; break; } if (err == 2) { texte (T_ERR + 2); err = 0; } if (err == 0) retour_mbl (); if (err == 3) err = 0; return (err); } fbb-7.04j/src/fwdutil.c0100644000175100017510000003570107726646105013036 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE FWDUTIL.C */ #include static long hold_nb = 0L; static void append_message (void); static int data_sysop (void); static int hold_wp (void); /* * RECEPTION D'UN MESSAGE */ void libere (int voie) { obuf *msgtemp; while ((msgtemp = svoie[voie]->msgtete) != NULL) { svoie[voie]->memoc -= msgtemp->nb_car; svoie[voie]->msgtete = msgtemp->suiv; m_libere ((char *) msgtemp, sizeof (obuf)); msgtemp = NULL; } svoie[voie]->entmes.numero = 0L; } void supp_mess (long nmess) { char temp[128]; if (nmess) unlink (mess_name ((pvoie->binary) ? MBINDIR : MESSDIR, nmess, temp)); } int write_mess_temp (unsigned mode, int voie) { int fd; obuf *msgtemp; char temp[128]; temp_name (voie, temp); fd = open (temp, O_WRONLY | O_APPEND | O_CREAT | mode, S_IREAD | S_IWRITE); if (fd != -1) { while ((msgtemp = pvoie->msgtete) != NULL) { if (write (fd, msgtemp->buffer, msgtemp->nb_car) != msgtemp->nb_car) { write_error (temp); } pvoie->memoc -= msgtemp->nb_car; pvoie->msgtete = msgtemp->suiv; m_libere ((char *) msgtemp, sizeof (*msgtemp)); } close (fd); return (1); } else { fbb_error (ERR_OPEN, temp, 0); return (0); } } #if 0 int write_mess (unsigned mode, long nmess) { int fd; obuf *msgtemp; if (nmess == 0L) nmess = next_num (); fd = open (nom_mess ((mode == O_BINARY) ? MBIN : MESS, nmess), O_WRONLY | O_APPEND | O_CREAT | mode, S_IREAD | S_IWRITE); if (fd != -1) { while (msgtemp = pvoie->msgtete) { if (write (fd, msgtemp->buffer, msgtemp->nb_car) != msgtemp->nb_car) { write_error (); } pvoie->memoc -= msgtemp->nb_car; pvoie->msgtete = msgtemp->suiv; m_libere ((char *) msgtemp, sizeof (*msgtemp)); } close (fd); return (1); } else { write_error (); return (0); } } #endif static void append_message (void) { int nb; FILE *fd, *fich_ptr; char buffer[250]; if ((fich_ptr = fopen (pvoie->appendf, "rb")) == NULL) { texte (T_ERR + 11); } else { next_num (); if ((fd = fopen (mess_name (MESSDIR, ptmes->numero, buffer), "ab")) != NULL) { while (1) { fflush (fich_ptr); nb = read (fileno (fich_ptr), buffer, 250); ptmes->taille += nb; if (fwrite (buffer, nb, 1, fd) < 1) write_error (mess_name (MESSDIR, ptmes->numero, buffer)); if (nb < 250) break; } ferme (fd, 45); } ferme (fich_ptr, 44); if (voiecur == CONSOLE) texte (T_MBL + 20); } } void ins_fwd (bullist * fwd_rec) { int pos; lfwd *ptr_fwd; char *ptr = NULL; ptr_fwd = tete_fwd; pos = 0; if ((!fast_fwd) || (fwd_rec->numero == 0L)) return; if (ptr_fwd == NULL) { cprintf ("ptr_fwd = NULL !!!\n"); *ptr = 0; } while (1) { if (pos == NBFWD) { if (ptr_fwd->suite == NULL) ptr_fwd = cree_bloc_fwd (ptr_fwd); else ptr_fwd = ptr_fwd->suite; pos = 0; } if (ptr_fwd->fwd[pos].type == '\0') { fwd_cpy (&ptr_fwd->fwd[pos], fwd_rec); break; } ++pos; } } static void test_ping_pong (bullist * lbul) { int i; if ((lbul->type != 'P') || (*lbul->bbsv == '\0')) return; if (pvoie->warning & W_ROU) return; for (i = 0; i < NBMASK; i++) if (lbul->fbbs[i]) return; /* Ya une bbs, pas de warning et pas de route -> ping-pong ! */ dde_warning (W_PPG); } static int data_sysop (void) { if ((std_header & 32) && (strcmp (ptmes->desti, "SYSOP") == 0) && (ptmes->type == 'P') && (ptmes->bin)) { return (1); } else return (0); } static int hold_wp (void) { if ((std_header & 256) && (strcmp (ptmes->desti, "WP") == 0)) return (0); return (1); } int is_held (char *ascfile) { long temps; char holdname[130]; int i; int nobbs; char status = '\0'; char s[256]; long numess = ptmes->numero; if (test_message) { int ret = -1; /* Ecrire les infos ptmes dans le record 0 de DIRMES.SYS */ ptmes->numero = nomess; ouvre_dir (); write_dir (0, ptmes); ferme_dir (); ptmes->numero = numess; #ifdef __LINUX__ sprintf (s, "%sm_filter %s %c %s %s %d", FILTDIR, ascfile, ptmes->type, ptmes->exped, ptmes->desti, 0); ret = filter (s, NULL, 0, NULL, FILTDIR); #else sprintf (s, "m_filter %s %c %s %s %d", ascfile, ptmes->type, ptmes->exped, ptmes->desti, 0); ret = filter (s, NULL, 0, NULL, NULL); #endif switch (ret) { case -1: if (test_message == 2) { /* M-FILTER is not found ... Will not be called again */ test_message = 0; break; } case 1: /* Kill */ for (i = 0; i < NBMASK; i++) ptmes->fbbs[i] = ptmes->forw[i] = '\0'; status = 'K'; break; case 2: /* Archive */ for (i = 0; i < NBMASK; i++) ptmes->fbbs[i] = ptmes->forw[i] = '\0'; status = 'A'; break; case 3: /* Hold */ for (i = 0; i < NBMASK; i++) ptmes->fbbs[i] = ptmes->forw[i] = '\0'; if ((FOR (pvoie->mode)) && ((nobbs = n_bbs (pvoie->sta.indicatif.call)) != 0)) set_bit_fwd (ptmes->forw, nobbs); status = 'H'; break; default: break; } if (status) { ptmes->status = status; } } if (test_message == 2) test_message = 1; if ((hold_wp ()) && ((pvoie->msg_held) || (status == 'H') || (hold (ptmes)))) { /* Le message est HOLD. Il n'est pas gere, mais mis dans le repertoire HOLD */ ptmes->status = 'H'; ++nb_hold; if (*ptmes->bid) { w_bid (); } if ((FOR (pvoie->mode)) && ((nobbs = n_bbs (pvoie->sta.indicatif.call)) != 0)) set_bit_fwd (ptmes->forw, nobbs); /* Cree un index du nom de fichier */ temps = time (NULL); if (hold_nb >= temps) ++hold_nb; else hold_nb = temps; for (;;) { hold_name (hold_nb, holdname); if (access (holdname, 0) != 0) { hold_temp (voiecur, ascfile, holdname, TRUE); break; } ++hold_nb; } if (!FOR (pvoie->mode)) { texte (T_MBL + 59); } aff_msg_cons (); /* Affiche cons + held */ return (1); } return (0); } void put_mess_fwd (char clog) { int i; char s[256]; long numess = ptmes->numero; if (*(pvoie->appendf)) append_message (); if ((strncmp (ptmes->titre, "ACK", 3) != 0) && (strcmp (ptmes->exped, "WP") != 0) && (find (ptmes->exped)) && (!is_serv (ptmes->exped)) && (pvoie->niv2 != 99)) { exped_wp (ptmes->exped, pvoie->mess_home); } if ((ptmes->status != 'K') && (ptmes->status != 'A')) { if (ptmes->type == 'B') valide_themes (0, 1, ptmes); if (test_forward (1)) ins_fwd (ptmes); test_ping_pong (ptmes); if (!(FOR (pvoie->mode))) texte (T_MBL + 48); } if (clog) { sprintf (s, "%c %ld%c F:%s T:%s@%s [%ld] S:%s", clog, ptmes->numero, ptmes->type, ptmes->exped, ptmes->desti, ptmes->bbsv, ptmes->taille, ptmes->titre); fbb_log (voiecur, 'M', s); } libere (voiecur); flush_wp_cache (); pvoie->mess_recu = 1; pvoie->header = 0; ptmes->numero = numess; /* Supprime le message si datas en "SP SYSOP" */ if (data_sysop ()) { for (i = 0; i < NBMASK; i++) ptmes->fbbs[i] = ptmes->forw[i] = '\0'; ptmes->status = 'K'; clear_fwd (numess); } valmess (ptmes); ++nbmess; ins_iliste (ptmes); #ifdef __LINUX__ add_pfh (ptmes); #endif aff_msg_cons (); } void tst_ack (bullist * pbul) { int nb; int numlang = vlang; char temp; bullist psauve; char titre[90]; char texte[80]; char suite[80]; int mode = pvoie->binary; psauve = *pbul; if (pvoie->m_ack != 2) return; pvoie->m_ack = 0; set_binary (voiecur, 0); vlang = 0; if (*psauve.bbsv) { sprintf (suite, " - routed to %s", psauve.bbsv); } else *suite = '\0'; sprintf (titre, "ACK:%s", psauve.titre); sprintf (texte, "Msg %s@%s - %sz%s\032", psauve.desti, mycall, datheure_mbl (time (NULL) + _timezone), suite); vlang = numlang; ini_champs (voiecur); *ptmes->bbsf = '\0'; temp = *(pvoie->sta.indicatif.call); *(pvoie->sta.indicatif.call) = '@'; strn_cpy (6, ptmes->desti, psauve.exped); strn_cpy (6, ptmes->exped, mycall); n_cpy (60, ptmes->titre, titre); if (routage (psauve.numero)) { swapp_bbs (ptmes); ptmes->type = 'A'; ptmes->status = 'N'; reacheminement (); nb = strlen (texte); /* texte[nb] = '\032' ; */ get_mess_fwd ('\0', texte, nb, 2); } *(pvoie->sta.indicatif.call) = temp; *pbul = psauve; set_binary (voiecur, mode); } void tst_sysop (char *desti, long numero) { char buffer[80]; char sauv_ind[7]; bullist ptsauv = *ptmes; int mode = pvoie->binary; Msysop *sptr = mess_sysop; if (data_sysop ()) return; if ((sptr) && (strcmp (desti, "SYSOP") == 0)) { if (!find (ptmes->bbsv)) { set_binary (voiecur, 0); strn_cpy (6, sauv_ind, pvoie->sta.indicatif.call); strn_cpy (6, pvoie->sta.indicatif.call, "SYSOP"); while (sptr) { sprintf (buffer, "P %s", sptr->call); copy_mess (numero, buffer, '\032'); sptr = sptr->next; } strn_cpy (6, pvoie->sta.indicatif.call, sauv_ind); } } *ptmes = ptsauv; set_binary (voiecur, mode); } int get_mess_fwd (char clog, char *ptr, int nbcar, int type) { int ncars, debut = 1; int held = 0; long numess = 0L; obuf *msgtemp; char fin[2]; char *ptcur; char temp[128]; if ((msgtemp = pvoie->msgtete) != NULL) { while (msgtemp->suiv) msgtemp = msgtemp->suiv; } else { msgtemp = (obuf *) m_alloue (sizeof (obuf)); pvoie->msgtete = msgtemp; msgtemp->nb_car = msgtemp->no_car = 0; msgtemp->suiv = NULL; } ncars = msgtemp->nb_car; ptcur = msgtemp->buffer + ncars; while (nbcar--) { if (debut) { if ((pvoie->entete) && (*ptr == 'R') && (*(ptr + 1) == ':')) { analyse_header (voiecur, ptr); } else { pvoie->entete = 0; } if ((*ptr == '/') && (toupper (*(ptr + 1)) == 'A') && (toupper (*(ptr + 2)) == 'C')) { if (pvoie->m_ack == 1) { pvoie->m_ack = 2; } } check_bin (ptmes, ptr); if ((*ptr == '/') && (toupper (*(ptr + 1)) == 'A') && (toupper (*(ptr + 2)) == 'B')) { /* Message aborted */ texte (T_MBL + 21); type = 4; *ptr = '\32'; } if ((*ptr == '\32') || ((*ptr == '/') && (toupper (*(ptr + 1)) == 'E') && (toupper (*(ptr + 2)) == 'X'))) { int test; msgtemp->nb_car = ncars; if (type != 4) { /* Le BID existe ? -> message rejete ! */ if (((*ptmes->bid == '\0') || (*ptmes->bid == ' ')) && (((pvoie->mess_num != -1) && (*pvoie->mess_home)) || (*pvoie->mess_bid))) { make_bid (); if (deja_recu (ptmes, 1, &test) == 1) { type = 4; if (!(FOR (pvoie->mode))) texte (T_MBL + 45); } } if (pvoie->header) strn_cpy (6, ptmes->bbsf, pvoie->sta.indicatif.call); else *(ptmes->bbsf) = '\0'; ptmes->datesd = pvoie->messdate; ptmes->date = ptmes->datech = time (NULL); /* Mettre localtime ? */ if (type < 3) { /* Flush des buffers */ /* pdebug("(%d) create message file %s", voiecur, temp_name (voiecur, temp)); */ write_mess_temp (O_TEXT, voiecur); /* tester is hold ? */ if (is_held (temp_name (voiecur, temp))) held = 1; else { numess = ptmes->numero = next_num (); rename_temp (voiecur, mess_name (MESSDIR, numess, temp)); } } } switch (type) { case 0: if (!held) { put_mess_fwd (clog); tst_sysop (ptmes->desti, numess); tst_serveur (ptmes); tst_ack (ptmes); tst_warning (ptmes); } retour_menu ((pvoie->mbl) ? N_MBL : N_MENU); /* deconnexion si fin de message */ if (save_fic) pvoie->deconnect = 6; break; case 1: if (!held) { put_mess_fwd (clog); tst_sysop (ptmes->desti, numess); tst_serveur (ptmes); tst_ack (ptmes); tst_warning (ptmes); } maj_niv (pvoie->niv1, pvoie->niv2, 0); texte (T_MBL + 42); /* deconnexion si fin de message */ if (save_fic) pvoie->deconnect = 6; break; case 2: if (!held) { put_mess_fwd (clog); tst_sysop (ptmes->desti, numess); tst_serveur (ptmes); tst_ack (ptmes); tst_warning (ptmes); } /* deconnexion si fin de message */ if (save_fic) pvoie->deconnect = 6; break; case 3: del_temp (voiecur); libere (voiecur); break; case 4: del_temp (voiecur); libere (voiecur); if (voiecur != INEXPORT) retour_menu ((pvoie->mbl) ? N_MBL : N_MENU); break; } return (1); } } else { if (*ptr == '\32') { fin[0] = '\r'; fin[1] = '\32'; ptr = fin; nbcar = 1; debut = 1; } } if (*ptr == '\n') ++ptr; else { if (*ptr == '\r') { *ptr = '\n'; if ((nbcar > 0) && (*(ptr + 1) == '\n')) { --nbcar; ++ptr; } debut = 1; } else debut = 0; ++pvoie->memoc; ++(ptmes->taille); *ptcur++ = *ptr++; if (++ncars == 250) { msgtemp->nb_car = ncars; msgtemp->suiv = (obuf *) m_alloue (sizeof (obuf)); msgtemp = msgtemp->suiv; msgtemp->nb_car = msgtemp->no_car = ncars = 0; msgtemp->suiv = NULL; ptcur = msgtemp->buffer; } } } msgtemp->nb_car = ncars; if (pvoie->memoc > MAXMEM) { if (type != 3) write_mess_temp (O_TEXT, voiecur); else libere (voiecur); } return (0); } int mbl_hold (void) { long no; long temps; char holdname[130]; char filename[130]; if ((toupper (*indd) == 'O') && (droits (COSYSOP))) { ++indd; if (!teste_espace ()) { texte (T_ERR + 2); retour_mbl (); return (0); } if (((no = lit_chiffre (1)) != 0L) && (ch_record (NULL, no, ' ') != NULL) && (ptmes->status != 'A')) { mess_name (MESSDIR, no, filename); /* Cree un index du nom de fichier */ temps = time (NULL); if (hold_nb >= temps) ++hold_nb; else hold_nb = temps; for (;;) { hold_name (hold_nb, holdname); if (access (holdname, 0) != 0) { hold_temp (voiecur, filename, holdname, FALSE); break; } ++hold_nb; } ++nb_hold; texte (T_MBL + 59); /* Passe le message en status ARCHIVE cach ... */ ch_record (NULL, no, 'Z'); /* Supprime le message de la liste des fwd */ clear_fwd (no); aff_msg_cons (); /* Affiche cons + held */ } else texte (T_ERR + 10); retour_mbl (); return (0); } return (1); } fbb-7.04j/src/gesfic.c0100644000175100017510000004175507726646105012626 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #define FBB_IO #include #if defined(__FBBDOS__) || defined(__WINDOWS__) #include #endif #define CTRL_Z '\032' static unsigned long *lmode = NULL; static int nb_lmode = 0; #define MODE_INC 32 #if !defined(__WIN32__) && (defined(__FBBDOS__) || defined(__WINDOWS__)) extern unsigned int _openfd[]; #endif static int set_mode (int fd, unsigned long mode) { if (lmode == NULL) { nb_lmode = MODE_INC; lmode = malloc(sizeof(unsigned long) * nb_lmode); if (lmode == NULL) { nb_lmode = 0; return 0; } } while (fd >= nb_lmode) { nb_lmode += MODE_INC; lmode = realloc(lmode, sizeof(unsigned long) * nb_lmode); if (lmode == NULL) { nb_lmode = 0; return 0; } } lmode[fd] = mode; return 1; } static unsigned long get_mode (int fd) { return lmode[fd]; } char *lfile (char *filename) { static char lockname[256]; char *ptr; strcpy (lockname, filename); ptr = strrchr (lockname, '.'); if (ptr) *ptr = '\0'; strcat (lockname, ".lck"); return (lockname); } char *slash2back (char *str) { static char buf[256]; char *ptr = buf; int nb = 0; while (*str) { if (*str == '/') *ptr = '\\'; // else if (islower (*str)) // *ptr = toupper (*str); else *ptr = *str; ++ptr; ++str; if (++nb == 255) break; } *ptr = '\0'; return (buf); } char *back2slash (char *str) { static char buf[256]; char *ptr = buf; int nb = 0; if ((strlen (str) > 2) && (str[1] == ':')) str += 2; while (*str) { if (*str == '\\') *ptr = '/'; // else if (isupper (*str)) // *ptr = tolower (*str); else *ptr = *str; ++ptr; ++str; if (++nb == 255) break; } *ptr = '\0'; return (buf); } int fbb_access (char *filename, int mode) { #ifdef __LINUX__ return (access (back2slash (filename), mode)); #else return (access (filename, mode)); #endif } int fbb_stat (char *filename, struct stat *buf) { #ifdef __LINUX__ return (stat (back2slash (filename), buf)); #else return (stat (filename, buf)); #endif } #ifdef __LINUX__ int fbb_mkdir (char *filename, int mode) { return (mkdir (back2slash (filename), mode)); } #else int fbb_mkdir (char *filename) { return (mkdir (filename)); } #endif int fbb_rmdir (char *filename) { #ifdef __LINUX__ return (rmdir (back2slash (filename))); #else return (rmdir (filename)); #endif } #ifdef __LINUX__ int fbb_statfs (char *filename, struct statfs *buf) { return (statfs (back2slash (filename), buf)); } #endif void fbb_textattr (int att) { #ifdef __FBBDOS__ if (video_off == 2) att = 0; textattr (att); #endif } char *fbb_fgets (char *s, int n, FILE * fptr) { char *pres; #ifdef __LINUX__ pres = fgets (s, n, fptr); if (lmode[fileno (fptr)] & O_TEXT) { if (pres) { char *ptr = pres; char *out = pres; while (*ptr) { if (*ptr == '\r') { ++ptr; continue; } if (*ptr == CTRL_Z) break; *out++ = *ptr++; } *out = '\0'; } } #else deb_io (); pres = fgets (s, n, fptr); fin_io (); #endif return (pres); } int fbb_fputs (char *s, FILE * fptr) { int res; deb_io (); res = fputs (s, fptr); fin_io (); return (res); } int fbb_fgetc (FILE * fptr) { int res; deb_io (); res = fgetc (fptr); #ifdef __LINUX__ if (get_mode(fileno (fptr)) & O_TEXT) { if (res == CTRL_Z) res = EOF; else if (res == '\r') { res = fgetc (fptr); if (res == CTRL_Z) res = EOF; } } #endif fin_io (); return (res); } int fbb_fputc (int c, FILE * fptr) { int res; deb_io (); res = fputc (c, fptr); fin_io (); return (res); } FILE *fbb_fopen (char *filename, char *mode) { FILE *fptr; deb_io (); #ifdef __LINUX__ fptr = fopen (back2slash (filename), mode); #else fptr = fopen (filename, mode); #endif fin_io (); if (fptr) { char *ptr = mode; set_mode(fileno (fptr), 0); while (*ptr) { if (*ptr == 't') set_mode(fileno (fptr), O_TEXT); if (*ptr == 'a') fseek (fptr, 0L, SEEK_END); ++ptr; } } return (fptr); } FILE *fsopen (char *filename, char *mode) { #ifdef __LINUX__ FILE *fptr; fptr = fopen (back2slash (filename), mode); if (fptr) { char *ptr = mode; set_mode(fileno (fptr), 0); while (*ptr) { if (*ptr == 't') set_mode(fileno (fptr), O_TEXT); if (*ptr == 'a') fseek (fptr, 0L, SEEK_END); ++ptr; } } return (fptr); #endif #if defined(__FBBDOS__) || defined(__WINDOWS__) int fd; char s[80]; FILE *fptr; deb_io (); for (;;) { fd = sopen (filename, O_RDONLY | O_TEXT, SH_DENYWR, 0); if ((fd >= 0) || (errno != EACCES)) break; aff_etat ('Z'); fin_io (); #ifdef ENGLISH sprintf (s, "SHARING VIOLATION (%s)", filename); #else sprintf (s, "VIOLATION PARTAGE (%s)", filename); #endif win_message (2, s); deb_io (); } if (fd < 0) fptr = NULL; else fptr = fdopen (fd, mode); fin_io (); return (fptr); #endif } int fbb_fclose (FILE * fptr) { int res; int fd = fileno (fptr); deb_io (); res = fclose (fptr); set_mode(fd, 0); fin_io (); return (res); } int fbb_open (char *filename, int acces, unsigned mode) { int fd; deb_io (); #ifdef __LINUX__ fd = open (back2slash (filename), acces & (~O_TEXT), mode); #else fd = open (filename, acces, mode); #endif fin_io (); if (fd > 0) set_mode(fd, acces & O_TEXT); return (fd); } int fbb_close (int fd) { int res; deb_io (); res = close (fd); set_mode(fd, 0); fin_io (); return (res); } int fbb_read (int fd, void *buf, unsigned nb) { int retour; deb_io (); #ifdef __LINUX__ retour = read (fd, buf, nb); /* search for ^Z */ if ((retour > 0) && (get_mode(fd) & O_TEXT)) { int n; char *ptr = (char *) buf; for (n = 0; n < retour; n++) { if (ptr[n] == CTRL_Z) { retour = n; break; } } } #else retour = _read (fd, buf, nb); if ((retour > 0) && (get_mode(fd) & O_TEXT)) { int i, n; char *ptri = (char *) buf; char *ptro = (char *) buf; for (i = 0, n = 0; i < retour; i++) { if (ptri[i] == '\r') continue; else if (ptri[i] == CTRL_Z) break; else ptro[n++] = ptri[i]; } retour = n; } #endif fin_io (); return (retour); } int fbb_write (int fd, void *buf, unsigned nb) { int retour; deb_io (); #ifdef __LINUX__ if (get_mode(fd) & O_TEXT) { int i; int len; char *ptro, *ptri; /* Ignorer CR, Remplacer LF par CRLF */ ptri = (char *) buf; if (nb) { ptro = (char *) malloc (nb * 2); for (len = 0, i = 0; i < nb; i++) { if (ptri[i] == '\r') { continue; } else if (ptri[i] == '\n') { ptro[len++] = '\r'; ptro[len++] = '\n'; } else { ptro[len++] = ptri[i]; } } retour = write (fd, ptro, len); if (retour == len) retour = nb; free (ptro); } else { retour = write (fd, ptri, nb); } } else #endif retour = write (fd, buf, nb); fin_io (); return (retour); } int fbb_fread (void *ptr, size_t taille, size_t n, FILE * fp) { int retour; deb_io (); retour = fread (ptr, taille, n, fp); #ifdef __LINUX__ /* search for ^Z */ if ((retour > 0) && (get_mode(fileno (fp)) & O_TEXT)) { int i; char *p = (char *) ptr; for (i = 0; i < taille * n; i++) { if (p[i] == CTRL_Z) { p[i] = '\0'; break; } } } #endif fin_io (); return (retour); } int fbb_fwrite (void *ptr, size_t taille, size_t n, FILE * fp) { int retour; deb_io (); retour = fwrite (ptr, taille, n, fp); fin_io (); return (retour); } int fbb_findfirst (char *chemin, struct ffblk *ffblk, int attribut) { int retour; deb_io (); retour = findfirst (chemin, ffblk, attribut); fin_io (); return (retour); } int fbb_findnext (struct ffblk *ffblk) { int retour; deb_io (); retour = findnext (ffblk); fin_io (); return (retour); } int fbb_unlink (char *filename) { int retour; deb_io (); #ifdef __LINUX__ retour = unlink (back2slash (filename)); #else retour = unlink (filename); #endif fin_io (); return (retour); } long fbb_filelength (int fd) { long retour; deb_io (); retour = filelength (fd); fin_io (); return (retour); } FILE *ouvre_stats (void) { FILE *fptr; while (TRUE) { if ((fptr = fbb_fopen (d_disque ("statis.dat"), "r+b")) == NULL) { if (err_ouvert (d_disque ("statis.dat"))) cree_stat (); else fbb_error (ERR_CREATE, d_disque ("statis.dat"), 0); } else break; } return (fptr); } FILE *ouvre_sat (void) { FILE *fptr; while (TRUE) { if ((fptr = fbb_fopen (d_disque ("sat\\satel.dat"), "r+b")) == NULL) { if (err_ouvert (d_disque ("sat\\satel.dat"))) cree_sat (); else fbb_error (ERR_CREATE, d_disque ("sat\\satel.dat"), 0); } else break; } return (fptr); } int compress_mess (bullist * pbul) { FILE *fptr; unsigned short crc = 0; char temp[128]; unsigned long textsize = 0L; strcpy (pvoie->sr_fic, mess_name (MBINDIR, pbul->numero, temp)); if ((fptr = fbb_fopen (pvoie->sr_fic, "rb")) != NULL) { if (fread (&crc, sizeof (crc), 1, fptr) == 0) textsize = 0L; if (fread (&textsize, sizeof (textsize), 1, fptr) == 0) textsize = 0L; fclose (fptr); if (moto) { crc = xendien (crc); textsize = xendienl (textsize); } if (textsize > 1000000L) { cprintf ("%s :\r\nCRC = %04x Size = %ld ... ", pvoie->sr_fic, crc, textsize); cprintf ("Error bin file. Recompressed !\r\n"); sleep_ (2); textsize = 0L; } if (textsize == 0L) { fbb_unlink (pvoie->sr_fic); } } if (textsize == 0L) { dde_huf (voiecur, pbul, ENCODE); #ifdef HUFF_TASK return (0); #else pvoie->ask = 0; return (1); #endif } return (1); } /* #pragma warn -par */ FILE *ouvre_mess (unsigned mode, long nmess, char status) { char strmode[3]; char chaine[256]; FILE *fptr; strmode[0] = 'r'; strmode[1] = (mode == O_BINARY) ? 'b' : 't'; strmode[2] = '\0'; strcpy (pvoie->sr_fic, mess_name ((mode == O_BINARY) ? MBINDIR : MESSDIR, nmess, chaine)); if ((fptr = fbb_fopen (pvoie->sr_fic, strmode)) == NULL) { if ((voiecur != CONSOLE) || (!inexport)) { sprintf (chaine, "\rMessage file %s missing in %s\r", pvoie->sr_fic, mycall); outln (chaine, strlen (chaine)); dde_warning ((mode == O_BINARY) ? W_BIN : W_ASC); } } return (fptr); } /* #pragma warn .par */ FILE *ouvre_dirmes (void) { FILE *fptr; int erreur; while (TRUE) { if ((fptr = fbb_fopen (d_disque ("dirmes.sys"), "r+b")) == NULL) { erreur = errno; if (err_ouvert (d_disque ("dirmes.sys"))) cree_dir (erreur); else fbb_error (ERR_CREATE, d_disque ("DIRMES.SYS"), 0); } else break; } return (fptr); } void ferme (FILE * fptr, int err) { if (fbb_fclose (fptr)) fbb_warning (ERR_CLOSE, "fclose", err); } FILE *ouvre_nomenc () { FILE *fptr; while (TRUE) { if ((fptr = fbb_fopen (d_disque ("inf.sys"), "r+b")) == NULL) { if (err_ouvert (d_disque ("INF.SYS"))) cree_info (); else fbb_error (ERR_CREATE, d_disque ("inf.sys"), 0); } else break; } return (fptr); } char *mess_name (char *path, long numero, char *nom) { unsigned int final; final = (unsigned int) (numero % 10); sprintf (nom, "%smail%u\\m_%06ld.mes", path, final, numero); #ifdef __LINUX__ strcpy (nom, back2slash (nom)); #endif return (nom); } char *temp_name (int voie, char *tempname) { sprintf (tempname, "%stemp.%02d", MBINDIR, voie); #ifdef __LINUX__ strcpy (tempname, back2slash (tempname)); #endif return (tempname); } char *copy_name (int voie, char *tempname) { sprintf (tempname, "%scopy.%02d", MBINDIR, voie); #ifdef __LINUX__ strcpy (tempname, back2slash (tempname)); #endif return (tempname); } char *xfwd_name (int voie, char *tempname) { sprintf (tempname, "%sxfwd.%02d", MBINDIR, voie); #ifdef __LINUX__ strcpy (tempname, back2slash (tempname)); #endif return (tempname); } char *hold_name (long val, char *tempname) { sprintf (tempname, "%s%08lx.hld", MESSDIR, val); #ifdef __LINUX__ strcpy (tempname, back2slash (tempname)); #endif return (tempname); } void del_temp (int voie) { char temp[128]; deb_io (); fbb_unlink (temp_name (voie, temp)); fin_io (); } void del_copy (int voie) { char temp[128]; deb_io (); fbb_unlink (copy_name (voie, temp)); fin_io (); } #define TAIBUF 5000 static char buffer[TAIBUF]; long copy_fic (int fd_orig, int fd_dest, char *lc) { int nb_lus; int ret; long nb_oct = 0L; if (lc) *lc = '\0'; while (1) { nb_lus = fbb_read (fd_orig, buffer, TAIBUF); nb_oct += (long) nb_lus; if (nb_lus > 0) { ret = fbb_write (fd_dest, buffer, nb_lus); if (lc) *lc = buffer[nb_lus - 1]; if (ret == -1) break; } else { break; } } return (nb_oct); } int rename_temp (int voie, char *newname) { int retour; int orig, dest; char temp[128]; deb_io (); temp_name (voie, temp); fbb_unlink (newname); if ((0) && (*newname == *temp)) { retour = rename (temp, newname); } else { retour = 0; orig = fbb_open (temp, O_RDONLY | O_BINARY, 0); if (orig < 0) { fin_io (); return (-1); } dest = fbb_open (newname, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IREAD | S_IWRITE); if (dest < 0) { close (orig); fin_io (); return (-1); } copy_fic (orig, dest, NULL); fbb_close (orig); fbb_close (dest); fbb_unlink (temp); } fin_io (); return (retour); } int hold_temp (int voie, char *tempfile, char *newname, int erase) { int retour = 1; int orig, dest; char header[256]; deb_io (); orig = fbb_open (tempfile, O_RDONLY | O_BINARY, 0); if (orig < 0) { fin_io (); return (-1); } dest = fbb_open (newname, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IREAD | S_IWRITE); if (dest < 0) { close (orig); fin_io (); return (-1); } /* Reserve la place du header dans le fichier destination */ memset (header, 0, sizeof (header)); fbb_write (dest, header, sizeof (header)); /* Copie le fichier temporaire */ copy_fic (orig, dest, NULL); fbb_close (orig); if (*(svoie[voie]->appendf)) { /* Ajoute le fichier d'append s'il existe */ orig = fbb_open (svoie[voie]->appendf, O_RDONLY | O_BINARY, 0); if (orig < 0) { fin_io (); return (-1); } svoie[voie]->entmes.taille += copy_fic (orig, dest, NULL); fbb_close (orig); *(svoie[voie]->appendf) = '\0'; } /* Mise a jour du header */ lseek (dest, 0L, SEEK_SET); fbb_write (dest, &(svoie[voie]->entmes), sizeof (bullist)); fbb_write (dest, svoie[voie]->mess_home, sizeof (svoie[voie]->mess_home)); fbb_close (dest); if (erase) fbb_unlink (tempfile); fin_io (); return (retour); } FILE *fappend (char *filename, char *mode) { FILE *fptr; #if defined(__FBBDOS__) || defined(__WINDOWS__) char fullmode[5]; #ifdef __WIN32__ int c; fullmode[0] = 'r'; fullmode[1] = '+'; fullmode[2] = *mode; fullmode[3] = '\0'; if ((fptr = fbb_fopen (filename, fullmode)) != NULL) { fseek (fptr, -1L, SEEK_END); c = getc (fptr); if (c == CTRL_Z) fseek (fptr, -1L, SEEK_END); else fseek (fptr, 0L, SEEK_END); return (fptr); } else { fullmode[0] = 'w'; fullmode[1] = *mode; fullmode[2] = '\0'; return (fbb_fopen (filename, fullmode)); } #else if ((fptr = fbb_fopen (filename, "r+b")) != NULL) { fseek (fptr, -1L, SEEK_END); c = getc (fptr); if (c == CTRL_Z) fseek (fptr, -1L, SEEK_END); else fseek (fptr, 0L, SEEK_END); if (*mode == 't') { _openfd[fileno (fptr)] &= (~O_BINARY); _openfd[fileno (fptr)] |= O_TEXT; } return (fptr); } else { fullmode[0] = 'w'; fullmode[1] = *mode; fullmode[2] = '\0'; return (fbb_fopen (filename, fullmode)); } #endif #endif #ifdef __LINUX__ if ((fptr = fbb_fopen (back2slash (filename), "r+")) != NULL) { fseek (fptr, 0L, SEEK_END); return (fptr); } else return (fbb_fopen (back2slash (filename), "w")); #endif } int fbb_fcloseall (void) { #ifdef __LINUX__ return 0; #else #if defined(__DPMI16__) || defined(__WINDOWS__) int cnt; cnt = fcloseall (); return (cnt); #else int i; FILE *fp; for (i = 5, fp = _streams + 5, cnt = 0; i < FOPEN_MAX; fp++, i++) { if (fp->fd != 0xff) { if (fclose (fp)) cnt = -9999; else cnt++; } } return (cnt < 0 ? EOF : cnt); #endif /* DPMI16 / WINDWOS */ #endif /* LINUX */ } void fbb_clrscr (void) { #ifdef __FBBDOS__ clrscr (); #endif } /* Returns true if there is more than 1000K available in disks */ int is_room (void) { return ((sys_disk > MIN_DISK) && (tmp_disk > MIN_DISK)); } fbb-7.04j/src/ibm.c0100644000175100017510000001603607726646105012127 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include #include #undef stat void deb_io (void) { static long temps = 0L; long nt = btime (); if (nt > temps) { } } void fin_io (void) { } void randomize (void) { srandom (time (NULL)); } int random_nb (int num) { #ifdef __LINUX__ return (random () % num); #endif #if defined(__FBBDOS__) || defined(__WINDOWS__) return (random (num)); #endif } #undef filelength long filelength (int fd) { struct stat st; int val; val = fstat (fd, &st); if (val == -1) return (-1L); return (st.st_size); } int getdisk (void) { /* Only C: */ return 2; } char *getcurdir (int drive, char *str) { char buffer[82]; getcwd (buffer, 80); strcpy (str, slash2back (buffer)); return str; } int is_cdir (int chr) { if ((chr == '/') || (chr == ':') || (chr == '\\')) return (FALSE); return (isprint (chr)); } int fnsplit (char *name, char *drive, char *rep, char *base, char *ext) { int nb; int mask = 0; char *ptr = NULL; char *scan; if (drive) *drive = '\0'; scan = strrchr (name, '/'); if (rep) { ptr = rep; if (scan) { int sav = *ptr; *ptr = '\0'; strcpy (rep, name); *ptr = sav; } else { *rep = '\0'; } } if (base) { /* BaseName */ ptr = base; if (scan) ++scan; else scan = name; for (nb = 0; nb < FBB_NAMELENGTH; nb++, scan++) { if (!is_cdir (*scan)) break; *ptr++ = *scan; } *ptr = '\0'; } if (ext) { /* Extension */ ptr = ext; /* if ((scan = strrchr (name, '.')) != NULL) { *ptr++ = *scan++; for (nb = 0; nb < 3; nb++, scan++) { if (!is_cdir (*scan)) break; *ptr++ = (islower (*scan)) ? toupper (*scan) : *scan; } }*/ *ptr = '\0'; } return (mask); } int getftime (int fd, struct ftime *ft) { struct stat st; struct tm *tm; int val; val = fstat (fd, &st); if (val == -1) return (-1); tm = gmtime (&st.st_mtime); ft->ft_tsec = tm->tm_sec / 2; ft->ft_min = tm->tm_min; ft->ft_hour = tm->tm_hour; ft->ft_day = tm->tm_mday; ft->ft_month = tm->tm_mon; ft->ft_year = tm->tm_year - 80; return (0); } void format_ffblk (struct ffblk *blk, struct dirent *dir) { int ret; int year; struct stat st; struct tm *tm; char base[10]; char ext[4]; char filename[256]; blk->ff_attrib = 0; if (strcmp (blk->ff_base, "/") == 0) sprintf (filename, "/%s", dir->d_name); else sprintf (filename, "%s/%s", blk->ff_base, dir->d_name); ret = lstat (filename, &st); if (S_ISLNK (st.st_mode)) { /* printf ("link\n"); */ blk->ff_attrib |= FA_LINK; ret = stat (filename, &st); if (S_ISDIR (st.st_mode)) { /* printf ("dir\n"); */ blk->ff_attrib |= FA_DIREC; } } if (S_ISDIR (st.st_mode)) { /* printf ("dir\n"); */ blk->ff_attrib |= FA_DIREC; } if ((st.st_mode & S_IWUSR) == 0) blk->ff_attrib |= FA_RDONLY; blk->ff_fsize = st.st_size; tm = gmtime (&st.st_mtime); blk->ff_ftime = (tm->tm_sec / 2) + (tm->tm_min << 5) + (tm->tm_hour << 11); if ((tm->tm_year > 69) && (tm->tm_year < 80)) year = 80; else year = (tm->tm_year >= 80) ? tm->tm_year - 80 : tm->tm_year + 20; blk->ff_fdate = (tm->tm_mday) + ((tm->tm_mon + 1) << 5) + (year << 9); fnsplit (dir->d_name, NULL, NULL, base, ext); strcpy (blk->ff_name, base); if (*ext) { strcat (blk->ff_name, ext); } } #undef findfirst int findfirst (char *rech, struct ffblk *blk, int mask) { struct dirent *dirent; char *path; /* Deletes X: from MSDOS path */ if ((strlen (rech) > 2) && (rech[1] == ':')) rech += 2; path = back2slash (rech); if (is_dir (path)) { strcpy (blk->ff_mask, "*"); } else { char *ptr = strrchr (path, '/'); if (ptr) { *ptr++ = '\0'; strcpy (blk->ff_mask, ptr); if (*path == '\0') strcpy (path, "/"); } else { strcpy (blk->ff_mask, path); strcpy (path, "."); } } strcpy (blk->ff_base, path); blk->ff_dir = opendir (path); if (blk->ff_dir) { while ((dirent = readdir (blk->ff_dir)) != NULL) { if (*dirent->d_name == '.') continue; if (!strmatch (dirent->d_name, blk->ff_mask)) continue; format_ffblk (blk, dirent); return (0); } closedir (blk->ff_dir); blk->ff_dir = NULL; } return (-1); } #undef findnext int findnext (struct ffblk *blk) { struct dirent *dirent; while ((dirent = readdir (blk->ff_dir)) != NULL) { if (*dirent->d_name == '.') continue; if (!strmatch (dirent->d_name, blk->ff_mask)) continue; format_ffblk (blk, dirent); return (0); } closedir (blk->ff_dir); blk->ff_dir = NULL; return (-1); } unsigned long free_disk (int disk) { struct statfs dfree; unsigned long avail; char *curdisk; char pwd[256]; /* Chercher le disque physique correspondant */ if (disk == 0) { curdisk = getcwd (pwd, sizeof (pwd)); } else { curdisk = PATH[disk - 1]; } if (statfs (curdisk, &dfree) == 0) avail = (unsigned long) dfree.f_bavail * (unsigned long) (dfree.f_bsize / 1024); else avail = 0L; return (avail); } /**************************************************** * Look for an existing filename case independant * matching with the given path/filename * * path is case dependant and MUST match a directory ****************************************************/ char *long_filename(char *path, char *filename) { char fname[256]; char lpath[256]; char *ptr; char *scan; struct dirent *dirent; DIR *dir; strcpy(fname, back2slash(filename)); ptr = fname; if ((*ptr == '/') || (path == NULL)) { strcpy(lpath, "/"); ++ptr; } else { strcpy(lpath, back2slash(path)); long_filename(NULL, lpath); } do { scan = strchr(ptr, '/'); if (scan) *scan = '\0'; dir = opendir (lpath); if (dir) { while ((dirent = readdir (dir)) != NULL) { if (!strcmpi (dirent->d_name, ptr)) { strcpy(ptr, dirent->d_name); if (strcmp(lpath, "/") != 0) strcat(lpath, "/"); strcat(lpath, dirent->d_name); break; } } closedir(dir); if (scan) { *scan = '/'; ptr = scan+1; } } else break; } while (scan); strcpy(filename, slash2back(fname)); return filename; } fbb-7.04j/src/info.c0100644000175100017510000001713507726646105012314 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE INFORMATIONS */ #include #define LGINF 13 #define LGLABEL 31 #define MAXLABEL 258 #define NBINF MAXLABEL-2 static char *read_doc_label (char *); static int open_doc_label (void); static int selecte (int); static int trie_docs (void); static void affich_docs (void); static void close_doc_label (void); static void docs (void); static void retour_doc (void); static void retour_docs (void); static void send_doc (char *); static void write_doc_label (void); typedef struct { char dir; char nom[LGINF]; } inf; typedef struct { char nom[LGINF]; char label[LGLABEL]; } doc_label; static inf *ptete; static doc_label *label_ptr; static unsigned nb_label; static void docs (void) { limite_commande (); switch (toupper (*indd)) { case 'R': retour_docs (); retour_doc (); break; case 'F': retour_menu (N_MENU); break; case 'B': maj_niv (N_MENU, 0, 0); sortie (); break; case 'L': case 'W': affich_docs (); retour_doc (); /* retour_menu(N_MENU); */ break; case 'D': if (droits (MODLABEL)) { write_doc_label (); retour_doc (); } else cmd_err (indd); break; default: if (!defaut ()) { if (isdigit (*indd)) { if (!selecte (atoi (indd))) retour_doc (); } else { if (ISGRAPH (*indd)) cmd_err (indd); else retour_doc (); /* texte(T_INF+3); retour_doc(); */ } } break; } } static void retour_docs (void) { char *ptr; ptr = strrchr (pvoie->ch_temp, '\\'); if (ptr == NULL) *pvoie->ch_temp = '\0'; else *ptr = '\0'; } static int selecte (int numero) { char s[80]; inf *pdoc; int fic = 0; int nb = trie_docs (); --numero; if ((numero >= 0) && (numero < nb)) { pdoc = ptete + numero; if (pdoc->dir == 'D') { strcat (pvoie->ch_temp, "\\"); strcat (pvoie->ch_temp, pdoc->nom); } else { sprintf (s, "%s%s\\%s", DOCSDIR, pvoie->ch_temp, pdoc->nom); fic = 1; } } else { texte (T_INF + 3); } m_libere (ptete, sizeof (inf) * NBINF); if (fic) { ch_niv2 (1); send_doc (s); } return (fic); } static int trie_docs (void) { char localdir[MAXLABEL]; int fin, nbinf = 0; inf *pdoc; struct ffblk dirblk; pdoc = ptete = (inf *) m_alloue (sizeof (inf) * NBINF); sprintf (localdir, "%s%s\\*.*", DOCSDIR, pvoie->ch_temp); fin = findfirst (localdir, &dirblk, FA_DIREC); while (!fin) { if ((*dirblk.ff_name != '.') && (strcmp (dirblk.ff_name, "@@.LBL"))) { strcpy (pdoc->nom, dirblk.ff_name); pdoc->dir = (dirblk.ff_attrib & FA_DIREC) ? 'D' : 'F'; ++pdoc; ++nbinf; } if (nbinf == NBINF) break; fin = findnext (&dirblk); } if (nbinf) qsort ((void *) ptete, nbinf, sizeof (inf), (int (*)(const void *, const void *)) strcmp); return (nbinf); } static void affich_docs (void) { int pos, i, nbinf, dir = 1, dde_cr = 0; inf *pdoc; char s[80]; char *ptr, *sptr; nbinf = trie_docs (); pdoc = ptete; i = 1; pos = 0; while (nbinf--) { if (pdoc->dir == 'F') { if (dir) { if (open_doc_label ()) { if (pos != 0) cr (); cr (); dir = 0; pos = 0; } /*else break; */ } ptr = read_doc_label (pdoc->nom); if (droits (MODLABEL)) { if (ptr) { sprintf (s, "%2d:%-12s %-24s", i, pdoc->nom, ptr); } else { sprintf (s, "%2d:%-36s", i, pdoc->nom); } dde_cr = 1; } else { if (ptr) { sprintf (s, "%2d:%-32s", i, ptr); dde_cr = (++pos == 2); } else *s = '\0'; } } else { sptr = pdoc->nom; while (*sptr) { if (*sptr == '_') *sptr = ' '; ++sptr; } if ((sptr = strchr (pdoc->nom, '.')) != NULL) { while ((*sptr = *(sptr + 1)) != '\0') ++sptr; } sprintf (s, "%2d:%-12s", i, pdoc->nom); dde_cr = (++pos == 5); } out (s, strlen (s)); if (dde_cr) { cr (); pos = 0; dde_cr = 0; } ++pdoc; ++i; } if (pos != 0) cr (); cr (); if (dir == 0) close_doc_label (); m_libere (ptete, sizeof (inf) * NBINF); } static int open_doc_label (void) { int fd; doc_label *plabel; char nom_label[MAXLABEL]; nb_label = 0; sprintf (nom_label, "%s%s\\@@.LBL", DOCSDIR, pvoie->ch_temp); if ((fd = open (nom_label, O_RDONLY | O_BINARY)) != -1) { nb_label = (unsigned) (filelength (fd) / sizeof (doc_label)); if (nb_label == 0) return (0); plabel = label_ptr = (doc_label *) m_alloue (nb_label * sizeof (doc_label)); while (read (fd, plabel, sizeof (doc_label))) ++plabel; close (fd); return (1); } else return (0); } static void write_doc_label (void) { int i, nb, fd; char *ptr; doc_label label, tmp_label; char nom_label[MAXLABEL]; incindd (); nb = 0; if ((ptr = strtok (indd, " \r")) == NULL) { texte (T_ERR + 20); return; } ++nb; strn_cpy (LGINF - 1, tmp_label.nom, ptr); sprintf (nom_label, "%s%s\\%s", DOCSDIR, pvoie->ch_temp, tmp_label.nom); if (access (nom_label, 0) != 0) { strcpy (pvoie->appendf, tmp_label.nom); texte (T_ERR + 11); return; } if ((ptr = strtok (NULL, "\r")) != NULL) { ++nb; n_cpy (LGLABEL - 1, tmp_label.label, ptr); } if (nb == 2) { sprintf (nom_label, "%s%s\\@@.LBL", DOCSDIR, pvoie->ch_temp); if ((fd = open (nom_label, O_CREAT | O_RDWR | O_BINARY, S_IREAD | S_IWRITE)) != -1) { i = 0; while (read (fd, &label, sizeof (doc_label))) { if (strcmp (label.nom, tmp_label.nom) == 0) break; ++i; } lseek (fd, (long) i * sizeof (doc_label), 0); write (fd, &tmp_label, sizeof (doc_label)); close (fd); } } else texte (T_ERR + 0); } static void close_doc_label (void) { if (nb_label) m_libere (label_ptr, nb_label * sizeof (doc_label)); } static char *read_doc_label (char *nom) { int i; doc_label *plabel = label_ptr; for (i = 0; i < nb_label; i++, plabel++) { if (strcmp (plabel->nom, nom) == 0) return (plabel->label); } return (NULL); } static void send_doc (char *doc) { switch (pvoie->niv3) { case 0: strcpy (pvoie->sr_fic, doc); pvoie->enrcur = 0L; if (senddata (0)) retour_doc (); else ch_niv3 (1); break; case 1: if (senddata (0)) retour_doc (); break; } } void doc_path (void) { char *ptr; char *p; var_cpy (0, pvoie->ch_temp); ptr = varx[0]; while (*ptr) { /* if (*ptr == '\\') *ptr = '|'; else */ if (*ptr == '_') *ptr = ' '; else if (*ptr == '.') { p = ptr; while ((*p = *(p + 1)) != '\0') ++p; } ++ptr; } } void retour_doc (void) { doc_path (); retour_menu (N_INFO); } void documentations (void) { switch (pvoie->niv2) { case 0: docs (); break; case 1: send_doc (NULL); break; } } fbb-7.04j/src/init.c0100644000175100017510000004546307726646105012331 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * INIT.C * */ #include "serv.h" static void aff_heure (void); static void cree_tpstat (void); static int init_dir (void); static void init_tpstat (void); static void initarbre (void); static void initmessage (void); static void start_bbs (void); #ifdef __MSDOS__ static void init_bufscreen (Screen *); static void val_screen (void); #endif extern char _video[]; #ifdef __MSDOS__ void initialisations (void) { int bbs_init = 1; while (!step_initialisations (bbs_init)) ++bbs_init; } #endif int step_initialisations (int niveau) { int i; #ifdef __WINDOWS__ unsigned long dMem; #endif InitText (""); switch (niveau) { case 1: { /* Check endian */ long val = 1; moto = (*((char *)(&val)) == '\0'); } debug_ptr = NULL; operationnel = -1; h_ok = 1; MAXTACHE = MAXTASK; init_semaine (); #ifdef __WINDOWS__ /* Allocation du buffer partage ... */ dMem = GlobalDosAlloc (400ul); if (dMem == 0ul) { cprintf ("Can't allocate shared buffer\r\n"); exit (1); } BufSeg = HIWORD (dMem); BufSel = LOWORD (dMem); BufReel = (char far *) ((unsigned long) BufSel << 16); #endif sed = 1; EditorOff = TRUE; editor_request = 0; errno = 0; fast_fwd = 1; lastaff = -1; reply = 0; snd_io = 0; test_message = 2; h_screen = 25; bid_ptr = NULL; log_ptr = NULL; throute = NULL; tbroute = NULL; p_port = NULL; def_cur.nbmess = def_cur.nbnew = 0; def_cur.coord = 0xffff; memcpy (def_cur.indic, "NULL", 5); test_fichiers = 0; #ifdef __MSDOS__ ton_bip = 0; kam_timer = 0; #endif vlang = -1; time_bcl = 0; blank = 0; nb_hold = 0; ok_aff = 1; aut_ui = 1; doubl = 0; v_aff = -1; console = 0; editor = 0; cmd_fct = 0; print = 0; def_mask = 0; t_tell = -1; v_tell = 0; ch_fen = 0; inexport = 0; nb_error = 0; temp_sec = SECONDE; d_blanc = 0; include_size = p_forward = 0; time_include = NULL; t_appel = t_bbs = mem_alloue = 0L; hour_time = -1; t_iliste.suiv = NULL; tete_fwd = NULL; tete_serv = NULL; tete_pg = NULL; bbs_ptr = NULL; p_port = NULL; *t_iliste.indic = '\0'; p_iliste = &t_iliste; NBVOIES = 1; for (i = 0; i < NBLIG; i++) af_voie[i] = -1; #ifdef __FBBDOS__ #ifdef ENGLISH cprintf ("Reading INIT.SRV\r\n"); #else cprintf ("Lecture INIT.SRV\r\n"); #endif #endif init_voie (CONSOLE); /* Init console */ voiecur = CONSOLE; pvoie = svoie[voiecur]; if (!init_admin ()) return (0); if (!init_dir ()) return (0); port_log (0, 0, 'S', "I *** BBS Initialize"); deb_io (); operationnel = 0; window_connect (ALLCHAN); window_connect (CONSOLE); window_connect (MMONITOR); free_mem (); return 0; case 2: init_exms (); initexte (); aff_date (); free_mem (); ferme(ouvre_sat(), 0); return 0; case 3: init_tpstat (); free_mem (); #ifdef ENGLISH cprintf ("RS232 ports set-up \r\n"); #else cprintf ("Initialisation des ports RS232\r\n"); #endif init_watchdog (watchport); initport (); return 0; case 4: initcom (); #ifdef ENGLISH cprintf ("TNC set-up \r\n"); #else cprintf ("Initialisation des TNC\r\n"); #endif inittnc (); return 0; case 5: affich_serveurs (2); affich_pg (2); t_label(); free_mem (); return 0; case 6: #ifdef ENGLISH cprintf ("BID set-up \r\n"); #else cprintf ("Initialisation des BID\r\n"); #endif cree_bid (); free_mem (); return 0; case 7: initarbre (); free_mem (); return 0; case 8: /* epure_messages() ; */ load_dirmes (); initmessage (); return 0; case 9: if (!init_white_pages ()) cree_routes (); else h_ok = 0; free_mem (); #ifdef ENGLISH cprintf ("Files set-up complete \r\n"); #else cprintf ("Fin des initialisations Fichiers\r\n"); #endif return 0; case 10: fwd_file = NULL; fwd_size = 0; #ifdef ENGLISH cprintf ("FORWARD set-up \r\n"); #else cprintf ("Initialisation du forward\r\n"); #endif init_buf_fwd (); init_buf_swap (); init_buf_rej (); return 0; case 11: init_bbs (); init_part (); free_mem (); read_heard (); init_etat (); tst_appel (); return 0; case 12: init_hold (); init_pfh(); load_themes (); #ifdef ENGLISH cprintf ("Set-up complete \r\n"); #else cprintf ("Fin des initialisations\r\n"); #endif vlang = 0; com_error = old_com_error = 0; aff_ind_console (); free_mem (); aff_heure (); fin_io (); canaff = v_aff; winlig = h_screen - 1 - M_LIG; #ifdef TRACE open_trace (); #endif if (*BBS_UP) { char *pptr = BBS_UP; #ifdef __LINUX__ call_nbdos (&pptr, 1, NO_REPORT_MODE, NULL, TOOLDIR, NULL); #else call_nbdos (&pptr, 1, NO_REPORT_MODE, NULL, NULL, NULL); #endif } start_bbs (); return 1; } return 1; } static void start_bbs (void) { int port = 1; char buffer[300]; int nb; df ("io", 0); deb_io (); voiecur = 1; type_sortie = 1; save_fic = 0; aff_date (); operationnel = 1; env_date (); for (port = 1; port < NBPORT; port++) { if (p_port[port].pvalid) { switch (p_port[port].typort) { case TYP_DED: sprintf (buffer, "H 18"); tnc_commande (port, buffer, PORTCMD); sprintf (buffer, "H 1"); tnc_commande (port, buffer, PORTCMD); sprintf (buffer, "H 2"); tnc_commande (port, buffer, PORTCMD); /* Ajouter la validation des ports */ break; case TYP_PK: break; } } } for (nb = 1; nb < NBVOIES; nb++) { programm_indic (nb); set_bs(nb, TRUE); } test_disque (); port_log (0, 0, 'S', "A *** BBS Online"); fin_io (); start_tasks (); mem_alloue = 0L; free_mem (); dde_wp_serv = 1; /* Ammorce les TNCs en mode DED */ for (nb = 0; nb < NBPORT; nb++) { int i; /* positionnel le mult_sel au 1er multi dans chaque COM */ for (i = 0; i < 8; i++) { if (p_com[nb].multi[i]) { int port = p_com[nb].multi[i]; p_com[nb].mult_sel = port; break; } } } ff (); } static int dir_found (char *dir) { int nb; char path[256]; char str[256]; strcpy (path, dir); nb = strlen (path); if ((nb > 1) && (path[1] == ':')) { if ((nb > 3) && (path[nb - 1] == '\\')) path[nb - 1] = '\0'; } else { if ((nb > 1) && (path[nb - 1] == '\\')) path[nb - 1] = '\0'; } if (!is_dir (path)) { sprintf (str, "Directory %s not found", back2slash (path)); ShowError ("FBB TREE", str, 0); fbb_quit (0); WinSleep (10); return (0); } return (1); } static int init_dir (void) { /* Cree l'arbre des repertoires */ int i; char dir[128]; /* Arborescence MAIL */ if (!dir_found (MESSDIR)) return (0); for (i = 0; i < 10; i++) { sprintf (dir, "%smail%d", MESSDIR, i); if (!dir_found (dir)) return (0); } /* Arborescence BINMAIL */ if (!dir_found (MBINDIR)) return (0); for (i = 0; i < 10; i++) { sprintf (dir, "%smail%d", MBINDIR, i); if (!dir_found (dir)) return (0); } /* Repertoire WP */ sprintf (dir, "%swp", DATADIR); if (!dir_found (dir)) return (0); /* Repertoire DOCS */ if (!dir_found (DOCSDIR)) return (0); /* Repertoires DOS */ for (i = 1; i < 8; i++) { if (*PATH[i]) if (!dir_found (PATH[i])) return (0); } /* Repertoire YAPP */ if (!dir_found (YAPPDIR)) return (0); /* Repertoire PG */ /* if (!dir_found (PGDIR)) return (0); */ return (1); } void init_semaine (void) { long temps = time (NULL); struct tm *sdate = localtime (&temps); int ny = sdate->tm_yday; /* Numero du jour dans l'annee */ int nw = sdate->tm_wday; /* Numero du jour dans la semaine */ if (nw == 0) nw = 6; else --nw; /* 0 = dimanche -> 0 = lundi */ if (ny < nw) /* Premiere semaine de l'annee ? */ { temps -= (3600L * 24L * (ny + 1)); sdate = localtime (&temps); ny = sdate->tm_yday; /* Numero du jour de l'annee precedente */ nw = sdate->tm_wday; /* Numero du jour de la semaine avant */ if (nw == 0) nw = 6; else --nw; /* 0 = dimanche -> 0 = lundi */ } num_semaine = (7 - nw + ny) / 7; } void start_tasks (void) { trait_time = 0; #ifdef ENGLISH cprintf ("Starting multitasking ..."); #else cprintf ("Dmarre le multitches..."); #endif #ifdef __MSDOS__ init_keyboard (); #endif cprintf (" ok\r\n"); } void end_voies (void) { int i; /* Inclut la voie Warnings (NBVOIES+1) */ for (i = 0; i < NBVOIES + 1; i++) { if (svoie[i]) m_libere (svoie[i], sizeof (Svoie)); } } void init_voie (int voie) { int i; Svoie *vptr; svoie[voie] = vptr = (Svoie *) m_alloue (sizeof (Svoie)); time_yapp[voie] = -1; init_timout (voie); vptr->msg_held = 0; vptr->rzsz_pid = -1; vptr->temp1 = vptr->mess_recu = 1; vptr->fbb = bin_fwd; vptr->timout = time_n; /* vptr->wp = */ vptr->clock = '\0'; vptr->ret = 0; vptr->sid = vptr->aut_nc = vptr->ind_mess = vptr->warning = 0; vptr->ask = vptr->seq = vptr->dde_int = vptr->stop = 0; vptr->mbl = vptr->sta.stat = vptr->sta.connect = vptr->deconnect = 0; vptr->sta.mem = 32000; vptr->sr_mem = vptr->memoc = vptr->nb_err = 0; vptr->niv1 = vptr->niv2 = vptr->niv3 = 0; vptr->maj_ok = vptr->conf = vptr->dde_marche = 0; vptr->groupe = vptr->kiss = vptr->ch_mon = vptr->cross_connect = -1; vptr->cur_bull = -1L; vptr->localmode = vptr->binary = vptr->sta.ret = vptr->sta.ack = 0; vptr->type_yapp = 0; vptr->maxbuf = 8; vptr->emis = NULL; vptr->ctnc = NULL; vptr->outptr = NULL; vptr->msgtete = NULL; vptr->l_mess = vptr->l_yapp = vptr->entmes.numero = 0L; vptr->inbuf.nblig = vptr->inbuf.nbcar = vptr->inbuf.nocar = 0; vptr->inbuf.tete = NULL; vptr->inbuf.curr = NULL; vptr->inbuf.ptr = NULL; vptr->curfwd = NULL; vptr->t_read = NULL; vptr->t_list = NULL; vptr->llabel = NULL; vptr->r_tete = NULL; vptr->ncur = &def_cur; vptr->mbl_ext = 1; vptr->nb_egal = 0; vptr->nb_prompt = 0; vptr->prot_fwd = prot_fwd; vptr->tete_edit.liste = NULL; vptr->entmes.bid[0] = '\0'; vptr->sta.callsign.call[0] = '\0'; vptr->sta.callsign.num = 0; vptr->sta.indicatif.call[0] = '\0'; vptr->sta.indicatif.num = 0; for (i = 0; i < 8; i++) { vptr->sta.relais[i].call[0] = '\0'; vptr->sta.relais[i].num = 0; } init_fb_mess (voie); } static void aff_heure (void) { struct tm *sdate; long temps = time (NULL); sdate = gmtime (&temps); cprintf ("GMT %02d:%02d", sdate->tm_hour, sdate->tm_min); sdate = localtime (&temps); cprintf (" - LOCAL %02d:%02d\r\n", sdate->tm_hour, sdate->tm_min); } void lit_appel (void) { FILE *fptr; sed = 1; fptr = fopen (d_disque ("OPTIONS.SYS"), "rb"); if (fptr) { fread (&bip, sizeof (short), 1, fptr); fread (&ok_tell, sizeof (short), 1, fptr); fread (&ok_aff, sizeof (short), 1, fptr); fread (&separe, sizeof (short), 1, fptr); fread (&doub_fen, sizeof (short), 1, fptr); fread (&gate, sizeof (short), 1, fptr); fread (&just, sizeof (short), 1, fptr); fread (&p_forward, sizeof (short), 1, fptr); fread (&sed, sizeof (short), 1, fptr); fread (&aff_inexport, sizeof (short), 1, fptr); fread (&aff_popsmtp, sizeof (short), 1, fptr); fclose (fptr); } if (separe < M_LIG + 5) separe = M_LIG + 5; if (separe > h_screen - 4) separe = h_screen - 4; /* printf("%d %d %d %d %d\n", bip, ok_tell, ok_aff, separe, doub_fen) ; */ #if defined(__WINDOWS__) || defined(__LINUX__) maj_menu_options (); #endif } void cree_dir (int erreur) { bullist lbul; FILE *fptr; if ((fptr = fopen (d_disque ("DIRMES.SYS"), "wb")) == NULL) { fbb_error (ERR_CREATE, d_disque ("DIRMES.SYS"), erreur); } lbul.type = '\0'; lbul.numero = 100L; fwrite (&lbul, sizeof (bullist), 1, fptr); fclose (fptr); } void cree_info (void) { FILE *fptr; if ((fptr = fopen (d_disque ("INF.SYS"), "wb")) == NULL) { fbb_error (ERR_CREATE, d_disque ("INF.SYS"), 0); } fclose (fptr); } void cree_stat (void) { FILE *fptr; if ((fptr = fopen (d_disque ("statis.dat"), "wb")) == NULL) { fbb_error (ERR_CREATE, d_disque ("statis.dat"), 0); } fclose (fptr); } void cree_sat (void) { FILE *fptr; if ((fptr = fopen (d_disque ("SAT\\SATEL.DAT"), "wb")) == NULL) { fbb_error (ERR_CREATE, d_disque ("SAT\\SATEL.DAT"), 0); } fclose (fptr); } static void cree_tpstat (void) { int i; FILE *fichier; if ((fichier = fopen (d_disque ("TPSTAT.SYS"), "wb")) == NULL) { fbb_error (ERR_CREATE, d_disque ("TPSTAT.SYS"), 0); } for (i = 0; i < NBRUB; i++) stemps[i] = 0L; fwrite ((char *) stemps, sizeof (*stemps) * NBRUB, 1, fichier); fclose (fichier); } int err_ouvert (char *nomfic) { int c; char s[80]; deb_io (); #ifdef ENGLISH cprintf ("Cannot open %s \r\n", nomfic); #else cprintf ("Erreur ouverture %s\r\n", nomfic); #endif c = 0; #ifdef ENGLISH sprintf (s, "Creating file %s ", nomfic); #else sprintf (s, "Creation du fichier %s", nomfic); #endif if (sel_option (s, &c)) { #ifdef ENGLISH cprintf ("\rCreating file %s \r\n", nomfic); #else cprintf ("\rCreation du fichier %s\r\n", nomfic); #endif } fin_io (); return (c); } static void init_tpstat (void) { FILE *fichier; fichier = ouvre_stats (); fclose (fichier); while (TRUE) { if ((fichier = fopen (d_disque ("TPSTAT.SYS"), "r+b")) == NULL) { if (err_ouvert ("TPSTAT.SYS")) cree_tpstat (); else fbb_error (ERR_CREATE, d_disque ("TPSTAT.SYS"), 0); } else break; } fread ((char *) stemps, sizeof (*stemps) * NBRUB, 1, fichier); fclose (fichier); } static void initarbre (void) { int offset; int i = 0; info buf2; char buf[40]; FILE *fptr; bloc_indic *bptr; #ifdef ENGLISH cprintf ("Callsign set-up \r\n"); #else cprintf ("Initialisation de la nomenclature\r\n"); #endif deb_io (); #ifdef ENGLISH cprintf ("Callsigns set-up \r\n"); #else cprintf ("Initialisation des indicatifs\r\n"); #endif rinfo = 0; racine = bptr = new_bloc_info (); offset = 0; strcpy (bptr->st_ind[0].indic, "TOUS"); bptr->st_ind[0].nbmess = (short) 0; bptr->st_ind[0].nbnew = (short) 0; bptr->st_ind[0].coord = 0xffff; ++offset; fptr = ouvre_nomenc (); *buf2.indic.call = '\0'; while (fread ((char *) &buf2, (int) sizeof (buf2), 1, fptr)) { if (find (buf2.indic.call)) { if (offset == T_BLOC_INFO) { bptr->suiv = new_bloc_info (); bptr = bptr->suiv; offset = 0; } #ifdef __LINUX__ if ((i++ % 50) == 0) { InitText (itoa (i, buf, 10)); } #endif #ifdef __WINDOWS__ if ((i++ % 50) == 0) { InitText (itoa (i, buf, 10)); } #endif #ifdef __MSDOS__ if (tempo == 0) { cprintf ("%-6s\r", buf2.indic.call); tempo = CADENCE; } #endif inscoord (rinfo, &buf2, &(bptr->st_ind[offset])); ++offset; } ++rinfo; } #ifdef __WINDOWS__ InitText (itoa (i, buf, 10)); #else cprintf ("%-6s\r", buf2.indic.call); #endif ferme (fptr, 4); fin_io (); } void fwd_cpy (recfwd * dest, bullist * orig) { int i; dest->type = orig->type; dest->bin = orig->bin; dest->kb = (unsigned char) ((orig->taille + 500) / 1000); dest->date = orig->date; dest->nomess = orig->numero; for (i = 0; i < NBMASK; i++) dest->fbbs[i] = orig->fbbs[i]; strncpy (dest->bbsv, bbs_via (orig->bbsv), 6); } lfwd *cree_bloc_fwd (lfwd * ptr) { int i; if (ptr) { ptr->suite = (lfwd *) m_alloue (sizeof (lfwd)); ptr = ptr->suite; } else ptr = (lfwd *) m_alloue (sizeof (lfwd)); ptr->suite = NULL; for (i = 0; i < NBFWD; i++) ptr->fwd[i].type = '\0'; return (ptr); } int fwd_mask (char *masque) { int i; for (i = 0; i < NBMASK; i++) if (*masque++) return (1); return (0); } bloc_mess *new_bloc_mess (void) { int i; bloc_mess *bptr = (bloc_mess *) m_alloue (sizeof (bloc_mess)); bptr->suiv = NULL; for (i = 0; i < T_BLOC_MESS; i++) { bptr->st_mess[i].noenr = 0; bptr->st_mess[i].nmess = 0L; bptr->st_mess[i].no_indic = 0; } return (bptr); } void end_messages (void) { bloc_mess *bptr; lfwd *ptr_fwd; /* Libere la liste des forwards */ while (tete_fwd) { ptr_fwd = tete_fwd; tete_fwd = tete_fwd->suite; m_libere (ptr_fwd, sizeof (lfwd)); } /* Libere la liste des messages */ while (tete_dir) { bptr = tete_dir; tete_dir = tete_dir->suiv; m_libere (bptr, sizeof (bloc_mess)); } } static void initmessage (void) { char buf[40]; bloc_mess *bptr; unsigned no_indic; unsigned offset = 0; bullist bufdir; unsigned rmess = 0; char stat; int pos, nbfwd; int i = 0; lfwd *ptr_fwd; pos = nbfwd = 0; ptr_fwd = tete_fwd = cree_bloc_fwd (NULL); #ifdef ENGLISH cprintf ("Message set-up \r\n"); #else cprintf ("Initialisation des messages\r\n"); #endif deb_io (); nbmess = 0; ouvre_dir (); read_dir (rmess++, &bufdir); nomess = bufdir.numero; #ifdef ENGLISH cprintf ("Next message %ld \r\n", nomess + 1); #else cprintf ("Prochain message %ld\r\n", nomess + 1); #endif bptr = tete_dir = new_bloc_mess (); while (read_dir (rmess, &bufdir)) { if (bufdir.type) { #ifdef __LINUX__ if ((i++ % 50) == 0) { InitText (itoa (i, buf, 10)); } #endif #ifdef __WINDOWS__ if ((i++ % 50) == 0) { InitText (itoa (i, buf, 10)); } #endif #ifdef __MSDOS__ if (tempo == 0) { cprintf ("%ld %-6s %d\r", bufdir.numero, bufdir.exped, nbfwd); tempo = CADENCE; } #endif if (offset == T_BLOC_MESS) { bptr->suiv = new_bloc_mess (); bptr = bptr->suiv; offset = 0; } no_indic = insarbre (&bufdir); bptr->st_mess[offset].nmess = bufdir.numero; bptr->st_mess[offset].noenr = rmess; bptr->st_mess[offset].no_indic = no_indic; stat = bufdir.status; if ((stat != 'A') && (stat != 'K')) { ++nbmess; if ((stat != 'F') && (stat != 'X') && (stat != 'H')) { if ((bufdir.numero) && (fwd_mask (bufdir.fbbs))) { if (pos == NBFWD) { pos = 0; ptr_fwd = cree_bloc_fwd (ptr_fwd); } fwd_cpy (&ptr_fwd->fwd[pos], &bufdir); ++pos; ++nbfwd; } } else if (stat == 'H') ++nb_hold; } ins_iliste (&bufdir); ++offset; } ++rmess; } #ifdef __WINDOWS__ InitText (itoa (i, buf, 10)); #else if (bufdir.type) { cprintf ("%ld %-6s %d\r", bufdir.numero, bufdir.exped, nbfwd); } #endif ferme_dir (); fin_io (); #ifdef ENGLISH cprintf ("End - %d forward(s)\r\n", nbfwd); #else cprintf ("Fin - %d forward(s)\r\n", nbfwd); #endif } fbb-7.04j/src/init_srv.c0100644000175100017510000003304107726646105013210 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include static int no_init_error = 1; void err_init (int lig) { no_init_error = 0; #if defined(__WINDOWS__) || defined(__LINUX__) ShowError ("INIT.SRV", "Error line", lig); fbb_quit (0); #endif #ifdef __FBBDOS__ #ifdef ENGLISH cprintf ("Error file INIT.SRV line %d \r\n\a", lig); #else cprintf ("Erreur fichier INIT.SRV ligne %d\r\n\a", lig); #endif curon (); sleep (10); exit (0); #endif } static char *test_back_slash (char *chaine, int nolig) { static char temp[256]; strcpy(temp, chaine); #ifdef __LINUX__ if (temp[strlen (temp) - 1] != '/') strcat(temp, "/"); /* err_init (nolig); */ #else if (temp[strlen (temp) - 1] != '\\') err_init (nolig); #endif return (temp); } void end_admin (void) { Msysop *sptr; while (mess_sysop) { sptr = mess_sysop; mess_sysop = mess_sysop->next; m_libere (sptr, sizeof (Msysop)); } libere_serveurs (); } #define FIELDS 0x301f /* Mask of the mandatory fields */ static char *inistr[] = { "vers", /* 0 */ "call", /* 1 */ "ssid", /* 2 */ "qral", /* 3 */ "city", /* 4 */ "conf", /* 5 */ "data", /* 6 */ "mess", /* 7 */ "comp", /* 8 */ "fbbd", /* 9 */ "yapp", /* 10 */ "docs", /* 11 */ "name", /* 12 */ "syso", /* 13 */ "sysm", /* 14 */ "impo", /* 15 */ "logs", /* 16 */ "test", /* 17 */ "fbbf", /* 18 */ "fbbc", /* 19 */ "aski", /* 20 */ "mask", /* 21 */ "secu", /* 22 */ "warn", /* 23 */ "hous", /* 24 */ "time", /* 25 */ "maxd", /* 26 */ "loca", /* 27 */ "beac", /* 28 */ "scro", /* 29 */ "fwdh", /* 30 */ "maxb", /* 31 */ "life", /* 32 */ "wpca", /* 33 */ "zipc", /* 34 */ "unpr", /* 35 */ "upba", /* 36 */ "dwba", /* 37 */ "pg", /* 38 */ "fdir", /* 39 */ "sdir", /* 40 */ "tdir", /* 41 */ "poph", /* 42 */ NULL }; char *value(char *line, int *key) { static char keystr[5]; char *ptr; int i; while (isspace(*line)) ++line; if (*line == '#' || *line == '\0') { *key = -3; return line; } i = 0; ptr = keystr; while (isgraph(*line)) { if (i++ < 4) { *ptr++ = *line; } ++line; if (*line == '=') break; } *ptr = '\0'; *key = -1; for (i = 0 ; inistr[i] ; i++) { if (strcasecmp(keystr, inistr[i]) == 0) { *key = i; break; } } line = strchr(line, '='); if (line) { ++line; while (isspace(*line)) ++line; } else { *key = -2; } return line; } int init_admin (void) { static int first = 1; int ntemp; char ligne[256]; char stemp[256]; char *ptr = ligne; char *start; char *scan; Msysop *sptr = NULL; int i, j; int key; int val; int ok_init = 0; int fond_haut = 0, fond_milieu = 0, fond_bas = 0, fond_menu = 0; balbul = 0; nb_ovr = 0; /* Default values */ BLK_TO = 0; h_ok = 1; internal_int = 0xff; ems_aut = 1; in_exms = 0; for (j = 0; j < NB_EMS; j++) in_exms |= t_ems[j].flag; FOND_VOIE = 0; DEF = (fond_haut << 4) + 15; STA = (fond_milieu << 4) + 15; INIT = (fond_menu << 4) + 15; SEND = (fond_bas << 4) + 15; RECV = (fond_bas << 4) + 15; HEADER = (fond_bas << 4) + 15; UI = (fond_bas << 4) + 15; CONS = (fond_bas << 4) + 15; INDIC = (fond_bas << 4) + 15; VOIE = (fond_bas << 4) + 15; *mypath = '\0'; myssid = 0; *qra_locator = '\0'; *my_city = '\0'; /* Ne pas reinitialiser */ if (first) { int i; for (i = 0; i < 10; i++) varx[i] = m_alloue (81); for (i = 1; i < NBPORT; i++) t_balise[i] = 900; } if (read_fbb_conf(NULL) > 0) { no_init_error = 0; ShowError ("fbb.conf", "Cannot open file", 0); window_init (); fbb_quit (0); return (0); } #ifdef ENGLISH cprintf ("Parameters set-up \r\n"); #else cprintf ("Initialisation des parametres\r\n"); #endif libere_serveurs (); for (key = 0 ; inistr[key] ; key++) { ptr = find_fbb_conf(inistr[key], 0); if (ptr == NULL) ptr = def_fbb_conf(inistr[key]); if (ptr == NULL) continue; fprintf(stderr, "%4s : %s\n", inistr[key], ptr); switch (key) { case 0: /* Accept all versions !! sprintf (stemp, "FBB%d.%02d", MAJEUR, MINEUR); if (strncasecmp (stemp, ptr, strlen (stemp)) != 0) { #ifdef ENGLISH cprintf ("*** Error : Waiting for fbb.conf version %s \r\n", stemp); #else cprintf ("*** Erreur : Version de fbb.conf attendue %s\r\n", stemp); #endif err_init (0); } */ ok_init |= (1 << key); break; case 1: strn_cpy (39, mypath, ptr); if ((j = strlen (mypath)) && (mypath[j - 1] == '.')) mypath[j - 1] = '\0'; ok_init |= (1 << key); break; case 2: myssid = (char) atoi (ptr); ok_init |= (1 << key); break; case 3: strn_cpy (6, qra_locator, ptr); ok_init |= (1 << key); break; case 4: n_cpy (19, my_city, ptr); ok_init |= (1 << key); break; case 5: n_cpy (80, CONFDIR, test_back_slash (ptr, 0)); break; case 6: n_cpy (80, DATADIR, test_back_slash (ptr, 0)); break; case 7: n_cpy (80, MESSDIR, test_back_slash (ptr, 0)); break; case 8: n_cpy (80, MBINDIR, test_back_slash (ptr, 0)); break; case 9: for (j = 0; j < 8; j++) { *PATH[j] = '\0'; } printf("fbbd : <%s>\n", ptr); scan = strtok (ptr, " ,\t"); for (j = 0; j < 8; j++) { printf("%d : {%s}\n", j, scan); if (scan == NULL) break; if (*scan != '*') { n_cpy (80, PATH[j] + 2, slash2back (test_back_slash (scan, 0))); PATH[j][0] = getdisk () + 'A'; PATH[j][1] = ':'; } scan = strtok (NULL, " ,\t"); printf("%d : {%s}\n", j, PATH[j]); } break; case 10: n_cpy (80, YAPPDIR+2, slash2back (test_back_slash (ptr, 0))); YAPPDIR[0] = getdisk () + 'A'; YAPPDIR[1] = ':'; break; case 11: n_cpy (80, DOCSDIR, test_back_slash (ptr, 0)); ptr = DOCSDIR + strlen (DOCSDIR) - 1; if (*ptr == '\\') *ptr = '\0'; break; case 12: n_cpy (12, my_name, ptr); ok_init |= (1 << key); break; case 13: strn_cpy (6, admin, ptr); ok_init |= (1 << key); break; case 14: scan = strtok (ptr, " ,\t"); /* Delete la liste existante eventuellement */ while (mess_sysop) { sptr = mess_sysop; mess_sysop = mess_sysop->next; m_libere (sptr, sizeof (Msysop)); } if ((scan) && (isalpha (*scan))) { sptr = mess_sysop = (Msysop *) m_alloue (sizeof (Msysop)); strn_cpy (20, sptr->call, scan); } while ((scan = strtok (NULL, " ,\t")) != NULL) { sptr->next = (Msysop *) m_alloue (sizeof (Msysop)); sptr = sptr->next; strn_cpy (20, sptr->call, scan); } break; case 15: n_cpy (80, MAILIN, ptr); n_cpy (76, LOCK_IN, ptr); start = strrchr (LOCK_IN, '/'); if (start == NULL) start = LOCK_IN; scan = strrchr (start, '.'); if (scan) *scan = '\0'; strcat(LOCK_IN, ".lck"); break; case 16: comlog = (toupper (*ptr) == 'O'); break; case 17: DEBUG = (toupper (*ptr) == 'O'); miniserv = 0xffff; watchport = 0; sscanf (ptr, "%*s %d", &watchport); break; case 18: fbb_fwd = (toupper (*ptr) == 'O'); /* 1 : Espace obligatoire avant le @ dans l'adresse 2 : Ne teste pas la limite a 6 des champs de l'adresse 4 : Ne tronque pas le header a l'espace < 79 caracteres 8 : Header MBL/RLI 16 : Si pas de champ BBS envoie l'indicatif de ma BBS (->PMS) 32 : Supprime les messages data au SYSOP 64 : N'utilise pas le BID cree a partir des headers si pas de BID 128: N'accepte le forward que des BBS declarees. 256: Les messages WP ne sont pas HOLD 512: XWFD has priority on FBB 1024: Alternate BID generation 2048: XFWD with checksum 4096: Simple check for callsigns (3 to 6 chars, 1 digit, 1 alpha). */ std_header = 0; sscanf (ptr, "%*s %d", &std_header); break; case 19: /* 1 : Protocole de niveau 1 */ bin_fwd = (toupper (*ptr) == 'O'); /* 1 : Binaire FBB version 1 2 : Binaire RLI */ ntemp = -1; sscanf (ptr, "%*s %d", &ntemp); if ((bin_fwd) & (ntemp != -1) && (ntemp & 1)) { bin_fwd = 2; } prot_fwd = FWD_MBL; if (fbb_fwd) { prot_fwd |= FWD_FBB; if (bin_fwd) { prot_fwd |= FWD_BIN; if (bin_fwd == 2) prot_fwd |= FWD_BIN1; } } if ((ntemp == -1) || (ntemp & 2)) prot_fwd |= FWD_XPRO; break; case 20: info_ok = (toupper (*ptr) == 'O'); break; case 21: def_mask = (unsigned) atoi (ptr); break; case 22: if (sscanf (ptr, "%u %u %u", &d_droits, &ds_droits, &dss_droits) != 3) err_init (0); break; case 23: w_mask = (unsigned) atoi (ptr); break; case 24: h_maint = atoi (ptr); break; case 25: if (sscanf (ptr, "%d %d", &time_n, &time_b) != 2) err_init (0); time_n *= 60; time_b *= 60; break; case 26: if (sscanf (ptr, "%d %d", &max_yapp, &max_mod) != 2) err_init (0); break; case 27: /* tzone = 3600 * -atol(ptr) ; */ if (getenv ("TZ") == NULL) { /* memset(_tzname[1], 0, 4); strcpy(_tzname[0],"GMT"); _timezone = 3600L * -atol(ptr) ; _daylight = 0; stime */ /* Ne pas liberer... Sinon ca plante a l'appel suivant. */ char *tzl = malloc (20); sprintf (tzl, "TZ=GMT%d", -atoi (ptr)); j = putenv (tzl); } tzset (); break; case 28: if (toupper (*ptr) == 'B') { balbul = 1; do { ++ptr; } while (!ISGRAPH (*ptr)); } max_indic = atoi (ptr); break; case 29: winbuf.totlig = conbuf.totlig = monbuf.totlig = 1500; sscanf (ptr, "%d %d %d", &winbuf.totlig, &conbuf.totlig, &monbuf.totlig); break; case 30: txtfwd[0] = '\0'; n_cpy (51, txtfwd + 1, ptr); if (txtfwd[1]) txtfwd[0] = ' '; break; case 31: maxbbid = atoi (ptr); if (maxbbid < 0) maxbbid = 2000; break; case 32: multi_prive = 0; sscanf (ptr, "%ld %d", &nb_jour_val, &multi_prive); if (nb_jour_val < 1L) nb_jour_val = 1L; break; case 33: strn_cpy (79, wp_line, ptr); break; case 34: n_cpy (8, my_zip, ptr); break; case 35: nb_unproto = 300L; val = 6; mute_unproto = ack_unproto = via_unproto = priv_unproto = 0; sscanf (ptr, "%ld %d %s", &nb_unproto, &val, stemp); scan = strupr (stemp); while (*scan) { switch (*scan) { case 'V': via_unproto = 1; break; case 'P': priv_unproto = 1; break; case 'A': ack_unproto = 1; break; case 'M': mute_unproto = 1; break; } ++scan; } def_time_bcl = (val * 18); break; case 36: n_cpy (79, BBS_UP, ptr); break; case 37: n_cpy (79, BBS_DW, ptr); break; case 38: n_cpy (80, PGDIR, test_back_slash (ptr, 0)); break; case 39: n_cpy (80, FILTDIR, test_back_slash (ptr, 0)); break; case 40: n_cpy (80, SERVDIR, test_back_slash (ptr, 0)); break; case 41: n_cpy (80, TOOLDIR, test_back_slash (ptr, 0)); break; case 42: n_cpy (40, pop_host, ptr); break; } } /* Read services list */ ptr = find_fbb_conf("serv", 0); while (ptr) { init_serveur (ptr, 0); ptr = find_fbb_conf("serv", 1); } free_fbb_conf(); init_serveur ("WP * Request White pages info", 0); init_serveur ("REQCFG * Request configuration ", 0); init_serveur ("REDIST * Bulletin redistribution ", 0); i = 0; ptr = mypath; while (isalnum (*ptr)) { mycall[i] = *ptr++; if (++i == 6) break; } mycall[i] = '\0'; ind_console (1, mycall); strcpy (my_call, cons_call.call); if (first) window_init (); set_win_colors (); first = 0; if (ok_init != FIELDS) { int mask = 1; for (i = 0 ; i < 32 ; i++) { if (((mask << i) & FIELDS) && (((mask << i) & ok_init) == 0)) { #ifdef ENGLISH cprintf ("*** Error : Mandatory field \"%s\" missing in fbb.conf \r\n", inistr[i]); #else cprintf ("*** Erreur : Le champ \"%s\" n'est pas defini dans fbb.conf\r\n", inistr[i]); #endif } } err_init (0); no_init_error = 0; } return (no_init_error); } static void cree_etat (void) { FILE *fichier; if ((fichier = fopen (d_disque ("ETAT.SYS"), "wt")) == NULL) { fbb_error (ERR_CREATE, d_disque ("ETAT.SYS"), 0); } fprintf (fichier, "%-6s-%d\n", mycall, myssid); ind_console (1, mycall); fprintf (fichier, "Mise en service par %s-%d le %s\n", cons_call.call, cons_call.num, strdate (time (NULL))); fclose (fichier); } void init_etat (void) { FILE *fichier; char s[81]; if ((fichier = fopen (d_disque ("ETAT.SYS"), "r+t")) == NULL) { if (err_ouvert ("ETAT.SYS")) { cree_etat (); arret = FALSE; } else fbb_error (ERR_OPEN, d_disque ("ETAT.SYS"), 0); } else { fgets (s, 80, fichier); ind_console (1, sup_ln (s)); if (fgetc (fichier) == 'A') arret = TRUE; else arret = FALSE; fclose (fichier); } } fbb-7.04j/src/init_tnc.c0100644000175100017510000002146007726646105013164 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include int inittnc (void) { FILE *fpinit; char s[80]; int port, port_ok, reset; int d_init; int lig, col, i, ok; int ok_init[NBPORT]; #ifdef ENGLISH cprintf ("TNC ports set-up \r\n"); #else cprintf ("Initialisation des ports TNC\r\n"); #endif #ifdef __WINDOWS__ DisplayResync (port, 0); #endif if (DEBUG) { #if defined(__WINDOWS__) || defined(__LINUX__) InitText ("TEST Mode"); #else cprintf ("Debug valide\r\n"); #endif return (1); } for (port = 1; port < NBPORT; port++) ok_init[port] = -1; deb_io (); col = 10; lig = 2; port_ok = 1; for (port = 1; port < NBPORT; port++) { if (p_port[port].pvalid) { selcanal (port); #ifdef __WINDOWS__ if (ETHER (port)) { init_socket (port); } else #endif #ifdef __LINUX__ /* if (ETHER (port)) */ if ((LINUX (port)) && (p_port[port].typort == TYP_ETH)) { if (!opn_drv (port, p_port[port].nb_voies)) { char str[256]; sprintf (str, "Error init TCP port %d", port); WinMessage (5, str); continue; } } else if ((LINUX (port)) && (p_port[port].typort == TYP_TCP)) { if (!opn_drv (port, p_port[port].nb_voies)) { char str[256]; sprintf (str, "Error init TELNET port %d", port); WinMessage (5, str); continue; } } else if ((LINUX (port)) && (p_port[port].typort == TYP_POP)) { if (!opn_drv (port, p_port[port].nb_voies)) { char str[256]; sprintf (str, "Error init POP port %d", port); WinMessage (5, str); continue; } } else if ((LINUX (port)) && (p_port[port].typort == TYP_SCK)) { if (!opn_drv (port, p_port[port].nb_voies)) { char str[256]; sprintf (str, "Error init LINUX port %d", port); WinMessage (5, str); continue; } } else #endif if (BPQ (port)) { switch (p_port[port].typort) { #if defined(__WINDOWS__) || defined(__FBBDOS__) case TYP_FLX: /* Mode FLEX */ cprintf ("Interface FLEX\r\n"); if (!opn_drv (port, p_port[port].nb_voies)) { char str[256]; sprintf (str, "Error init FLEX port %d", port); WinMessage (5, str); continue; } break; #endif case TYP_DED: sprintf (s, "UR%d", p_port[port].nb_voies); break; case TYP_BPQ: cprintf ("Interface BPQNODE\r\n"); bpq_deconnect = 1; break; } } else { cprintf ("switch\r\n"); switch (p_port[port].typort) { #if defined(__WIN32__) case TYP_FLX: /* Mode FLEX */ cprintf ("Interface FLEX\r\n"); if (!opn_drv (port, p_port[port].nb_voies)) { char str[256]; sprintf (str, "Error init FLEX port %d", port); WinMessage (5, str); continue; } break; #endif case TYP_DED: /* MODE DED */ cprintf ("DED HostMode.\r\n"); d_init = 1; for (i = 1; i < NBPORT; i++) { if (ok_init[i] == p_port[port].ccom) d_init = 0; } if (d_init) { if (DRSI (port)) ok_init[port] = p_port[port].ccom; if (!opn_drv (port, p_port[port].nb_voies)) { char str[256]; sprintf (str, "Error init DED port %d", port); WinMessage (5, str); continue; } } break; case TYP_HST: /* MODE DED */ cprintf ("PTC HostMode.\r\n"); d_init = 1; for (i = 1; i < NBPORT; i++) { if (ok_init[i] == p_port[port].ccom) d_init = 0; } if (d_init) { if (DRSI (port)) ok_init[port] = p_port[port].ccom; if (!opn_drv (port, p_port[port].nb_voies)) { char str[256]; sprintf (str, "Error init PTC-II port %d", port); WinMessage (5, str); continue; } } break; case TYP_PK: /* Mode PK232 */ cprintf ("PK232 HostMode.\r\n"); #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) initcom_windows (p_port[port].ccom, 4096, 4096, CTS | DSR); #endif while (1) { reset = 4; tncstr (port, "*", 0); sleep_ (1); tncstr (port, "\021\030\003", 0); sleep_ (1); tncstr (port, "MO 0\r", 0); tncstr (port, "HOST ON\r", 0); vide (port, 0); tncstr (port, "\001\001OGG\027", 0); sleep_ (1); if (rec_tnc (port) >= 0) break; /* #pragma warn -rch */ vide (port, 0); sleep_ (2); tncstr (port, "\003\003\003", 0); sleep_ (2); tncstr (port, "\033\030RESTART\r", 0); #ifdef ENGLISH cprintf ("Reset sent ... Please wait. \r\n"); #else cprintf ("Reset envoy... Patientez S.V.P.\r\n"); #endif i = 20; ok = 0; while (i--) { if ((ok = (rcv_tnc (port) >= 0)) != 0) break; sleep_ (1); } vide (port, 0); } vide (port, 0); /* Parametres par defaut */ tnc_commande (port, "HPN", PORTCMD); tnc_commande (port, "CETRANS", PORTCMD); tnc_commande (port, "AIN", PORTCMD); tnc_commande (port, "HDN", PORTCMD); tnc_commande (port, "PL0", PORTCMD); tnc_commande (port, "MI0", PORTCMD); sprintf (s, "ML%s-%d", mycall, myssid); tnc_commande (port, s, PORTCMD); sprintf (s, "UR%d", p_port[port].nb_voies); tnc_commande (port, s, PORTCMD); sprintf (s, "MX%d", p_port[port].frame); tnc_commande (port, s, PORTCMD); break; case TYP_MOD: /* Mode MODEM */ cprintf ("MODEM Mode\r\n"); init_modem (port); modem_no_echo (port); break; case TYP_KAM: /* Mode KAM */ #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) initcom_windows (p_port[port].ccom, 4096, 4096, CTS | DSR); #endif cprintf ("Kantronics HostMode\r\n"); /* Parametres par defaut */ tnc_commande (port, "HEADERLN OFF", PORTCMD); tnc_commande (port, "HEADERLN OFF", PORTCMD); tnc_commande (port, "STATSHRT ON", PORTCMD); tnc_commande (port, "PACLEN 0", PORTCMD); sprintf (s, "MY %s-%d", mycall, myssid); tnc_commande (port, s, PORTCMD); if (p_port[port].ccanal == 1) { sprintf (s, "MAXFRAME /%d", p_port[port].frame); } else { sprintf (s, "MAXFRAME %d/", p_port[port].frame); } tnc_commande (port, s, PORTCMD); if (p_port[port].ccanal == 1) sprintf (s, "USERS /%d", p_port[port].nb_voies); else sprintf (s, "USERS %d/", p_port[port].nb_voies); tnc_commande (port, s, PORTCMD); ok_init[port] = p_port[port].ccom; break; case TYP_TCP: /* Mode ETHERNET */ cprintf ("ETHERNET Mode\r\n"); break; #ifdef __WINDOWS__ case TYP_AGW: /* Mode ETHERNET */ if (!opn_drv (port, p_port[port].nb_voies)) { char str[256]; sprintf (str, "Error init AGW port %d", port); WinMessage (5, str); continue; } break; #endif } } /* Programmed parameters */ /* First, try the "port_name.ini" file */ sprintf (s, "%s.prt", p_port[port].freq); fpinit = fopen (c_disque (s), "rb"); /* Then try the "inittnc" file */ if (fpinit == NULL) { sprintf (s, "inittnc%d.sys", port); fpinit = fopen (c_disque (s), "rb"); } if (fpinit) { while (fgets (s, 80, fpinit)) { sup_ln (s); if ((*s) && (*s != '#')) { tnc_commande (port, s, PORTCMD); } } ferme (fpinit, 2); } #if !defined(__WIN32__) && (defined(__FBBDOS__) || defined(__WINDOWS__)) if (p_port[port].typort == TYP_BPQ) { ini_bpq (p_port[port].nb_voies); } #endif #ifdef ENGLISH cprintf ("End TNC set-up \r\n"); #else cprintf ("Initialisation termine\r\n"); #endif sprintf (s, "OK PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); #if defined(__WINDOWS__) || defined(__LINUX__) InitText (s); #endif ++port_ok; lig++; col += 2; } } for (port = port_ok - 1; port > 0; port--) { lig--; col -= 2; } fin_io (); return (1); } fbb-7.04j/src/initfwd.c0100644000175100017510000006246207726646105013030 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Initialisation du buffer forward. */ #include #define NBCAS 3 static int niveau; static int etat_bloc; static int nbif[NBCAS]; static int erreur_cron (int); static int fwd_commande (char *); static int tst_ligne (int); static char *analyse (char *, int *, int *); static void bip_select (char *); static void error_file (char *); static void gate_select (char *); static void init_buf_fwd_ems (void); static void list_select (char *); static void port_select (char *); static void reset_fwd_pointeurs (void); static void talk_select (char *); static void yapp_select (char *); #define MAX_NIVEAU 4 #define REJECT_FILE "REJECT.SYS" typedef struct { FILE *fp; char name[80]; int nolig; } File; static File file[MAX_NIVEAU]; static void error_file (char *str) { char wtexte[256]; deb_io (); #ifdef ENGLISH if (operationnel) { sprintf (wtexte, "\r\nError in file %s line %d : %s\r\n\a", file[niveau].name, file[niveau].nolig, str); if (w_mask & W_FILE) mess_warning (admin, "*** FILE ERROR *** ", wtexte); } sprintf (wtexte, "Error in file %s line %d : %s", file[niveau].name, file[niveau].nolig, str); #else if (operationnel) { sprintf (wtexte, "\r\nErreur fichier %s ligne %d : %s\r\n\a", file[niveau].name, file[niveau].nolig, str); if (w_mask & W_FILE) mess_warning (admin, "*** ERREUR FICHIER ***", wtexte); } sprintf (wtexte, "Erreur fichier %s ligne %d : %s", file[niveau].name, file[niveau].nolig, str); #endif fin_io (); win_message (5, wtexte); } #ifdef __FBBDOS__ static char *forward_sys[2] = {"forw_d.sys", "forward.sys"}; #endif #ifdef __WINDOWS__ static char *forward_sys[2] = {"forw_w.sys", "forward.sys"}; #endif #ifdef __LINUX__ static char *forward_sys[2] = {"forw_l.sys", "forward.sys"}; #endif void test_buf_fwd (void) { int nb_include = 0; int c; int scane = 0; int choix; char com_buf[80]; struct stat st; niveau = 0; memset (file, 0, sizeof (File) * MAX_NIVEAU); file[niveau].nolig = 0; choix = 0; file[niveau].fp = fopen (c_disque (forward_sys[choix]), "rt"); if (file[niveau].fp == NULL) choix = 1; file[niveau].fp = fopen (c_disque (forward_sys[choix]), "rt"); strcpy (file[niveau].name, forward_sys[choix]); reset_fwd_pointeurs (); etat_bloc = nbif[0] = nbif[1] = 0; if (file[niveau].fp) { fstat (fileno (file[niveau].fp), &st); if (time_include[nb_include++] != st.st_mtime) ++scane; do { while (fgets (com_buf, 80, file[niveau].fp)) { ++file[niveau].nolig; sup_ln (com_buf); c = fwd_commande (com_buf); if (c != '<') continue; if (nb_include >= include_size) { ++scane; break; } else { if (++niveau >= MAX_NIVEAU) { --niveau; break; } file[niveau].nolig = 0; strcpy (file[niveau].name, com_buf); if ((file[niveau].fp = fopen (c_disque (file[niveau].name), "rt")) != NULL) { fstat (fileno (file[niveau].fp), &st); if (time_include[nb_include++] != st.st_mtime) ++scane; } else { char str[256]; sprintf (str, "Cannot find include file %s", file[niveau].name); error_file (str); --niveau; break; } } } fclose (file[niveau].fp); } while (niveau--); } if (scane == 0) return; #ifdef __WINDOWS__ scan_fwd (1); #else p_forward = 1; maj_options (); init_buf_fwd (); aff_nbsta (); #endif } static int tst_ligne (int c) { int retour = 0; int c_save = c; char str[256]; #if 1 static unsigned char etat[NBCAS][29] = { {2, 0, 0, 1, 5, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4}, /* Hors bloc */ {0, 1, 1, 1, 5, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 7, 4}, /* Dans bloc */ {0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0} /* Not (!) */ }; #else static unsigned char etat[NBCAS][29] = { {2, 0, 0, 1, 5, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4}, {0, 0, 1, 1, 5, 0, 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 6, 7, 4}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; #endif if (c == '-') c = 26; else if (c == '!') c = 27; else if (c == '@') c = 28; else { if (islower (c)) c -= 'a'; else c -= 'A'; } switch (etat[etat_bloc][c]) { case 0: /* Erreur */ sprintf (str, "Unknown ommand %c", c_save); error_file (str); retour = 1; break; case 1: /* Commande OK */ if (etat_bloc == 2) etat_bloc = 1; break; case 2: /* Debut de bloc */ etat_bloc = 1; nbif[1] = 0; break; case 3: /* IF */ nbif[(etat_bloc > 0) ? 1 : 0]++; break; case 4: /* ELSE */ if (nbif[(etat_bloc > 0) ? 1 : 0] == 0) { error_file ("else without if"); retour = 1; } break; case 5: /* ENDIF */ if (nbif[(etat_bloc > 0) ? 1 : 0]-- == 0) { error_file ("endif without if"); retour = 1; } break; case 6: /* Fin de bloc */ if ((etat_bloc == 0) || (nbif[1] != 0)) { error_file ("end of a non-existing block"); retour = 1; } etat_bloc = 0; break; case 7: /* NOT */ etat_bloc = 2; break; } return retour; } void end_fwd (void) { if (time_include) { m_libere (time_include, include_size * sizeof (long)); time_include = NULL; } } static void init_buf_fwd_ems (void) { int nb_include; int c; int choix; char com_buf[80]; char ligne[80]; char *ptr, *fwd_ptr; unsigned nb_car = 1; struct stat st; nb_include = 1; reset_fwd_pointeurs (); seek_exms_string (FORWARD, 0L); etat_bloc = nbif[0] = nbif[1] = 0; niveau = 0; memset (file, 0, sizeof (File) * MAX_NIVEAU); file[niveau].nolig = 0; choix = 0; file[niveau].fp = fopen (c_disque (forward_sys[choix]), "rt"); if (file[niveau].fp == NULL) { choix = 1; file[niveau].fp = fopen (c_disque (forward_sys[choix]), "rt"); } strcpy (file[niveau].name, forward_sys[choix]); if (file[niveau].fp) { do { while (fgets (com_buf, 80, file[niveau].fp)) { ++file[niveau].nolig; sup_ln (com_buf); c = fwd_commande (com_buf); if ((c == '*') || (c == '#') || (c == '\0')) continue; if (c == '<') { ++nb_include; if (++niveau >= MAX_NIVEAU) { --niveau; error_file ("Too much include levels"); for (niveau = 1; niveau < MAX_NIVEAU; ++niveau) { if (file[niveau].fp) fclose (file[niveau].fp); } nb_car = 1; niveau = 0; break; } file[niveau].nolig = 0; strcpy (file[niveau].name, com_buf); if ((file[niveau].fp = fopen (c_disque (file[niveau].name), "rt")) == NULL) { char str[256]; sprintf (str, "Cannot find include file %s", file[niveau].name); error_file (str); for (niveau = 1; niveau < MAX_NIVEAU; ++niveau) { if (file[niveau].fp) fclose (file[niveau].fp); } nb_car = 1; niveau = 0; break; } continue; } if (tst_ligne (c)) { nb_car = 1; break; } if (c == '!') { c = fwd_commande (com_buf); if (tst_ligne (c)) { nb_car = 1; break; } ++nb_car; } nb_car += (strlen (com_buf) + 2); } fclose (file[niveau].fp); } while (niveau--); if (nbif[0] != 0) { error_file ("endif missing"); nb_car = 1; } } if (nb_include != include_size) { if (time_include) m_libere (time_include, include_size * sizeof (long)); include_size = nb_include; time_include = (long *) m_alloue (include_size * sizeof (long)); } if (nb_car > 1) { niveau = 0; nb_include = 0; file[niveau].nolig = 0; file[niveau].fp = fopen (c_disque (forward_sys[choix]), "rt"); strcpy (file[niveau].name, forward_sys[choix]); if (file[niveau].fp) { fstat (fileno (file[niveau].fp), &st); time_include[nb_include++] = st.st_mtime; do { while (fgets (com_buf, 80, file[niveau].fp)) { fwd_ptr = ligne; sup_ln (com_buf); c = fwd_commande (com_buf); if ((c == '*') || (c == '#') || (c == '\0')) continue; #if defined(__WINDOWS__) || defined(__LINUX__) if (c == 'A') { InitText (com_buf); } #endif if (c == '<') { ++niveau; file[niveau].nolig = 0; strcpy (file[niveau].name, com_buf); file[niveau].fp = fopen (c_disque (file[niveau].name), "rt"); if (file[niveau].fp == NULL) { for (niveau = 1; niveau < MAX_NIVEAU; ++niveau) { if (file[niveau].fp) fclose (file[niveau].fp); } nb_car = 1; niveau = 0; break; } fstat (fileno (file[niveau].fp), &st); time_include[nb_include++] = st.st_mtime; continue; } *fwd_ptr++ = c; if (c == '!') { c = fwd_commande (com_buf); *fwd_ptr++ = c; } ptr = com_buf; while ((*fwd_ptr++ = *ptr++) != '\0'); write_exms_string (FORWARD, ligne); } fclose (file[niveau].fp); } while (niveau--); } } ligne[0] = '\032'; ligne[1] = '\0'; write_exms_string (FORWARD, ligne); seek_exms_string (FORWARD, 0L); } void init_buf_fwd (void) { int nb_include; int c; int choix; char com_buf[80]; char *ptr, *fwd_ptr; unsigned nb_car = 1; struct stat st; if (EMS_FWD_OK ()) { init_buf_fwd_ems (); return; } nb_include = 1; reset_fwd_pointeurs (); etat_bloc = nbif[0] = nbif[1] = 0; niveau = 0; memset (file, 0, sizeof (File) * MAX_NIVEAU); file[niveau].nolig = 0; choix = 0; file[niveau].fp = fopen (c_disque (forward_sys[choix]), "rt"); if (file[niveau].fp == NULL) { choix = 1; file[niveau].fp = fopen (c_disque (forward_sys[choix]), "rt"); } strcpy (file[niveau].name, forward_sys[choix]); if (file[niveau].fp) { do { while (fgets (com_buf, 80, file[niveau].fp)) { ++file[niveau].nolig; sup_ln (com_buf); c = fwd_commande (com_buf); if ((c == '*') || (c == '#') || (c == '\0')) continue; if (c == '<') { ++nb_include; if (++niveau >= MAX_NIVEAU) { --niveau; error_file ("too much include levels"); for (niveau = 1; niveau < MAX_NIVEAU; ++niveau) { if (file[niveau].fp) fclose (file[niveau].fp); } nb_car = 1; niveau = 0; break; } file[niveau].nolig = 0; strcpy (file[niveau].name, com_buf); if ((file[niveau].fp = fopen (c_disque (file[niveau].name), "rt")) == NULL) { char str[256]; sprintf (str, "Cannot find include file %s", file[niveau].name); error_file (str); for (niveau = 1; niveau < MAX_NIVEAU; ++niveau) { if (file[niveau].fp) fclose (file[niveau].fp); } nb_car = 1; niveau = 0; break; } continue; } if (tst_ligne (c)) { nb_car = 1; break; } if (c == '!') { c = fwd_commande (com_buf); if (tst_ligne (c)) { nb_car = 1; break; } ++nb_car; } nb_car += (strlen (com_buf) + 2); } fclose (file[niveau].fp); } while (niveau--); if (nbif[0] != 0) { error_file ("endif missing"); nb_car = 1; } } if (nb_car >= fwd_size) { if (fwd_file) m_libere (fwd_file, fwd_size); fwd_size = nb_car + nb_car / 5; fwd_file = m_alloue (fwd_size); } fwd_ptr = fwd_file; if (nb_include != include_size) { if (time_include) m_libere (time_include, include_size * sizeof (long)); include_size = nb_include; time_include = (long *) m_alloue (include_size * sizeof (long)); } if (nb_car > 1) { niveau = 0; nb_include = 0; file[niveau].nolig = 0; /* strcpy (file[niveau].name, "FORWARD.SYS"); */ file[niveau].fp = fopen (c_disque (file[niveau].name), "rt"); fstat (fileno (file[niveau].fp), &st); time_include[nb_include++] = st.st_mtime; if (file[niveau].fp) { do { while (fgets (com_buf, 80, file[niveau].fp)) { sup_ln (com_buf); c = fwd_commande (com_buf); if ((c == '*') || (c == '#') || (c == '\0')) continue; if (c == '<') { ++niveau; file[niveau].nolig = 0; strcpy (file[niveau].name, com_buf); file[niveau].fp = fopen (c_disque (file[niveau].name), "rt"); fstat (fileno (file[niveau].fp), &st); time_include[nb_include++] = st.st_mtime; continue; } *fwd_ptr++ = c; if (c == '!') { c = fwd_commande (com_buf); *fwd_ptr++ = c; } ptr = com_buf; while ((*fwd_ptr++ = *ptr++) != 0); } fclose (file[niveau].fp); } while (niveau--); } } *fwd_ptr = '\032'; } static void init_buf_rej_ems (void) { static int old_record_nb = 0; FILE *fp; int c; char mode; char type; char com_buf[80]; char exped[80]; char route[80]; char desti[80]; char bid[80]; int size; struct stat st; Rej_rec rej; unsigned record = 0; if ((stat (c_disque (REJECT_FILE), &st) == 0) && (st.st_mtime == t_rej)) return; t_rej = st.st_mtime; niveau = 0; memset (file, 0, sizeof (File) * MAX_NIVEAU); file[0].nolig = 0; strcpy (file[0].name, REJECT_FILE); fp = fopen (c_disque (REJECT_FILE), "rt"); if (fp) { while (fgets (com_buf, 80, fp)) { file[0].nolig++; sup_ln (strupr (com_buf)); c = *com_buf; if ((c == '#') || (c == '\0')) continue; if (sscanf (com_buf, "%c %c %s %s %s %s %d", &mode, &type, exped, route, desti, bid, &size) != 7) { error_file ("bad number of fields"); } if ((mode != 'H') && (mode != 'R') && (mode != 'L')) error_file ("bad mode (H, R or L)"); rej.mode = toupper (mode); rej.type = toupper (type); rej.size = size; strn_cpy (6, rej.exped, exped); strn_cpy (6, rej.via, route); strn_cpy (6, rej.desti, desti); strn_cpy (12, rej.bid, bid); write_rej (record, &rej); ++record; } fclose (fp); /* Invalide les anciens records */ rej.mode = '\0'; while (record < old_record_nb) { write_rej (record, &rej); ++record; } old_record_nb = record; } } void init_buf_rej (void) { if (EMS_REJ_OK ()) { init_buf_rej_ems (); return; } else { FILE *fp; int c; char com_buf[80], tp[80]; char *ptr, *rej_ptr; unsigned nb_car = 1; struct stat st; if ((stat (c_disque (REJECT_FILE), &st) == 0) && (st.st_mtime == t_rej)) return; t_rej = st.st_mtime; niveau = 0; memset (file, 0, sizeof (File) * MAX_NIVEAU); file[0].nolig = 0; strcpy (file[0].name, REJECT_FILE); fp = fopen (c_disque (REJECT_FILE), "rt"); if (fp) { while (fgets (com_buf, 80, fp)) { sup_ln (com_buf); c = *com_buf; if ((c == '#') || (c == '\0')) continue; nb_car += (strlen (com_buf) + 1); } } if (nb_car >= rej_size) { if (rej_file) m_libere (rej_file, rej_size); rej_size = nb_car + nb_car / 5; rej_file = m_alloue (rej_size); } rej_ptr = rej_file; if (fp) { rewind (fp); while (fgets (com_buf, 80, fp)) { file[0].nolig++; sup_ln (strupr (com_buf)); c = *com_buf; if ((c == '#') || (c == '\0')) continue; if (sscanf (com_buf, "%s %s %s %s %s %s %s", tp, tp, tp, tp, tp, tp, tp) != 7) { error_file ("bad number of fields"); } ptr = com_buf; while ((*rej_ptr++ = *ptr++) != '\0'); } fclose (fp); } *rej_ptr = '\032'; } } void end_swap (void) { if (swap_file) m_libere (swap_file, fwd_size); } void init_buf_swap (void) { FILE *fp; int c; char com_buf[80]; char *ptr, *swap_ptr; unsigned nb_car = 1; struct stat st; niveau = 0; memset (file, 0, sizeof (File) * MAX_NIVEAU); file[0].nolig = 0; strcpy (file[0].name, "SWAPP.SYS"); ptr = c_disque ("SWAPP.SYS"); strcpy (com_buf, ptr); if ((stat (com_buf, &st) == 0) && (st.st_mtime == t_swap)) return; t_swap = st.st_mtime; fp = fopen (c_disque ("SWAPP.SYS"), "rb"); if (fp) { while (fgets (com_buf, 80, fp)) { sup_ln (com_buf); c = fwd_commande (com_buf); if ((c == '#') || (c == '\0')) continue; nb_car += (strlen (com_buf) + 2); } } if (nb_car >= swap_size) { if (swap_file) m_libere (swap_file, fwd_size); swap_size = nb_car + nb_car / 5; swap_file = m_alloue (swap_size); } swap_ptr = swap_file; if (fp) { rewind (fp); while (fgets (com_buf, 80, fp)) { file[0].nolig++; sup_ln (strupr (com_buf)); c = fwd_commande (com_buf); if ((c == '#') || (c == '\0')) continue; if ((c != '<') && (c != '>') && (c != '@')) { error_file ("bad field specification (<, > of @)"); } *swap_ptr++ = c; ptr = com_buf; while ((*swap_ptr++ = *ptr++) != '\0'); } fclose (fp); } *swap_ptr = '\032'; } static void reset_fwd_pointeurs (void) { int port; Forward *pfwd; for (port = 0; port < NBPORT; port++) { if (p_port[port].pvalid) { pfwd = p_port[port].listfwd; while (pfwd) { pfwd->fwdpos = 0; pfwd = pfwd->suite; } } } } static int fwd_commande (char *com_buf) { int type; char *ptr = com_buf, *lptr = com_buf; sup_ln (com_buf); while ((*ptr) && (!ISGRAPH (*ptr))) ++ptr; type = toupper (*ptr); ++ptr; if ((type == 'D') || (type == 'L') || (type == 'X')) { if (*ptr == 'C') { type = tolower (type); ++ptr; } } if ((type == 'E') && (toupper (*ptr) == 'L')) type = '@'; if (type != '!') while (ISGRAPH (*ptr)) ++ptr; while ((*ptr) && (!ISGRAPH (*ptr))) ++ptr; if (type == 'P') { swap_port (ptr); } while ((*lptr++ = *ptr++) != '\0'); return (type); } void end_bbs (void) { if (bbs_ptr) m_libere (bbs_ptr, 7 * NBBBS); bbs_ptr = NULL; } void init_bbs (void) { FILE *fichier; char chaine[80], bbs[80]; char *ptr; int i; int nb = 0; int tot = 0; struct stat st; if ((stat (c_disque ("BBS.SYS"), &st) == 0) && (st.st_mtime == t_bbs)) return; t_bbs = st.st_mtime; #ifdef ENGLISH if (!operationnel) cprintf ("BBS set-up \r\n"); #else if (!operationnel) cprintf ("Initialisation BBS\r\n"); #endif if (bbs_ptr == NULL) { bbs_ptr = m_alloue (7 * NBBBS); } ptr = bbs_ptr; if ((fichier = fopen (c_disque ("BBS.SYS"), "rt")) != NULL) { while (fgets (chaine, 78, fichier)) { int itmp; sup_ln (chaine); if (*chaine == '#') continue; *bbs = '\0'; sscanf (chaine, "%d %s", &itmp, bbs); #if defined(__WINDOWS__) || defined(__LINUX__) if (*bbs) { char text[80]; ++tot; sprintf (text, "%d: %s", tot, bbs); InitText (text); } #endif for (i = 0; i < 6; i++) *ptr++ = bbs[i]; *ptr++ = '\001'; if (++nb == NBBBS) break; } fclose (fichier); } } static int type_commande (char *com_buf) { int type; char *ptr = com_buf, *lptr = com_buf; while ((*ptr) && (!ISGRAPH (*ptr))) ++ptr; type = toupper (*ptr); if ((type == 'E') && (toupper (*(ptr + 1)) == 'L')) type = '@'; while (ISGRAPH (*ptr)) ++ptr; while ((*ptr) && (!ISGRAPH (*ptr))) ++ptr; while ((*lptr++ = *ptr++) != '\0'); sup_ln (com_buf); return (type); } void cron (long h_time) { FILE *fptr; char com_buf[80]; int cptif = 0; int lig = 0; int fin = 0; int modif = 0; int temp; char *cronname; aff_etat ('C'); #ifdef __FBBDOS__ cronname = "cron_d.sys"; #endif #ifdef __WINDOWS__ cronname = "cron_w.sys"; #endif #ifdef __LINUX__ cronname = "cron_l.sys"; #endif if ((fptr = fopen (c_disque (cronname), "rt")) == NULL) { if ((fptr = fopen (c_disque ("cron.sys"), "rt")) == NULL) { aff_etat ('A'); return; } } while ((!fin) && (fgets (com_buf, 80, fptr))) { ++lig; sup_ln (com_buf); if (*com_buf == '#') continue; switch (type_commande (com_buf)) { case 'E': /* ENDIF */ if (cptif) --cptif; else fin = erreur_cron (lig); break; case '@': /* ELSE */ if (cptif) { temp = cptif - 1; while (cptif != temp) { if (fgets (com_buf, 80, fptr) == NULL) { fin = erreur_cron (lig); break; } ++lig; switch (type_commande (com_buf)) { case 'I': ++cptif; break; case 'E': if (cptif) --cptif; else fin = erreur_cron (lig); break; default: break; } } } else fin = erreur_cron (lig); break; case 'I': ++cptif; if (tst_fwd (com_buf, 0, h_time, 0, NULL, 1, -1) == FALSE) { temp = cptif - 1; while (cptif != temp) { if (fgets (com_buf, 80, fptr) == NULL) { fin = erreur_cron (lig); break; } ++lig; switch (type_commande (com_buf)) { case 'I': ++cptif; break; case 'E': if (cptif) --cptif; else fin = erreur_cron (lig); break; case '@': if (cptif == (temp + 1)) ++temp; break; default: break; } } } break; case 'D': /* Dos */ if (strncmpi (com_buf, "PTCTRX", 6) == 0) { ptctrx (0, com_buf); } else { #if defined(__WINDOWS__) || defined(__FBBDOS__) send_dos (1, com_buf, NULL); #endif #ifdef __LINUX__ char *pptr = com_buf; call_nbdos (&pptr, 1, NO_REPORT_MODE, NULL, TOOLDIR, NULL); #endif } break; case 'X': /* Dos */ if (strncmpi (com_buf, "PTCTRX", 6) == 0) { ptctrx (0, com_buf); } else { #if defined(__WINDOWS__) || defined(__FBBDOS__) send_dos (2, com_buf, NULL); #endif #ifdef __LINUX__ char *pptr = com_buf; call_nbdos (&pptr, 1, NO_REPORT_MODE, NULL, TOOLDIR, NULL); #endif } break; case 'T': /* Talk */ talk_select (com_buf); modif = 1; break; case 'B': /* Bip */ bip_select (com_buf); modif = 1; break; case 'G': /* Gate */ gate_select (com_buf); modif = 1; break; case 'L': /* Unproto Lists */ list_select (com_buf); break; case 'M': /* Modification des parametres du port */ port_select (com_buf); break; case 'Y': /* Yapp */ yapp_select (com_buf); break; } } fclose (fptr); aff_etat ('A'); #if defined(__WINDOWS__) || defined(__LINUX__) if (modif) { maj_menu_options (); } #endif } static char *analyse (char *text, int *port, int *rep) { char temp[40]; char val[40]; int i; *port = 0; for (i = 0; *text; ++i, ++text) { if (isspace (*text)) break; temp[i] = *text; } temp[i] = '\0'; while ((*text) && (isspace (*text))) ++text; for (i = 0; *text; ++i, ++text) { if (isspace (*text)) break; val[i] = *text; } val[i] = '\0'; while ((*text) && (isspace (*text))) ++text; if (*val) *rep = *val; else *rep = *temp; if (*temp) { swap_port (temp); if (isdigit (*temp)) *port = *temp - '0'; else *port = *temp - '@'; } return (text); } static void talk_select (char *text) { int port, rep; analyse (text, &port, &rep); ok_tell = (rep != 'N'); } static void bip_select (char *text) { int port, rep; analyse (text, &port, &rep); bip = (rep != 'N'); } static void gate_select (char *text) { int p; int port, rep; analyse (text, &port, &rep); for (p = 1; p < NBPORT; p++) { if ((port == 0) || (p == port)) { if (rep == 'N') p_port[p].moport &= (~0x10); else p_port[p].moport |= 0x10; } } } static void yapp_select (char *text) { int p; int port, rep; analyse (text, &port, &rep); for (p = 1; p < NBPORT; p++) { if ((port == 0) || (p == port)) { if (rep == 'N') p_port[p].moport &= (~0x04); else p_port[p].moport |= 0x04; } } } static void list_select (char *text) { int p; int port, rep; analyse (text, &port, &rep); for (p = 1; p < NBPORT; p++) { if ((port == 0) || (p == port)) { if (rep == 'N') p_port[p].moport &= (~0x20); else p_port[p].moport |= 0x20; } } } static void port_select (char *text) { int p; int port, rep; int min, per; char *fwd_mp; fwd_mp = analyse (text, &port, &rep); for (p = 1; p < NBPORT; p++) { if ((port == 0) || (p == port)) { switch (rep) { case 'G': p_port[p].moport &= 0xf8; p_port[p].moport |= 1; break; case 'B': p_port[p].moport &= 0xf8; p_port[p].moport |= 2; break; case 'U': p_port[p].moport &= 0xf8; break; } if (*fwd_mp) { if (sscanf (fwd_mp, "%d/%d", &min, &per) == 2) { p_port[p].min_fwd = min; p_port[p].per_fwd = per; } } } } } static int erreur_cron (int lig) { char wtexte[200]; deb_io (); #ifdef ENGLISH sprintf (wtexte, "\r\nError in CRON.SYS file line %d \r\n\a", lig); if (w_mask & W_FILE) mess_warning (admin, "*** FILE ERROR *** ", wtexte); #else sprintf (wtexte, "\r\nErreur fichier CRON.SYS ligne %d\r\n\a", lig); if (w_mask & W_FILE) mess_warning (admin, "*** ERREUR FICHIER ***", wtexte); #endif cprintf (wtexte); sleep_ (5); fin_io (); return (1); } fbb-7.04j/src/initport.c0100644000175100017510000006064107726646105013231 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include static int lang_len (char *); static void errport (int, char *); static void err_fic (char *, int, char *); static void init_forward (Forward * pfwd) { int i; int j; pfwd->reverse = 0; pfwd->fwdpos = 0; pfwd->lastpos = 0; pfwd->fwdlig = 0; pfwd->cptif = 0; pfwd->forward = 0; pfwd->no_con = 0; pfwd->no_bbs = 0; pfwd->fin_fwd = 0; for (i = 0; i < 8; i++) { *pfwd->con_lig[i] = '\0'; } for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { *pfwd->mesnode[i][j] = '\0'; } } *pfwd->txt_con = '\0'; *pfwd->fwdbbs = '\0'; pfwd->suite = NULL; } void end_ports (void) { int i; Forward *pfwd; if (p_port == NULL) return; for (i = 0; i < NBPORT; i++) { while (p_port[i].listfwd) { pfwd = p_port[i].listfwd; p_port[i].listfwd = pfwd->suite; m_libere (pfwd, sizeof (Forward)); } } m_libere (p_port, sizeof (defport) * NBPORT); p_port = NULL; } void initport (void) { FILE *fptr; Forward *pprec, *pfwd; char *ptr; char ligne[256], sfreq[81], mode[81]; char portname[81]; int voie; #ifdef __LINUX__ int linux_canal = 1; #endif int drsi_canal = 1; int bpq_canal = 1; int agw_canal = 1; int hst_canal = 1; int lig; int j; unsigned int p1, p2, p3, p4, p5, p6, p7, p8, p9; long lp4; int mx; int nbvalid = 0, i = 0; int nb, nbl, tnc = 0, nbport; int local_mode, nbtnc, fvoie; /* flag de lecture d'affectation des voies */ unsigned al; char *portfile; lig = 0; al = sizeof (defcom) * NBPORT; p_com = (defcom *) m_alloue (al); memset (p_com, 0, sizeof (defcom) * NBPORT); #ifdef __FBBDOS__ portfile = "port_d.sys"; #endif #ifdef __WINDOWS__ portfile = "port_w.sys"; #endif #ifdef __LINUX__ portfile = "port_l.sys"; #endif if ((fptr = fopen (c_disque (portfile), "r")) == NULL) { if ((fptr = fopen (c_disque ("port.sys"), "r")) == NULL) { #ifdef ENGLISH errport (lig, "File PORT.SYS not found "); #else errport (lig, "Fichier PORT.SYS inexistant"); #endif return; } } #ifdef ENGLISH cprintf ("Ports set-up \r\n"); #else cprintf ("Initialisation des ports\r\n"); #endif al = sizeof (defport) * NBPORT; p_port = (defport *) m_alloue (al); for (i = 0; i < NBPORT; i++) { p_port[i].mem = 32000; p_port[i].pvalid = p_port[i].nb_voies = 0; p_port[i].transmit = 0; p_port[i].cur_can = 0; p_port[i].portind = 0; p_port[i].synchro = 0; p_port[i].frame = 0; for (j = 0; j < NBHEARD; j++) p_port[i].heard[j].last = 0L; } p_port[0].pvalid = 1; /* Port console valide */ p_port[0].typort = TYP_DED; p_port[0].moport = 0; p_port[0].frame = 4; /******************* A PARAMETRER *******************/ p_port[0].min_fwd = 0; p_port[0].per_fwd = 15; strcpy (p_port[0].freq, "CONSOLE"); p_port[0].listfwd = (Forward *) m_alloue (sizeof (Forward)); init_forward (p_port[0].listfwd); svoie[0]->sta.mem = 500; svoie[0]->affport.port = 0xfe; svoie[0]->affport.canal = -2; /* voie pour import/export */ init_voie (NBVOIES); svoie[NBVOIES]->sta.mem = 500; svoie[NBVOIES]->affport.port = 0; svoie[NBVOIES]->affport.canal = 1; ++NBVOIES; fvoie = 1; nbl = 0; while (fgets (ligne, 250, fptr)) { ++lig; ptr = ligne; while (*ptr && (*ptr == ' ')) ++ptr; if (*ptr == '#') continue; if (!isdigit (*ptr)) { #ifdef ENGLISH errport (lig, "Syntax error "); #else errport (lig, "Erreur de syntaxe"); #endif return; } switch (fvoie) { case 1: nb = sscanf (ptr, "%d %d", &nbport, &nbtnc); if (nb != 2) { #ifdef ENGLISH errport (lig, "Wrong number of parameters "); #else errport (lig, "Nombre de paramtres incorrect"); #endif return; } if ((nbport <= 0) || (nbport > (NBPORT - 1))) { #ifdef ENGLISH errport (lig, "Port number error "); #else errport (lig, "Nombre de ports erron"); #endif return; } if (nbtnc < nbport) { #ifdef ENGLISH errport (lig, "TNC number error "); #else errport (lig, "Nombre de TNCs erron"); #endif return; } fvoie = 2; break; case 2: nb = sscanf (ptr, "%d %d %s %ld", &p1, &p3, portname, &lp4); if (nb != 4) { #ifdef ENGLISH errport (lig, "Wrong number of parameters "); #else errport (lig, "Nombre de paramtres incorrect"); #endif return; } if ((p1 <= 0) || (p1 > NBCOM)) { #ifdef ENGLISH errport (lig, "COM Nb error "); #else errport (lig, "N COM erron"); #endif return; } p2 = 0; sscanf (portname, "%x", &p2); n_cpy (19, p_com[p1].name, portname); p_com[p1].delai = 0; p_com[p1].cbase = p2; p_com[p1].pactor_st = 247; #ifdef __LINUX__ if (p3 != P_LINUX) { #ifdef ENGLISH errport (lig, "Wrong interface number "); #else errport (lig, "Numro d'interface erron"); #endif return; } #endif #ifdef __FBBDOS__ if (p3 > P_TFPC) { #ifdef ENGLISH errport (lig, "Wrong interface number "); #else errport (lig, "Numro d'interface erron"); #endif return; } #endif #ifdef __WINDOWS__ if (p3 > P_TFWIN) { #ifdef ENGLISH errport (lig, "Wrong interface number "); #else errport (lig, "Numro d'interface erron"); #endif return; } #endif p_com[p1].combios = p3; p_com[p1].port = (int) lp4; #ifdef __WINDOWS__ if (p3 == P_WINDOWS) { p_com[p1].baud = lp4; } else { #endif #if defined(__LINUX__) || defined(__FBBDOS__) if (p3) { #endif switch (lp4) { case 300L: p_com[p1].baud = 0x43; p_com[p1].options = 0; break; case 600L: p_com[p1].baud = 0x63; p_com[p1].options = 0; break; case 1200L: p_com[p1].baud = 0x83; p_com[p1].options = 0; break; case 2400L: p_com[p1].baud = 0xA3; p_com[p1].options = 0; break; case 4800L: p_com[p1].baud = 0xC3; p_com[p1].options = 0; break; case 0L: case 9600L: p_com[p1].baud = 0xE3; p_com[p1].options = 0; break; case 14400L: p_com[p1].baud = 0x23; p_com[p1].options = 0x20; break; case 19200L: p_com[p1].baud = 0x43; p_com[p1].options = 0x20; break; case 28800L: p_com[p1].baud = 0x63; p_com[p1].options = 0x20; break; case 38400L: p_com[p1].baud = 0x83; p_com[p1].options = 0x20; break; case 57600L: p_com[p1].baud = 0xA3; p_com[p1].options = 0x20; break; case 115200L: p_com[p1].baud = 0xC3; p_com[p1].options = 0x20; break; case 330400L: p_com[p1].baud = 0xE3; p_com[p1].options = 0x20; break; default: #ifdef __LINUX__ break; #else #ifdef ENGLISH errport (lig, "Wrong baud rate "); #else errport (lig, "Baud rate incorrect"); #endif return; #endif } } #ifdef __FBBDOS__ else { p_com[p1].options = 0x0; switch (lp4) { case 300L: p_com[p1].baud = 384; break; case 600L: p_com[p1].baud = 192; break; case 1200L: p_com[p1].baud = 96; break; case 2400L: p_com[p1].baud = 48; break; case 4800L: p_com[p1].baud = 24; break; case 9600L: p_com[p1].baud = 12; break; case 14400L: p_com[p1].baud = 9; break; case 19200L: p_com[p1].baud = 6; break; case 28800L: p_com[p1].baud = 4; break; case 38400L: p_com[p1].baud = 3; break; case 57600L: p_com[p1].baud = 2; break; case 115200L: p_com[p1].baud = 1; break; case 330400L: p_com[p1].baud = 0; break; default: #ifdef ENGLISH errport (lig, "Wrong baud rate "); #else errport (lig, "Baud rate incorrect"); #endif return; } } #endif /* __FBBDOS__ */ if (++nbl == nbport) { fvoie = 3; nbl = 0; tnc = 0; voie = 1; } break; case 3: p5 = 0; nb = sscanf (ptr, "%d %d %d %s %d %d %d %d %d/%d %s %s", &p1, &p2, &p4, portname, &p6, &p7, &p9, &mx, &p3, &p8, mode, sfreq); if (nb != 12) { #ifdef ENGLISH errport (lig, "Wrong number of parameters "); #else errport (lig, "Nombre de paramtres incorrect"); #endif return; } if (p1 > NBPORT) { #ifdef ENGLISH errport (lig, "Wrong port number "); #else errport (lig, "Numro port erron"); #endif return; } if (p2 > MAXVOIES) { #ifdef ENGLISH errport (lig, "Number of channels"); #else errport (lig, "Nombre de voies "); #endif return; } if (p2 > 0) { sscanf (portname, "%d", &p5); if (p5 > 99) p5 = 0; n_cpy (19, p_port[p1].name, portname); if ((p4 < 1) || (p4 > NBCOM)) { #ifdef ENGLISH errport (lig, "N COM erron"); #else errport (lig, "COM Nb error "); #endif return; } #ifndef __LINUX__ if (p5 > 7) { #ifdef ENGLISH errport (lig, "Channel must be from 0 to 7"); #else errport (lig, "Le canal doit etre de 0 7"); #endif return; } #endif if ((p6 != 0) && ((p6 < 30) || (p6 > 250))) { #ifdef ENGLISH errport (lig, "Paclen must be from 30 to 250 "); #else errport (lig, "Le paquet doit etre de 30 250"); #endif return; } if ((p7 < 1) || (p7 > 7)) { #ifdef ENGLISH errport (lig, "Maxframe must be from 1 to 7 "); #else errport (lig, "Le nombre de trames doit etre de 1 7"); #endif return; } if (p9 > p2) { #ifdef ENGLISH errport (lig, "Too many forward channels"); #else errport (lig, "Trop de voies forward "); #endif return; } if (mx <= 0) { #ifdef ENGLISH errport (lig, "Forwarding block size"); #else errport (lig, "Taille bloc forward "); #endif return; } if (strlen (sfreq) > 9) { #ifdef ENGLISH errport (lig, "9 characters maximum for the frequency"); #else errport (lig, "9 caracteres maximum pour la frequence"); #endif return; } if (p3 > 59) { #ifdef ENGLISH errport (lig, "Forward minute"); #else errport (lig, "Minute forward"); #endif return; } if ((p8 < 1) || (p8 > 60)) { #ifdef ENGLISH errport (lig, "Forward period "); #else errport (lig, "Priode forward"); #endif return; } } /* Gestion du multiplexeur sur le COM (DED) */ p_com[p4].multi[p5] = p1; if (p1 == 0) { if (p3 > 59) { #ifdef ENGLISH errport (lig, "Forward minute"); #else errport (lig, "Minute forward"); #endif return; } if ((p8 < 1) || (p8 > 60)) { #ifdef ENGLISH errport (lig, "Forward period "); #else errport (lig, "Priode forward"); #endif return; } p_port[p1].min_fwd = p3; p_port[p1].per_fwd = p8; break; } if (p_port[p1].pvalid) { errport (lig, "TNC number already declared"); } p_port[p1].ccom = p4; p_port[p1].ccanal = p5; p_port[p1].maxbloc = mx; ptr = mode; p_port[p1].typort = TYP_DED; p_port[p1].moport = 0; while (*ptr) { switch (toupper (*ptr)) { case 'G': p_port[p1].moport |= 1; break; case 'B': p_port[p1].moport |= 2; break; case 'Y': p_port[p1].moport |= 4; break; case 'M': p_port[p1].moport |= 8; p_port[p1].typort = TYP_MOD; /* MODEM */ break; case 'W': p_port[p1].moport |= 0x10; break; case 'L': p_port[p1].moport |= 0x20; break; case 'R': p_port[p1].moport |= 0x40; break; #ifdef __LINUX__ case 'S': p_port[p1].typort = TYP_POP; /* POP SOCKET */ p_port[p1].ccanal = 0; p5 = 0; break; case 'X': p_port[p1].typort = TYP_SCK; /* AX25 SOCKET */ p_port[p1].ccanal = 0; p5 = 0; break; #endif case 'H': p_port[p1].typort = TYP_HST; /* PTC-HOST */ break; case 'D': p_port[p1].typort = TYP_DED; /* DED */ if ((p_com[p4].combios == P_COMBIOS) && ((p5 < 1) || (p5 > 4))) { #ifdef ENGLISH errport (lig, "Mux channel must be from 1 to 4"); #else errport (lig, "Le canal MUX doit etre de 1 a 4"); #endif return; } break; case 'P': p_port[p1].typort = TYP_PK; /* PK232 */ if (p2 > 9) p2 = 9; break; case 'K': p_port[p1].typort = TYP_KAM; /* KAM */ break; case 'Q': p_port[p1].typort = TYP_BPQ; /* BPQ4 */ p_port[p1].ccanal = p5 + 1; break; #if defined(__WINDOWS__) || defined(__LINUX__) case 'T': p_port[p1].typort = TYP_TCP; /* TCP-IP */ break; case 'E': p_port[p1].typort = TYP_ETH; /* ETHER-LINK */ break; #endif #if defined(__WINDOWS__) case 'A': p_port[p1].typort = TYP_AGW; /* TCP-AGW */ break; #endif #if defined(__WINDOWS__) || defined(__FBBDOS__) case 'F': p_port[p1].typort = TYP_FLX; /* FLEXNET */ break; #endif case 'U': break; default: #ifdef ENGLISH errport (lig, "Wrong port mode "); #else errport (lig, "Mode du port erron"); #endif return; } ++ptr; } p_port[p1].pk_t = p6; if ((p_port[p1].typort == TYP_HST) && (p_port[p1].ccanal == 0)) { /* Pactor port */ p_port[p1].moport |= 0x80; } if (p6) p_port[p1].beacon_paclen = p6; else p_port[p1].beacon_paclen = 128; switch (p_com[p4].combios) { case 3: p_port[p1].typort = TYP_MOD; p_port[p1].moport |= 8; p_port[p1].pk_t = 128; break; case 4: p_port[p1].typort = TYP_DED; break; default: break; } p_port[p1].pvalid = p_port[p1].nb_voies = p2; p_port[p1].frame = p7; p_port[p1].listfwd = pprec = NULL; p_port[p1].min_fwd = p3; p_port[p1].per_fwd = p8; p_port[p1].pr_voie = NBVOIES; while (p9--) { pfwd = (Forward *) m_alloue (sizeof (Forward)); if (p_port[p1].listfwd) { pprec->suite = pfwd; pprec = pfwd; } else { p_port[p1].listfwd = pprec = pfwd; } init_forward (pprec); } strn_cpy (9, p_port[p1].freq, sfreq); if (p2) { int tot; #if defined(__WINDOWS__) || defined(__LINUX__) { char buf[80]; sprintf (buf, "%d %d ch", p1, p2); InitText (buf); } #endif #ifdef __FBBDOS__ #ifdef ENGLISH cprintf ("Port %d ok : %d channel(s) \r\n", p1, p2); #else cprintf ("Port %d valide : %d voie(s)\r\n", p1, p2); #endif #endif nbvalid += p2; tot = 0; for (i = 1; i <= p2; i++) { init_voie (NBVOIES); svoie[NBVOIES]->affport.port = p1; #ifdef __LINUX__ if (S_LINUX (p1)) { tot = linux_canal++; svoie[NBVOIES]->affport.canal = tot; } else #endif if (DRSI (p1)) { tot = drsi_canal++; svoie[NBVOIES]->affport.canal = tot; } else if (BPQ (p1)) { tot = bpq_canal++; svoie[NBVOIES]->affport.canal = tot; } else if (AGW (p1)) { tot = agw_canal++; svoie[NBVOIES]->affport.canal = tot; } else if (HST (p1)) { if (p_port[p1].ccanal == 0) { tot = 1; svoie[NBVOIES]->affport.canal = PACTOR_CH; } else { /* Include the pactor channel */ tot = hst_canal++; svoie[NBVOIES]->affport.canal = tot; if (tot == PACTOR_CH) { #ifdef ENGLISH errport (lig, "Too many channels ! "); #else errport (lig, "Nombre de voies trop important"); #endif } } } else { tot = i; svoie[NBVOIES]->affport.canal = tot; } if (++NBVOIES == MAXVOIES) { #ifdef ENGLISH errport (lig, "Too many channels ! "); #else errport (lig, "Nombre de voies trop important"); #endif return; } } p_port[p1].tt_can = tot; } if (++tnc == nbtnc) { fvoie = 4; nbl = 0; } break; case 4: nb = sscanf (ptr, "%d %d %s %s", &p1, &p2, sfreq, mode); if (nb != 4) { #ifdef ENGLISH errport (lig, "Wrong parameter number "); #else errport (lig, "Nombre de paramtres incorrect"); #endif return; } if (p2 > p_port[p1].nb_voies) { #ifdef ENGLISH errport (lig, "Not enough channels on this port"); #else errport (lig, "Pas assez de voies sur ce port "); #endif return; } ptr = mode; local_mode = 0; while (*ptr) { switch (toupper (*ptr)) { case 'G': local_mode |= 1; break; case 'B': local_mode |= 2; break; case 'Y': local_mode |= 4; break; case 'U': break; default: #ifdef ENGLISH errport (lig, "Wrong port mode "); #else errport (lig, "Mode du port erron"); #endif return; } ++ptr; } i = NBVOIES; while (p2) { if (--i == 0) break; if (no_port (i) == p1) { svoie[i]->sta.callsign.num = extind (sfreq, svoie[i]->sta.callsign.call); svoie[i]->localmode = local_mode; #ifdef ENGLISH cprintf ("Channel %d on %s \r\n", i, sfreq); #else cprintf ("Voie %d affectee a %s\r\n", i, sfreq); #endif --p2; } } break; case 5: break; } } for (voie = 0; voie < NBVOIES; voie++) { svoie[voie]->paclen = p_port[no_port (voie)].pk_t; } #ifdef ENGLISH cprintf ("%d channels ok \r\n", nbvalid); #else cprintf ("%d voies valides\r\n", nbvalid); #endif MWARNING = NBVOIES; init_voie (MWARNING); ferme (fptr, 6); attend_caractere (1); } static void errport (int lig, char *texte) { #ifdef __FBBDOS__ #ifdef ENGLISH cprintf ("Error file PORT.SYS line %d : \r\n< %s >\r\n\a", lig, texte); #else cprintf ("Erreur fichier PORT.SYS ligne %d : \r\n< %s >\r\n\a", lig, texte); #endif attend_caractere (10); #endif #if defined(__WINDOWS__) || defined(__LINUX__) char msg[80]; #ifdef ENGLISH sprintf (msg, "Error file PORT.SYS line %d : \n< %s >", lig, texte); #else sprintf (msg, "Erreur fichier PORT.SYS ligne %d : \n< %s >", lig, texte); #endif WinMessage (5, msg); #endif fbb_error (ERR_SYNTAX, c_disque ("PORT.SYS"), lig); } static void err_fic (char *nomfic, int ligne, char *texte) { #ifdef __FBBDOS__ cprintf ("\r\n%s (%d) : %s\r\n\a", nomfic, ligne, texte); attend_caractere (10); #endif #if defined(__WINDOWS__) || defined(__LINUX__) char msg[80]; sprintf (msg, "%s (%d) :\n%s", nomfic, ligne, texte); WinMessage (0, msg); #endif fbb_error (ERR_SYNTAX, nomfic, ligne); } static unsigned int tail_lang = 0; void end_textes (void) { int cpt; if (langue == NULL) return; m_libere (nomlang, LG_LANG * maxlang); for (cpt = 0; cpt < NBLANG; cpt++) { m_libere (langue[cpt]->plang[0], tail_lang); m_libere (langue[cpt], sizeof (tlang)); } m_libere (langue, NBLANG * sizeof (tlang *)); langue = NULL; vlang = -1; } void initexte (void) { int cpt, nb, niv, nbc, ligne; unsigned int taille = 0; FILE *fptr; char s[81], nomfic[81]; #ifdef __FBBDOS__ fen *fen_ptr; #endif ligne = niv = 0; strcpy (nomfic, "LANGUE.SYS"); if ((fptr = fopen (c_disque (nomfic), "rt")) == NULL) { #ifdef ENGLISH err_fic (nomfic, ligne, "File LANGUE.SYS not found "); #else err_fic (nomfic, ligne, "Erreur ouverture LANGUE.SYS"); #endif return; } #ifdef ENGLISH cprintf ("Texts set-up \r\n"); #else cprintf ("Initialisation des textes\r\n"); #endif nbc = cpt = 0; #ifdef ENGLISH strcpy (s, " Texts set-up "); #else strcpy (s, "Initialisation des textes"); #endif #ifdef __FBBDOS__ fen_ptr = open_win (10, 6, 60, 16, INIT, s); #endif while (fgets (s, 80, fptr)) { ++ligne; if (*s == '#') continue; switch (niv) { case 0: if (isdigit (*s)) { nb = sscanf (s, "%d %d %d", &nbc, &NBLANG, &deflang); if (nb != 3) { deflang = 0; NBLANG = 3; } if (deflang > nbc) deflang = 0; else deflang--; /* if (NBLANG < 2) NBLANG = 2 ; */ if (NBLANG > nbc) NBLANG = nbc; if (nbc < 1) #ifdef ENGLISH err_fic (nomfic, ligne, "Error languages number "); #else err_fic (nomfic, ligne, "Erreur nombre de langues"); #endif } else #ifdef ENGLISH err_fic (nomfic, ligne, "Error : No languages number"); #else err_fic (nomfic, ligne, "Manque nombre de langues "); #endif ++niv; nomlang = (char *) m_alloue (LG_LANG * nbc); #ifdef ENGLISH cprintf ("%d language buffers allocated\r\n", NBLANG); #else cprintf ("%d buffers langue allous \r\n", NBLANG); #endif break; case 1: if (!ISPRINT (*nomfic)) break; strn_cpy (LG_LANG - 1, nomlang + cpt * LG_LANG, sup_ln (s)); #ifdef __WINDOWS__ InitText (nomlang + cpt * LG_LANG); #endif #ifdef __FBBDOS__ cprintf ("\r\n%8s ", nomlang + cpt * LG_LANG); #endif #ifdef __LINUX__ printf ("Init lang %8s\n", nomlang + cpt * LG_LANG); #endif nb = lang_len (nomlang + cpt * LG_LANG); if (taille < nb) taille = nb; if (++cpt == nbc) ++niv; break; } if (niv == 2) break; } fclose (fptr); maxlang = cpt; tail_lang = taille; /* Alloue les NBLANG buffers de pointeurs et de textes */ langue = (tlang * *)m_alloue (NBLANG * sizeof (tlang *)); for (cpt = 0; cpt < NBLANG; cpt++) { langue[cpt] = (tlang *) m_alloue (sizeof (tlang)); langue[cpt]->plang[0] = (char *) m_alloue (taille); langue[cpt]->numlang = -1; } swap_langue (0, deflang); #ifdef __FBBDOS__ close_win (fen_ptr); #endif } static int lang_len (char *nom_lang) { char nomfic[81]; char texte[81]; char chaine[300]; int nb, taille; FILE *fpl; sprintf (nomfic, "LANG\\%s.TXT", nom_lang); if ((fpl = fopen (c_disque (nomfic), "rb")) == NULL) { #ifdef ENGLISH sprintf (chaine, "File %s not found", nomfic); #else sprintf (chaine, "Erreur fichier %s", nomfic); #endif err_fic (nomfic, 0, chaine); } taille = (size_t) 0; nb = 0; while (fgets (chaine, 257, fpl)) { if ((*chaine == '#') || (*chaine == '\0') || (*chaine == '\032')) continue; taille += (unsigned int) strlen (chaine); if (++nb > NBTEXT) break; #ifdef __FBBDOS__ if ((nb % 10) == 0) putch ('.'); #endif } if (nb != NBTEXT) { #ifdef ENGLISH sprintf (texte, "Wrong line number : need %d - found %d ", NBTEXT, nb); #else sprintf (texte, "Nombre de lignes incorrect : attendu %d - trouve %d", NBTEXT, nb); #endif err_fic (nomfic, nb, texte); } fclose (fpl); return (taille + 256); } void swap_langue (int num_buf, int num_lang) { char nomfic[81]; char chaine[300]; char *txt_ptr; int nb; FILE *fpl; #ifdef __FBBDOS__ fen *fen_ptr; #endif if (langue[num_buf]->numlang == num_lang) return; txt_ptr = langue[num_buf]->plang[0]; sprintf (nomfic, "LANG\\%s.TXT", nomlang + num_lang * LG_LANG); if ((fpl = fopen (c_disque (nomfic), "rb")) == NULL) { #ifdef ENGLISH sprintf (chaine, "File %s not found", nomfic); #else sprintf (chaine, "Erreur fichier %s", nomfic); #endif err_fic (nomfic, 0, chaine); } deb_io (); #ifdef __FBBDOS__ #ifdef ENGLISH fen_ptr = open_win (55, 4, 75, 6, INIT, " Text "); #else fen_ptr = open_win (55, 4, 75, 6, INIT, "Textes"); #endif #endif cprintf ("%s", nomlang + num_lang * LG_LANG); nb = 0; while (fgets (chaine, 257, fpl)) { sup_ln (chaine); if ((*chaine == '#') || (*chaine == '\0')) continue; #ifdef __FBBDOS__ if ((nb % 50) == 0) putch ('.'); #endif strcpy (txt_ptr, chaine); langue[num_buf]->plang[nb] = txt_ptr; txt_ptr += strlen (chaine) + 1; ++nb; if (nb > NBTEXT) break; } fclose (fpl); langue[num_buf]->numlang = num_lang; #ifdef __FBBDOS__ close_win (fen_ptr); #endif fin_io (); } void read_heard (void) { int i; FILE *fptr; if ((fptr = fopen (d_disque ("HEARD.BIN"), "rb")) != NULL) { for (i = 0; i < NBPORT; i++) { fread (p_port[i].heard, sizeof (Heard), NBHEARD, fptr); } fclose (fptr); } } void write_heard (void) { int i; FILE *fptr; if (p_port == NULL) return; if ((fptr = fopen (d_disque ("HEARD.BIN"), "wb")) != NULL) { for (i = 0; i < NBPORT; i++) { fwrite (p_port[i].heard, sizeof (Heard), NBHEARD, fptr); } fclose (fptr); } } fbb-7.04j/src/k_tasks.c0100644000175100017510000006542007726646105013020 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Taches auxilliaires demandees par le noyau * */ #include #include #include /* Timer head */ static FbbTimer *timer_head = NULL; static int inbuf_bin (int); static int inbuf_xmodem (int); static int inbuf_yapp (int); static int nb_buf (int); static int trait_buf (int); /* void mail_in (void); */ static void tst_buf (int); static int tst_minfwd (int, int); /* Horloge ticker */ long btime (void) { static long oldtime = 0L; static long offset = 0L; long bt; #ifdef __WINDOWS__ struct time dt; gettime (&dt); bt = (((long) dt.ti_hour * 3600L + (long) dt.ti_min * 60L + (long) dt.ti_sec) << 14) / 900L; bt += (((long) dt.ti_hund * 10) << 16) / 3600000L; if (bt > 0x17ffffL) bt = 0x17ffffL; bt += offset; while (bt < oldtime) { /* Le jour a change... */ offset += 0x180000L; bt += 0x180000L; } // WinDebug("bt = %ld\r\n", bt); #endif #ifdef __FBBDOS__ bt = get_ticker (); #endif #ifdef __LINUX__ struct timeval tv; struct timezone tz; gettimeofday (&tv, &tz); bt = ((tv.tv_sec % 86400L) << 16) / 3600L; bt += ((tv.tv_usec / 1000) << 16) / 3600000L; if (bt > 0x17ffffL) bt = 0x17ffffL; bt += offset; while (bt < oldtime) { /* Le jour a change... */ offset += 0x180000L; bt += 0x180000L; } #endif oldtime = bt; return (bt); } void k_tasks (void) { int port, hour, min; int min_arret; int i; long caltemps; Forward *pfwd; static long balprec[NBPORT]; df ("k_tasks", 0); #ifdef __FBBDOS__ if (video_off == 3) blank_screen (); #endif if (dde_wp_serv) { wp_server (); } #ifdef __FBBDOS__ test_kb (); #endif #ifdef __WIN32__ CheckTasks (); #endif if (aff_use == 0) { free_use (); aff_use = -1; } if (throute) { hupdate (); } if ((p_forward) && (!svoie[CONSOLE]->sta.connect)) { maj_fwd (); } /* Horloge minutes */ time (&caltemps); min = minute (caltemps); hour = heure (caltemps); if (time_bcl == 0) { aff_etat ('Y'); broadcast_list (); time_bcl = def_time_bcl; } /* On force l'arret a H+15 */ min_arret = min - stop_min; if (min_arret < 0) min_arret += 60; if ((save_fic) && ((!actif (0)) || (min_arret >= 15))) { if (min != stop_min) { aff_etat ('Y'); maintenance (); /* reboot serveur */ #ifdef __WINDOWS__ fbb_quit (type_sortie); return; #else exit (type_sortie); #endif } } for (port = 0; port < NBPORT; port++) { if (save_fic) break; if (p_port[port].pvalid) { pfwd = p_port[port].listfwd; while (pfwd) { if (pfwd->forward == -1) { aff_etat ('F'); appel_fwd (pfwd, port); } pfwd = pfwd->suite; } } } if (test_fichiers) { aff_etat ('Y'); test_fichiers = 0; /* Test des fichiers systeme */ init_bbs (); test_buf_fwd (); init_buf_swap (); init_buf_rej (); load_themes (); test_message = 2; } if ((caltemps / 60) != timeprec) { /* Toutes les minutes */ aff_etat ('Y'); timeprec = caltemps / 60; aff_nbsta (); ferme_log (); /* Flush du log toutes les minutes */ if ((!editor) && (blank > 0)) { if (--blank == 0) video_off = 3; } nb_error = 0; /* fflush (log_ptr); */ #ifdef __FBBDOS__ { /* Test des espaces disque */ struct dfree free; int sdisk = 0; long k_cluster; if (DISK[1] == ':') { sdisk = DISK[0] - '@'; getdfree (sdisk, &free); } else { sdisk = getdisk () + 1; getdfree (sdisk, &free); } k_cluster = ((long) free.df_sclus * (long) free.df_bsec) / 1024L; sys_disk = free.df_avail * k_cluster; if ((sdisk) && (MBIN[1] == ':') && (MBIN[0] != DISK[0])) { k_cluster = ((long) free.df_sclus * (long) free.df_bsec) / 1024L; sdisk = MBIN[0] - '@'; getdfree (sdisk, &free); tmp_disk = free.df_avail * k_cluster; } else tmp_disk = sys_disk; } if (ch_fen) { maj_fen (); } #endif aff_date (); env_date (); init_bbs (); if (hour != hour_time) { hour_time = hour; cron (caltemps); send_wp_mess (); } if ((hour == h_maint) && (min == 0)) { house_keeping (); } #ifdef __WINDOWS__ if (!WindowService ()) #endif mail_in (); /* if (p_forward == 0) test_buf_fwd(); */ init_hold (); init_buf_swap (); init_buf_rej (); load_themes (); aff_msg_cons (); for (port = 0; port < NBPORT; port++) { if (save_fic) break; if (!p_port[port].pvalid) continue; if (tst_minfwd (min, port)) { for (i = 0; i < NBMASK; i++) p_port[port].fwd[i] = '\0'; pfwd = p_port[port].listfwd; while (pfwd) { if ((pfwd->forward == 0) && (ch_voie (port, 0) != -1)) { *pfwd->fwdbbs = '\0'; pfwd->forward = -1; pfwd->fwdpos = 0; pfwd->fin_fwd = pfwd->cptif = pfwd->fwdlig = 0; pfwd->reverse = 0; } if (pfwd->forward == -1) { if (pfwd->fwdpos == 0xffff) pfwd->forward = 0; else { aff_etat ('F'); appel_fwd (pfwd, port); } } pfwd = pfwd->suite; } } if (t_balise[port] == 0) continue; if (caltemps / t_balise[port] != balprec[port]) { balprec[port] = caltemps / t_balise[port]; if (!arret) { send_balise (port); } } } } ff (); } static int extern_task (int voie) { if ((svoie[voie]->niv1 == N_MOD) && ((svoie[voie]->niv3 == XS_EXTERN) || (svoie[voie]->niv3 == XR_EXTERN))) return 1; #ifdef __WINDOWS__ if (editor_on ()) return (1); #endif return (0); } static int off_time (void) { static long prec_time = 0L; long diff_time; df ("off_time", 0); if (prec_time == 0L) prec_time = time (NULL); diff_time = time (NULL) - prec_time; prec_time += diff_time; ff (); return ((int) diff_time); } int del_timer (FbbTimer * timer_id) { FbbTimer *tt = timer_head; FbbTimer *pr = NULL; while (tt) { if (tt == timer_id) { if (pr) { pr->next = tt->next; m_libere (tt, sizeof (FbbTimer)); } else { timer_head = tt->next; m_libere (tt, sizeof (FbbTimer)); } return (1); } pr = tt; tt = tt->next; } return (0); } FbbTimer *add_timer (int delay, int port, void FAR * fct, void *userdata) { FbbTimer *tt = timer_head; if (tt) { while (tt->next) tt = tt->next; tt->next = (FbbTimer *) m_alloue (sizeof (FbbTimer)); tt = tt->next; } else tt = timer_head = (FbbTimer *) m_alloue (sizeof (FbbTimer)); tt->next = NULL; tt->userdata = userdata; tt->port = port; tt->temps = (delay * 182) / 10; tt->fct = fct; return (tt); } static void fbb_timer (void) { static long bprec = -1; long bt; FbbTimer *tt; FbbTimer *pr; long delta; bt = btime (); delta = bt - bprec; if (delta == 0) return; bprec = bt; tt = timer_head; pr = NULL; while (tt) { if (tt->temps >= (time_t) delta) tt->temps -= (time_t) delta; else tt->temps = 0L; if (tt->temps == 0L) { if (tt->fct) (*tt->fct) (tt->port, tt->userdata); /* Supprimer le timer */ del_timer (tt); break; /*if (pr) tt = pr->next; else tt = timer_head; */ } else { pr = tt; tt = tt->next; } } } void user_time_out (void) { int voie; int port; int com; int dt = off_time (); fbb_timer (); if (dt == 0) return; df ("user_time_out", 0); /* System timers */ if (t_tell > 0) { t_tell -= (18 * dt); if (t_tell < 0) t_tell = 0; } if (time_bcl > 0) { time_bcl -= (18 * dt); if (time_bcl < 0) time_bcl = 0; } for (com = 0; com < NBPORT; com++) { if (p_com[com].baud) p_com[com].delai += dt; } for (port = 0; port < NBPORT; port++) { if ((p_port[port].pvalid) && (p_port[port].stop > 0)) { if (p_port[port].stop > dt) p_port[port].stop -= dt; else p_port[port].stop = 0; } } for (voie = 0; voie < NBVOIES; voie++) { if ((!extern_task (voie)) && (svoie[voie]->sta.connect) && ((voie != CONSOLE) || (!editor))) { if (time_att[voie] > 0) { time_att[voie] -= dt; if (time_att[voie] <= 0) { time_att[voie] = 0; if (svoie[voie]->nb_err == 10) { /* Voie bloquee -> Liberation d'office */ svoie[voie]->deconnect = svoie[voie]->sta.connect = FALSE; svoie[voie]->niv1 = svoie[voie]->niv2 = svoie[voie]->niv3 = 0; } else { svoie[voie]->deconnect = 2; svoie[voie]->nb_err = 10; traite_voie (voie); } } } if (time_yapp[voie] > 0) { time_yapp[voie] -= dt; if (time_yapp[voie] < 0) time_yapp[voie] = 0; } } } ff (); } void mail_in (void) { struct stat buf; if ((!is_room ()) || (svoie[INEXPORT]->sta.connect) || (inexport)) return; df ("mail_in", 0); mail_ch = INEXPORT; /* if (access (MAILIN, 0) == 0) */ if (stat (MAILIN, &buf) == 0) { init_etat (); selvoie (mail_ch); strcpy (pvoie->sta.indicatif.call, mycall); pvoie->sta.indicatif.num = 0; pvoie->enrcur = 0L; pvoie->mode = F_FOR; pvoie->fbb = 0; pvoie->mbl_ext = 0; pvoie->prot_fwd = FWD_MBL; pvoie->finf.lang = langue[0]->numlang; pvoie->ncur = &def_cur; pvoie->tstat = pvoie->debut = time (NULL); pvoie->tmach = 0L; strcpy (io_fich, MAILIN); pvoie->sta.connect = inexport = 4; /* Apres console_on ! */ aff_event (mail_ch, 1); maj_niv (N_MBL, 99, 0); #ifdef __WINDOWS__ window_connect (voiecur); #endif aff_nbsta (); } ff (); } int mail_out (char *fichier) { if ((svoie[INEXPORT]->sta.connect) || (inexport)) return (0); df ("mail_out", 2); mail_ch = INEXPORT; selvoie (mail_ch); n_cpy (256, io_fich, strlwr(fichier)); strcpy (pvoie->sta.indicatif.call, "MAIL"); pvoie->sta.indicatif.num = 0; aff_event (mail_ch, 1); pvoie->sta.connect = inexport = 4; pvoie->enrcur = 0L; pvoie->tstat = pvoie->debut = time (NULL); pvoie->tmach = 0L; pvoie->mode = F_FOR | F_HIE | F_BID | F_MID; pvoie->finf.lang = langue[0]->numlang; pvoie->ncur = &def_cur; maj_niv (N_MBL, 98, 0); #ifdef __WINDOWS__ window_connect (voiecur); #endif aff_nbsta (); ff (); return (1); } int voie_forward (int voie) { int port; Forward *pfwd; df ("voie_forward", 1); if (voie != CONSOLE) { for (port = 1; port < NBPORT; port++) { if (p_port[port].pvalid) { pfwd = p_port[port].listfwd; while (pfwd) { if (pfwd->forward == voie) { ff (); return (1); } pfwd = pfwd->suite; } } } } ff (); return (0); } int tst_minfwd (int min, int noport) { int test = p_port[noport].min_fwd; int inc = 0; df ("tst_minfwd", 2); while (inc < 60) { if (test == min) { ff (); return (1); } inc += p_port[noport].per_fwd; test += p_port[noport].per_fwd; if (test >= 60) test -= 60; } ff (); return (0); } indicat *get_indic (char *chaine) { int c = 0; int nb = 0; char *ptr; static indicat indic; df ("get_indic", 2); ptr = indic.call; while (isalnum (*chaine)) { *ptr++ = toupper (*chaine); ++chaine; if (++nb == 6) break; } *ptr = '\0'; if (*chaine++ == '-') c = atoi (chaine); indic.num = c; ff (); return (&indic); } void add_heard (int port, indicat * indic) { int i; long date = 0x7fffffffL; Heard *pobs = NULL; Heard *pheard = p_port[port].heard; df ("add_heard", 3); for (i = 0; i < NBHEARD; i++) { if ((pheard->last) && (strcmp (pheard->indic.call, indic->call) == 0) && (pheard->indic.num == indic->num)) { pheard->last = time (NULL); ++pheard->nb; ff (); return; } if (date > pheard->last) { date = pheard->last; pobs = pheard; } ++pheard; } pobs->indic = *indic; pobs->first = pobs->last = time (NULL); pobs->nb = 1; ff (); } static void tst_buf (int voie) { df ("tst_buf", 0); if ((svoie[voie]->memoc <= MAXMEM / 2) && (svoie[voie]->sr_mem)) { ptype = SN; if (debug_on) { fprintf (debug_fptr, "Tst_buf : %d\n", svoie[voie]->memoc); } traite_voie (voie); } ff (); } static int nb_buf (int voie) { int port = no_port (voie); int nb = (int) p_port[port].frame * 2; df ("nb_buf", 1); switch (p_port[port].typort) { case TYP_PK: case TYP_KAM: if (nb > 6) nb = 6; break; case TYP_DED: if (svoie[voie]->sta.mem < 100) nb /= 2; break; case TYP_FLX: /* if (svoie[voie]->sta.mem < 8) nb /= 2; if (nb > 7) */ nb = 7; break; case TYP_BPQ: if (svoie[voie]->sta.mem < 60) nb /= 2; break; #ifdef __WIN32__ case TYP_MOD: nb = 50; break; #endif } ff (); return (nb); } int ack_suiv (int voie) { int nblig, n_buf, vide = TRUE, retour = 0; int ch_status; int port = no_port (voie); stat_ch sta; /* Etat de la voie */ stat_ch sta_new; /* Etat de la voie */ df ("ack_suiv", 1); ch_status = svoie[voie]->ch_status; sta_new = sta = svoie[voie]->sta; #ifdef __WINDOWS__ if (ETHER (no_port (voie))) { sta_new.ack = tcp_busy (voie); svoie[voie]->sta = sta_new; if (memcmp (&sta, &sta_new, sizeof (stat_ch)) != 0) ch_status = 1; } else #endif if (sta_drv (voie, TNCSTAT, &sta_new)) { if (svoie[voie]->sta.ack != sta_new.ack) ch_status = 1; if (svoie[voie]->sta.ret != sta_new.ret) ch_status = 1; svoie[voie]->sta = sta_new; /*if (memcmp(&sta, &sta_new, sizeof(stat_ch)) != 0) ch_status = 1; */ } if (svoie[voie]->outptr == NULL) svoie[voie]->aut_nc = 0; if (svoie[voie]->dde_int) interruption (voie); svoie[voie]->maxbuf = nb_buf (voie); if (voie == CONSOLE) svoie[voie]->sta.ack = 0; if (svoie[voie]->ask) { svoie[voie]->ask = 0L; traite_voie (voie); } #ifdef __LINUX__ /* dprintf("bin = %d\n", svoie[voie]->binary); */ if (svoie[voie]->binary == 2) { #if 0 /* Process en FORK */ char buffer[300]; int fd = svoie[voie]->to_xfbb[0]; int nb; int old = fcntl (fd, F_GETFL, 0); (void) fcntl (fd, F_SETFL, old | O_NDELAY); do { nb = read (fd, buffer, 300); if (nb < 0) { perror ("read"); nb = 0; } if (nb) { int i; dprintf ("Recu %d carac de rszs (fd = %d)\n", nb, fd); for (i = 0; i < nb; i++) dprintf ("%02x ", buffer[i] & 0xff); dprintf ("\n"); selvoie (voie); outs (buffer, nb); } if (svoie[voie]->memoc >= MAXMEM) { /* pvoie->sr_mem = TRUE; */ break; } } while (nb > 0); (void) fcntl (fd, F_SETFL, old); #endif } #endif if ((svoie[voie]->sta.ack) || (svoie[voie]->outptr)) { if (!svoie[voie]->sta.connect) { clear_outbuf (voie); svoie[voie]->sta.ack = 0; } else { if ((svoie[voie]->stop) && ((nblig = lig_bufi (voie)) != 0)) { trait_buf (voie); if (nblig != lig_bufi (voie)) prog_more (voie); } if (!svoie[voie]->stop) { int aff_status = 1; /* status(voie) ; */ if ((voie == CONSOLE) || (DEBUG) || (!p_port[port].pvalid)) { n_buf = svoie[voie]->maxbuf; while ((!svoie[voie]->stop) && (svoie[voie]->outptr) && (n_buf--)) { if (aff_status) { aff_etat ('K'); aff_status = 0; init_timout (voie); ch_status = 1; vide = FALSE; } aff_etat ('E'); send_buf (voie); tst_buf (voie); } } else { int lettre = 0; while ((!svoie[voie]->stop) && (svoie[voie]->outptr) && (svoie[voie]->sta.ack < svoie[voie]->maxbuf) && (min_ok (voie))) { if (lettre == 0) { lettre = aff_etat ('E'); } if (aff_status) { aff_etat ('K'); aff_status = 0; init_timout (voie); ch_status = 1; vide = FALSE; } if (send_buf (voie) == 0) break; tst_buf (voie); aff_etat (lettre); } /* Repasse le TNC en reception */ if ((svoie[voie]->seq == 0) && (svoie[voie]->pack) && (svoie[voie]->t_tr == 0) && (svoie[voie]->outptr == NULL)) { tor_stop (voie); svoie[voie]->pack = 0; } } } retour = 1; } } if (ch_status) status (voie); if (vide) aff_etat ('A'); ff (); return (retour); } int inbuf_ok (int voie) { df ("inbuf_ok", 1); nb_trait = 0; if (svoie[voie]->binary) { switch (svoie[voie]->niv1) { case N_YAPP: case N_FORW: ff (); return (inbuf_yapp (voie)); case N_MOD: ff (); return (inbuf_xmodem (voie)); case N_BIN: case N_XFWD: ff (); return (inbuf_bin (voie)); } } else { if (((v_tell) && (v_tell == voie) && (t_tell == 0)) || ((svoie[voie]->inbuf.nblig) && (!svoie[voie]->outptr)) || (svoie[voie]->deconnect > 0)) { if ((svoie[voie]->sta.connect == 0) && (svoie[voie]->deconnect == 0)) clear_inbuf (voie); ff (); return (1); } } ff (); return (0); } int inbuf_bin (int voie) { int nb; df ("inbuf_xmodem", 1); nb = svoie[voie]->inbuf.nbcar; if (svoie[voie]->enrcur + (long) nb > svoie[voie]->tailm) nb_trait = (int) (svoie[voie]->tailm - svoie[voie]->enrcur); else nb_trait = nb; if (nb_trait == 0) { ff (); return (0); } ff (); return (1); } int inbuf_xmodem (int voie) { df ("inbuf_xmodem", 1); if ((nb_trait = svoie[voie]->inbuf.nbcar) == 0) { ff (); return (0); } ff (); return (1); } int inbuf_yapp (int voie) { char *ptr; lbuf *bptr; int nb, fct, ext; df ("inbuf_yapp", 1); if ((nb = svoie[voie]->inbuf.nbcar) < 2) { if (time_yapp[voie] == 0) { nb_trait = 0; ptype = TM; time_yapp[voie] = -1; ff (); return (1); } else { ff (); return (0); } } ptr = svoie[voie]->inbuf.tete->buffer + svoie[voie]->inbuf.nocar; fct = *ptr++ & 0xff; if ((svoie[voie]->inbuf.tete->lgbuf - svoie[voie]->inbuf.nocar) == 1) { if (svoie[voie]->inbuf.tete->suite == NULL) { cprintf ("suite nul - nocar %d - lgbuf %d - nbcar %d c1 %d c2 %d %s\r\n\n\n", svoie[voie]->inbuf.nocar, svoie[voie]->inbuf.tete->lgbuf, svoie[voie]->inbuf.nbcar, *(ptr - 2) & 0xff, *(ptr - 1) & 0xff, svoie[voie]->sta.indicatif.call); } if (svoie[voie]->inbuf.tete->suite->buffer == NULL) { cprintf ("buffer nul - nocar %d - lgbuf %d - nbcar %d c1 %d c2 %d %s\r\n\n\n", svoie[voie]->inbuf.nocar, svoie[voie]->inbuf.tete->lgbuf, svoie[voie]->inbuf.nbcar, *(ptr - 2) & 0xff, *(ptr - 1) & 0xff, svoie[voie]->sta.indicatif.call); } ext = *(svoie[voie]->inbuf.tete->suite->buffer) & 0xff; } else ext = *ptr & 0xff; ptype = UK; switch (fct) { case ACK: nb_trait = 2; switch (ext) { case 1: ptype = RR; svoie[voie]->time_trans = time (NULL); break; case 2: ptype = RF; svoie[voie]->time_trans = time (NULL); svoie[voie]->type_yapp = 0; break; case 3: ptype = AF; break; case 4: ptype = AT; break; case 5: ptype = CA; break; case ACK: ptype = RF; svoie[voie]->type_yapp = 1; break; } break; case ENQ: nb_trait = 2; switch (ext) { case 1: ptype = SI; break; case 2: ptype = RI; break; } break; case SOH: nb_trait = (int) ext + 2; ptype = HD; break; case STX: nb_trait = (ext) ? (int) ext + 2 : 258; if (svoie[voie]->type_yapp) ++nb_trait; ptype = DT; break; case ETX: nb_trait = 2; if (ext == 1) ptype = EF; break; case EOT: nb_trait = 2; /*if (ext == 1) */ ptype = ET; break; case NAK: nb_trait = ext + 2; ptype = NR; break; case CAN: nb_trait = ext + 2; ptype = CN; break; case DLE: nb_trait = ext + 2; ptype = TX; break; default: --svoie[voie]->inbuf.nbcar; if (++svoie[voie]->inbuf.nocar == svoie[voie]->inbuf.tete->lgbuf) { bptr = svoie[voie]->inbuf.tete->suite; /* svoie[voie]->memoc -= svoie[voie]->inbuf.tete->lgbuf ; */ m_libere ((char *) svoie[voie]->inbuf.tete->buffer, svoie[voie]->inbuf.tete->lgbuf); m_libere ((char *) svoie[voie]->inbuf.tete, sizeof (lbuf)); svoie[voie]->inbuf.tete = bptr; svoie[voie]->inbuf.nocar = 0; } nb_trait = 0; ff (); return (0); } if (nb < nb_trait) { if (time_yapp[voie] == 0) { nb_trait = 0; ptype = TM; time_yapp[voie] = -1; ff (); return (1); } ff (); return (0); } if (svoie[voie]->kiss == -2) init_timout (CONSOLE); if (ptype == TX) { trait_buf (voie); out_txt (); ff (); return (0); } ff (); return (1); } /* * Recopie dans data une ligne d'un max de 300 caracteres a traiter et * retourne le nb de caracteres a traiter */ int trait_buf (int voie) { char *ptri; char *ptro = data; lbuf *bptr; int c, nb, nbtot, fin; FScreen *screen = &conbuf; df ("trait_buf", 1); fin = nbtot = 0; if ((svoie[voie]->binary) && (nb_trait == 0)) { ff (); return (0); } while ((!fin) && (svoie[voie]->inbuf.tete)) { ptri = svoie[voie]->inbuf.tete->buffer + svoie[voie]->inbuf.nocar; /* recopie buffer dans buffer de datas */ nb = svoie[voie]->inbuf.tete->lgbuf - svoie[voie]->inbuf.nocar; while (nb) { c = *ptri++; --svoie[voie]->inbuf.nbcar; ++svoie[voie]->inbuf.nocar; nb--; if ((svoie[voie]->binary) || (c != '\n')) { *ptro++ = c; ++nbtot; if (svoie[voie]->binary) { if (c == '\r') --svoie[voie]->inbuf.nblig; if (--nb_trait == 0) { fin = 1; break; } } else { if (c == '\r') { /* Sortie si fin de ligne */ --svoie[voie]->inbuf.nblig; fin = 1; if ((voie == CONSOLE) && (screen->totlig)) { data[nbtot] = '\0'; #ifdef __FBBDOS__ inputs (CONSOLE, W_CNST, data); #endif } break; } } if (nbtot == DATABUF) { fin = 1; break; } } } if (nb == 0) { bptr = svoie[voie]->inbuf.tete->suite; /* svoie[voie]->memoc -= svoie[voie]->inbuf.tete->lgbuf ; */ m_libere ((char *) svoie[voie]->inbuf.tete->buffer, svoie[voie]->inbuf.tete->lgbuf); m_libere ((char *) svoie[voie]->inbuf.tete, sizeof (lbuf)); svoie[voie]->inbuf.tete = bptr; svoie[voie]->inbuf.nocar = 0; } } *ptro = '\0'; ff (); return (nbtot); } void traite_voie (int voie) { /* char *ptr = s ; */ int nbuf, mode; long debtrait; df ("traite_voie", 1); aff_etat ('T'); selvoie (voie); init_timout (voie); if (pvoie->sta.connect) init_langue (voie); status (voie); if ((voie == INEXPORT) && (inexport)) { aff_traite (voiecur, TRUE); time (&debtrait); premier_niveau (); pvoie->tmach += time (NULL) - debtrait; aff_traite (voiecur, FALSE); vlang = 0; free_mem (); ff (); return; } if (pvoie->deconnect) clear_inbuf (voie); if (tot_mem > 5000L) { if ((!pvoie->binary) && (!svoie[CONSOLE]->sta.connect)) { aff_header (voie); } if ((!pvoie->deconnect) && (pvoie->sta.connect) && (voie >= 0) && (voie < NBVOIES)) { if ((!pvoie->seq) && (!pvoie->sr_mem)) prog_more (voie); if (!pvoie->stop) { if ((!pvoie->sr_mem) && (!pvoie->seq)) { nb_trait = trait_buf (voie); } else nb_trait = 0; if (aff_ok(voiecur)) { deb_io (); aff_bas (voiecur, W_RCVT, data, nb_trait); fin_io (); } aff_traite (voiecur, TRUE); time (&debtrait); if ((voie == CONSOLE) && (print)) { #if defined(__WINDOWS__) || defined(__LINUX__) SpoolLine (voie, W_RCVT, data, strlen (data)); #else fputs (data, file_prn); if (data[nb_trait - 1] == '\r') fputc ('\n', file_prn); #endif } if (pvoie->dde_marche) en_navant_toute (); else { indd = data; pvoie->t_tr = 1; #ifdef COMPUTE deb_compute (); #endif premier_niveau (); #ifdef COMPUTE end_compute (); #endif pvoie->t_tr = 0; data[0] = '\0'; nbuf = pvoie->maxbuf; while ((nbuf-- > 0) && (pvoie->sta.ack < 4) && (pvoie->outptr) && (min_ok (voie))) { send_buf (voie); } } pvoie->tmach += time (NULL) - debtrait; aff_traite (voiecur, FALSE); } /* Repasse le TNC en reception */ if ((pvoie->seq == 0) && (pvoie->pack) && (pvoie->t_tr == 0) && (pvoie->outptr == NULL)) { tor_stop (voiecur); pvoie->pack = 0; } } } if (pvoie->deconnect > 0) { switch (pvoie->deconnect) { case 1: if ((!voie_forward (voie)) && (voie != CONSOLE) && (!P_GUEST (voie)) && /* (EXP(pvoie->finf.flags) == 0) && */ (BBS (pvoie->finf.flags) == 0) && (FOR (pvoie->mode) == 0) ) { texte (T_MES + 12); aff_etat ('E'); send_buf (voie); } fbb_log (voiecur, 'X', "B"); pvoie->log = 0; if (pvoie->deconnect == 1) mode = bpq_deconnect; else mode = 1; deconnexion (voie, mode); break; case 2: texte (T_ERR + 31); aff_etat ('E'); send_buf (voie); fbb_log (voiecur, 'X', "T"); pvoie->log = 0; force_deconnexion (voie, 1); break; case 3: fbb_log (voiecur, 'X', "F"); pvoie->log = 0; force_deconnexion (voie, 1); break; case 4: fbb_log (voiecur, 'X', "M"); pvoie->log = 0; force_deconnexion (voie, 1); break; case 5: fbb_log (voiecur, 'X', "P"); pvoie->log = 0; force_deconnexion (voie, 1); break; case 6: fbb_log (voiecur, 'X', "B"); pvoie->log = 0; if (pvoie->deconnect == 1) mode = bpq_deconnect; else mode = 1; deconnexion (voie, mode); break; case 7: outln ("Sorry, no more channels available", 33); aff_etat ('E'); send_buf (voie); pvoie->log = 0; force_deconnexion (voie, 1); break; default: fbb_log (voiecur, 'X', "?"); pvoie->log = 0; force_deconnexion (voie, 1); break; } pvoie->deconnect = -1; } vlang = 0; free_mem (); aff_etat ('A'); ff (); } void premier_niveau (void) { df ("premier_niveau", 0); /* Task identifier */ ++tid; switch (pvoie->niv1) { case N_MENU: menu_principal (); break; #ifndef MINISERV case N_QRA: qraloc (); break; case N_STAT: statistiques (); break; case N_INFO: documentations (); break; case N_NOMC: nomenclature (); break; case N_TRAJ: trajec (); break; #endif case N_DOS: dos (); break; case N_MOD: modem (); break; case N_BIN: bin_transfer (); break; case N_MBL: mbl_emul (); break; case N_FORW: fwd (); break; case N_TELL: duplex_tnc (); break; case N_YAPP: yapp (); break; case N_CONF: conference (); break; case N_RBIN: send_bin_message (); break; case N_THEMES: themes (); break; case N_XFWD: xfwd (); break; default: fbb_error (ERR_NIVEAU, "KERNEL", pvoie->niv1); break; } ff (); } fbb-7.04j/src/kernel.c0100644000175100017510000002674007726646105012643 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Routines de gestion des voies (Noyau). * */ #include static void choix_suivant (int); static void lit_port (int); static void teste_console (void); static void teste_voies (int); /* Boucle principale du noyau */ void kernel (void) { static int port = 1; static int loc_voie = 1; int i; #ifdef __FBBDOS__ kernel_boucle: #endif if (!operationnel) return; aff_etat ('A'); user_time_out (); is_idle = 1; #ifdef __LINUX__ pbsv (); #endif watchdog (); teste_console (); deb_io (); fin_io (); #ifdef __FBBDOS__ if (backscroll) { if (t_scroll) goto kernel_boucle; else fin_backscroll (); } #endif #ifdef __LINUX__ for (i = 1; i < NBPORT; i++) { if (++port == NBPORT) port = 1; if ((p_port[port].pvalid) && (p_port[port].stop == 0)) { lit_port (port); if (!operationnel) return; teste_voies (0); for (i = 1; i < NBVOIES; i++) { if (p_port[no_port (i)].stop == 0) teste_voies (i); } break; } } #elif defined(__WIN32__) for (i = 1; i < NBPORT; i++) { if (++port == NBPORT) port = 1; if ((p_port[port].pvalid) && (p_port[port].stop == 0)) { lit_port (port); if (!operationnel) return; teste_voies (0); if (++loc_voie == NBVOIES) loc_voie = 1; if (p_port[no_port (loc_voie)].stop == 0) teste_voies (loc_voie); } } #elif defined(__MSDOS__) || defined(__WINDOWS__) for (i = 1; i < NBPORT; i++) { if (++port == NBPORT) port = 1; if ((p_port[port].pvalid) && (p_port[port].stop == 0)) { lit_port (port); if (!operationnel) return; teste_voies (0); if (++loc_voie == NBVOIES) loc_voie = 1; if (p_port[no_port (loc_voie)].stop == 0) teste_voies (loc_voie); break; } } #endif if (loc_voie == 1) { k_tasks (); } if (!operationnel) return; #ifdef __FBBDOS__ goto kernel_boucle; #endif } static void teste_console (void) { df ("teste_console", 0); trait_time = 0; /* remet le compteur du watch-dog a 0 */ /***** A SUPPRIMER *****/ selvoie (CONSOLE); switch (traite_console ()) { case 0: break; case 1: if (pvoie->stop == 0) { traite_voie (CONSOLE); } break; case 2: /* Demande de forward */ break; } ff (); } static void tst_ddebcl (int port, uchar * mon, char *exped, char *indic) { int i; int ok = 0; long ltemp; char stemp[80]; char call[80]; uchar checksum; unsigned ck; int ssid = 0; df ("tst_ddebcl", 7); if (*mon++ == '?') { if (*mon++ == ' ') { checksum = 0; for (i = 0; i < 10; i += 2) { if ((!ok) && ((mon[i] != '0') || (mon[i + 1] != '0'))) ok = 1; if ((!isxdigit (mon[i])) && (!isxdigit (mon[i] + 1))) break; sscanf (mon + i, "%2x", &ck); ck &= 0xff; if (i < 8) checksum += (uchar) ck; } if ((!ok) || (i != 10) || (checksum != ck)) { ff (); return; } sscanf (indic, "%[0-9A-Z]-%d", stemp, &ssid); sscanf (exped, "%[0-9A-Z]", call); stemp[6] = '\0'; call[6] = '\0'; if ((ssid != myssid) || (strcmp (stemp, mycall) != 0)) { ff (); return; } strn_cpy (8, stemp, mon); sscanf (stemp, "%lX", <emp); dde_synchro (call, ltemp, port); } } ff (); } static void choix_suivant (int voie) { int choix; df ("choix_suivant", 1); if ((svoie[voie]->curfwd) && (voie == svoie[voie]->curfwd->forward)) { choix = get_link (svoie[voie]->bbsfwd); if (choix < (int) svoie[voie]->nb_choix) { ++choix; set_link (svoie[voie]->bbsfwd, choix); clr_bit_fwd (p_port[no_port (voie)].fwd, svoie[voie]->bbsfwd); svoie[voie]->curfwd->fwdpos = svoie[voie]->curfwd->lastpos; } else set_link (svoie[voie]->bbsfwd, 1); } ff (); return; } static int message (int voie, char *buffer) { char *ptr; int val; df ("message", 3); buffer[2] = '*'; if ((ptr = strtok (buffer, " ")) == NULL) { ff (); return (0); } ptr = strtok (NULL, " "); if (ptr == NULL) return (0); switch (*ptr) { case 'F': case 'D': if (strtok (NULL, " ")) { choix_suivant (voie); val = dec_voie (voie); ff (); return (val); } break; case 'R': if (strlen (ptr) == 8) { /* Readonly */ val = con_voie (voie, ptr); svoie[voie]->read_only = 1; ff (); return (val); } else if (strlen (ptr) == 9) { /* Reconnect */ dec_voie (voie); val = con_voie (voie, ptr); ff (); return (val); } break; case 'C': if (strlen (ptr) == 9) { /* Connected */ val = con_voie (voie, ptr); ff (); return (val); } break; case 'L': ptr = strtok (NULL, " "); /* indicatif */ if (strcmp (ptr, "FAILURE") == 0) { if (svoie[voie]->conf) { svoie[voie]->conf = 0; text_conf (T_CNF + 8); } choix_suivant (voie); val = dec_voie (voie); ff (); return (val); } break; case 'B': if (svoie[voie]->conf) { svoie[voie]->conf = 0; text_conf (T_CNF + 9); } val = dec_voie (voie); ff (); return (val); default: if (svoie[voie]->conf) { svoie[voie]->conf = 0; } break; } ff (); return (0); } void traite_commande (int voie, char *buffer, int len) { if (svoie[voie]->kiss != -1) { if (!svoie[CONSOLE]->sta.connect) aff_header (voie); init_timout (voie); if (svoie[voie]->kiss < 0) { svoie[voie]->kiss = CONSOLE; } selvoie (svoie[voie]->kiss); out ("\n$O: ", 5); if (len >= 4) { outsln (buffer + 4, len - 4); selvoie (voie); message (voie, buffer); } } else { nb_trait = 0; if (message (voie, buffer)) { traite_voie (voie); /* Il y a des actions */ status (voie); } } } void traite_data (int voie, char *buffer, int len) { aff_etat ('R'); if (svoie[voie]->kiss >= 0) { if (!svoie[CONSOLE]->sta.connect) aff_header (voie); init_timout (voie); selvoie (svoie[voie]->kiss); outs (buffer, len); write_capture (buffer, len); selvoie (voie); } else { in_buf (voie, buffer, len); status (voie); } } /* * Ressort un caractere du buffer d'entree * retourne le nb de caracteres (1 ou 0) */ int get_data (int voie) { if (svoie[voie]->kiss >= 0) { /* Rien a faire, la data est deja partie */ return (0); } else { return (get_inbuf (voie)); } } static void lit_port (int port) { char buffer[RCV_BUFFER_SIZE]; int voie; int len = 0; int max; int cmd; ui_header ui; char header[200]; char pid[20]; char to[20]; char ctl[20]; char via[10]; df ("lit_port", 1); memset (buffer, 0, sizeof (buffer)); #ifdef __WINDOWS__ if (p_port[port].typort == TYP_TCP) { ff (); return; } #endif if (p_port[port].typort == TYP_MOD) { lit_port_modem (port); aff_etat ('A'); ff (); return; } max = 30; voie = 0xff; while (rcv_drv (&port, &voie, &cmd, buffer, &len, &ui)) { switch (cmd) { case DISPLAY: break; case NBCHR: p_port[port].cur = *((long *) buffer); break; case NBBUF: p_port[port].mem = *((int *) buffer) << 5; break; case STATS: { int ch_status = 0; int mem = p_port[port].mem >> 5; stat_ch *sta_new = (stat_ch *) buffer; stat_ch *sta = &svoie[voie]->sta; if ((sta_new->stat != -1) && (sta->stat != sta_new->stat)) { sta->stat = sta_new->stat; ch_status = 1; } if ((sta_new->connect != -1) && (sta->connect != sta_new->connect)) { if (sta_new->connect == 1) { sta->connect = 1; } ch_status = 1; } if ((sta_new->ret != -1) && (sta_new->ret != sta->ret)) { sta->ret = sta_new->ret; ch_status = 1; } if ((sta_new->ack != -1) && (sta_new->ack != sta->ack)) { sta->ack = sta_new->ack; ch_status = 1; } if ((sta_new->mem != -1) && (sta->mem != mem)) { sta->mem = mem; ch_status = 1; } svoie[voie]->ch_status = ch_status; } break; case DATA: traite_data (voie, buffer, len); break; case COMMAND: traite_commande (voie, buffer, len); break; case UNPROTO: aff_etat ('M'); if (ui.pid) sprintf (pid, " pid %02X", ui.pid); else *pid = '\0'; if (*ui.ctl) sprintf (ctl, "ctl %s", ui.ctl); else *ctl = '\0'; if (*ui.to) sprintf (to, " to %s ", ui.to); else *to = '\0'; if (*ui.via) strcpy (via, "via "); else *via = '\0'; sprintf (header, "[%d] fm %s%s%s%s%s%s%s", ui.port, ui.from, to, via, ui.via, ctl, pid, ui.txt); add_heard (ui.port, get_indic (ui.from)); monitor (ui.port, header, strlen (header)); put_ui (header, W_MONH, strlen (header)); if (len == 0) break; switch (ui.pid) { case 0x01: put_rose (buffer, W_MOND, len); break; case 0xcf: put_nr (buffer, W_MOND, len); break; case 0xf0: if (ui.ui) tst_ddebcl (ui.port, buffer, ui.from, ui.to); monitor (ui.port, buffer, len); put_ui (buffer, W_MOND, len); break; case 0x0: /* Pactor */ monitor (ui.port, buffer, len); put_ui (buffer, W_MOND, len); break; } break; } if (--max == 0) break; } aff_etat ('A'); ff (); } void teste_voies (int voie) { int ch_stat = 0; long caltemps; static long lock_time = 0L; df ("teste_voies", 0); trait_time = 0; /* remet le compteur du watch-dog a 0 */ #ifdef __LINUX__ if (is_cmd (voie)) { /* A command is being processed */ traite_voie (voie); } else #endif if (voie == INEXPORT) { time (&caltemps); if ((inexport) && (!backscroll)) { struct stat statbuf; if (stat (LOCK_IN, &statbuf) == -1) { lock_time = 0L; aff_etat ('Y'); selvoie (INEXPORT); traite_voie (INEXPORT); } else { if (lock_time == 0L) lock_time = caltemps; else if ((caltemps - lock_time) > 300L) { lock_time = 0L; unlink (LOCK_IN); } } } return; } if (svoie[voie]->affport.port == 0xff) { ff (); return; } if (svoie[voie]->sta.connect) { ack_suiv (voie); } if ((!svoie[voie]->stop) && (svoie[voie]->seq)) { /* Recharge les bufs de sortie */ if (tot_mem > 10000L) { traite_voie (voie); ch_stat = 1; } ff (); return; } if ((v_tell == 0) || (v_tell != voie) || ((v_tell) && (v_tell == voie))) { while ((!svoie[voie]->seq) && (inbuf_ok (voie))) { ch_stat = 1; traite_voie (voie); } } if (ch_stat) status (voie); ff (); } int min_ok (int voie) { int port; int mini; df ("min_ok", 1); port = no_port (voie); mini = 300; switch (p_port[port].typort) { case TYP_BPQ: mini = (40 * 64); break; case TYP_DED: mini = (70 * 32); case TYP_FLX: p_port[port].mem = svoie[voie]->sta.mem * 250; mini = (250); break; } ff (); return (p_port[port].mem > mini); } fbb-7.04j/src/wp.c0100644000175100017510000006440007726646105012004 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include extern void *tete_wp; static char *l2call (lcall); int init_white_pages (void) { #if defined(__WINDOWS__) || defined(__LINUX__) char buf[80]; #endif #ifdef __FBBDOS__ fen *fen_ptr; #endif FILE *fptr; Wps rec; Wp wp; unsigned record = 0; if (!EMS_WPG_OK ()) return (0); init_wp_cache (); fptr = fopen (d_disque ("WP\\WP.SYS"), "rb"); if (fptr == NULL) return (1); #ifdef ENGLISH cprintf ("White Pages Set-up \r\n"); #else cprintf ("Initialisation Pages Blanches\r\n"); #endif deb_io (); #ifdef __FBBDOS__ #ifdef ENGLISH fen_ptr = open_win (10, 5, 50, 8, INIT, " White Pages "); #else fen_ptr = open_win (10, 5, 50, 8, INIT, "Pages Blanches"); #endif #endif /* __FBBDOS__ */ while (fread (&rec, sizeof (Wps), 1, fptr)) { if ((record % 100) == 0) { #if defined(__WINDOWS__) || defined(__LINUX__) InitText (ltoa ((long) record, buf, 10)); #endif #ifdef __FBBDOS__ cprintf ("\rrecord %u", record); #endif } wp.callsign = call2l (rec.callsign); wp.home = call2l (bbs_via (rec.first_homebbs)); write_wp (record, &wp); ++record; } fclose (fptr); #if defined(__WINDOWS__) || defined(__LINUX__) InitText (ltoa ((long) record, buf, 10)); #endif #ifdef __FBBDOS__ cprintf ("\rrecord %u", record); attend_caractere (2); close_win (fen_ptr); #endif fin_io (); #ifdef ENGLISH cprintf ("%u records updated\r\n", record); #else cprintf ("%u records updated\r\n", record); #endif return (1); } static void mess_wp (char *chaine) { Wpr rec; char *ptr; char source = '\0'; char date[80]; char call[80]; char route[80]; char zip[80]; char name[80]; char qth[80]; static char *qmark = "?"; ini_rec (&rec); *date = '\0'; *call = '\0'; strcpy (route, qmark); strcpy (zip, qmark); strcpy (name, qmark); strcpy (qth, qmark); sscanf (chaine, "%*s %s %s %*s %s %*s %s %s %[^\n]", date, call, route, zip, name, qth); if ((*date == '\0') || (*call == '\0')) { char debwp[300]; sprintf (debwp, "invalid update :\n %s\n", chaine); debug_wp (debwp); return; } ptr = strrchr (call, '/'); if (ptr) { *ptr++ = '\0'; if (isalpha (*ptr)) source = toupper (*ptr); } rec.local = 1; /* Pas de ligne si update par message */ rec.source = source; rec.last = date_to_time (date); strn_cpy (6, rec.callsign, call); strn_cpy (40, rec.homebbs, route); if (*zip != '?') strn_cpy (8, rec.zip, zip); if (*name != '?') n_cpy (12, rec.name, name); if (*qth != '?') n_cpy (30, rec.qth, qth); if ((*route != '?') && (addr_check (route))) wp_upd (&rec, 0); else { char debwp[300]; debug_wp (chaine); sprintf (debwp, "Address <%s> is not valid, WP not updated\n\n", route); debug_wp (debwp); } } void wp_read_mess (bullist * pbul) { char chaine[256]; FILE *fptr; ind_noeud *noeud; mess_noeud *mptr; char bbs[10]; if (!EMS_WPG_OK ()) return; deb_io (); aff_etat ('X'); strcpy (bbs, bbs_via (pbul->bbsv)); if ((fptr = ouvre_mess (O_TEXT, pbul->numero, '\0')) != NULL) { while (fgets (chaine, 255, fptr)) { if (strncmp (chaine, "On", 2) == 0) mess_wp (chaine); trait_time = 0; } fclose (fptr); } fin_io (); if ((*pbul->bbsv == '\0') && ((mptr = findmess (pbul->numero)) != NULL)) { /* Tue le message */ ouvre_dir (); pbul->status = 'K'; write_dir (mptr->noenr, pbul); ferme_dir (); noeud = cher_noeud (pbul->desti); --(noeud->nbnew); --(noeud->nbmess); chg_mess (0xffff, pbul->numero); } aff_etat ('A'); } static int wp_stats (void) { char s[256]; long record; long bbs; long users; int retour = 1; double ratio; Wp wp; bbs = users = 0L; for (record = 0L;; ++record) { if (!read_wp ((unsigned) record, &wp)) break; if (wp.callsign == wp.home) ++bbs; else ++users; } sprintf (s, "%6ld records in WP", record); outln (s, strlen (s)); ratio = (double) users *100.0 / (double) record; sprintf (s, "%6ld Users (%2d%%)", users, (int) (ratio + .5)); outln (s, strlen (s)); ratio = (double) bbs *100.0 / (double) record; sprintf (s, "%6ld BBS (%2d%%)", bbs, (int) (ratio + .5)); outln (s, strlen (s)); return (retour); } static int str_alnum (char *mask) { while (*mask) { if (!isalnum (*mask)) return (0); ++mask; } return (1); } static int display_wp_line (Wps * rec) { char s[256]; if (*rec->first_homebbs) { sprintf (s, "%-6s @%s %s %s %s", rec->callsign, rec->first_homebbs, (*rec->name) ? rec->name : "?", (*rec->first_zip) ? rec->first_zip : "?", (*rec->first_qth) ? rec->first_qth : "?" ); outln (s, strlen (s)); return (1); } return (0); } static int wp_search_call (void) { char mask[42]; FILE *fptr; unsigned record; int retour = 1; int no_mask; lcall callsign = 0; Wps rec; Wp wp; if (!*pvoie->ch_temp) return (retour); pvoie->sr_mem = pvoie->seq = FALSE; record = (unsigned) pvoie->noenr_menu; strn_cpy (40, mask, pvoie->ch_temp); if ((no_mask = str_alnum (mask)) != 0) callsign = call2l (mask); fptr = fopen (d_disque ("WP\\WP.SYS"), "rb"); if (fptr == NULL) return (retour); if (no_mask) { record = search_wp_record (callsign, USR_CALL, 0); if (record < 0xffff) { deb_io (); fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); fread (&rec, sizeof (Wps), 1, fptr); fin_io (); if (display_wp_line (&rec)) pvoie->temp1 = 1; } } else { while (read_wp (record, &wp)) { if ((wp.callsign) && (strmatch (l2call (wp.callsign), mask))) { deb_io (); fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); fread (&rec, sizeof (Wps), 1, fptr); fin_io (); if (display_wp_line (&rec)) pvoie->temp1 = 1; } if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 0; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 0; break; } ++record; } } fclose (fptr); pvoie->noenr_menu = record; if (retour && (pvoie->temp1 == 0)) texte (T_ERR + 19); return (retour); } Wps *wp_find (char *callsign, int update) { FILE *fptr; unsigned record = 0; static Wps rec; if (!EMS_WPG_OK ()) return (NULL); record = search_wp_record (call2l (callsign), USR_CALL, 0); if (record == 0xffff) return (NULL); deb_io (); fptr = fopen (d_disque ("WP\\WP.SYS"), "r+b"); if (fptr == NULL) { fin_io (); return (NULL); } fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); fread (&rec, sizeof (Wps), 1, fptr); if (update) { rec.last_seen = time (NULL); fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); fwrite (&rec, sizeof (Wps), 1, fptr); } fclose (fptr); fin_io (); return (&rec); } static void display_wp_user (long record, Wps * rec) { char s[256]; char modif[80]; char seen[80]; strcpy (modif, date_mbl (rec->last_modif)); strcpy (seen, date_mbl (rec->last_seen)); sprintf (s, "%-4ld: %s %s %-6s (%u) %s", record, modif, seen, rec->callsign, rec->seen, (*rec->name) ? rec->name : "?" ); outln (s, strlen (s)); sprintf (s, " [1] @%s Zip:%s Qth:%s", rec->first_homebbs, (*rec->first_zip) ? rec->first_zip : "?", (*rec->first_qth) ? rec->first_qth : "?" ); outln (s, strlen (s)); sprintf (s, " [2] @%s Zip:%s Qth:%s", rec->secnd_homebbs, (*rec->secnd_zip) ? rec->secnd_zip : "?", (*rec->secnd_qth) ? rec->secnd_qth : "?" ); outln (s, strlen (s)); } static int wp_list_user (void) { char mask[42]; FILE *fptr; unsigned record; int retour = 1; lcall lc; Wps rec; Wp wp; if (!*pvoie->ch_temp) { texte (T_ERR + 2); return (retour); } pvoie->sr_mem = pvoie->seq = FALSE; record = (unsigned) pvoie->noenr_menu; strn_cpy (40, mask, pvoie->ch_temp); fptr = fopen (d_disque ("WP\\WP.SYS"), "rb"); if (fptr == NULL) return (retour); lc = call2l (mask); while (read_wp (record, &wp)) { if (wp.callsign == lc) { deb_io (); fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); fread (&rec, sizeof (Wps), 1, fptr); fin_io (); if (*rec.first_homebbs) { display_wp_user ((long) record, &rec); pvoie->temp1 = 1; break; } } if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 0; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 0; break; } ++record; } fclose (fptr); pvoie->noenr_menu = record; if (retour && (pvoie->temp1 == 0)) { texte (T_ERR + 19); pvoie->noenr_menu = -1L; } return (retour); } static int wp_search_bbs (void) { /* char s[256]; */ char mask[42]; FILE *fptr; Wps rec; Wp wp; unsigned record; int retour = 1; int no_mask; lcall callsign; if (!*pvoie->ch_temp) { texte (T_ERR + 2); return (retour); } pvoie->sr_mem = pvoie->seq = FALSE; record = (unsigned) pvoie->noenr_menu; strn_cpy (40, mask, pvoie->ch_temp); fptr = fopen (d_disque ("WP\\WP.SYS"), "rb"); if (fptr == NULL) return (1); if ((no_mask = str_alnum (mask)) != 0) callsign = call2l (mask); if (no_mask) { while (read_wp (record, &wp)) { if (wp.home == callsign) { deb_io (); fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); fread (&rec, sizeof (Wps), 1, fptr); fin_io (); if (display_wp_line (&rec)) pvoie->temp1 = 1; } if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 0; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 0; break; } ++record; } } else { while (read_wp (record, &wp)) { if ((wp.callsign) && (strmatch (l2call (wp.home), mask))) { deb_io (); fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); fread (&rec, sizeof (Wps), 1, fptr); fin_io (); if (display_wp_line (&rec)) pvoie->temp1 = 1; } if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 0; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 0; break; } ++record; } } fclose (fptr); pvoie->noenr_menu = record; if (retour && (pvoie->temp1 == 0)) texte (T_ERR + 19); return (retour); } static int wp_search_name (void) { char mask[42]; FILE *fptr; Wps rec; unsigned record; int retour = 1; int ok; if (!*pvoie->ch_temp) { texte (T_ERR + 2); return (retour); } pvoie->sr_mem = pvoie->seq = FALSE; record = (unsigned) pvoie->noenr_menu; strn_cpy (40, mask, pvoie->ch_temp); fptr = fopen (d_disque ("WP\\WP.SYS"), "rb"); if (fptr == NULL) return (1); while (1) { deb_io (); fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); ok = fread (&rec, sizeof (Wps), 1, fptr); fin_io (); if (ok == 0) break; if ((*rec.first_homebbs) && (*rec.name) && (*rec.name != '?')) { if ((*rec.callsign) && (strstr (strupr (rec.name), mask))) { display_wp_line (&rec); pvoie->temp1 = 1; } } ++record; if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 0; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 0; break; } } fclose (fptr); pvoie->noenr_menu = record; if (retour && (pvoie->temp1 == 0)) texte (T_ERR + 19); return (retour); } static int wp_search_qth (void) { char mask[42]; FILE *fptr; Wps rec; unsigned record; int retour = 1; int ok; if (!*pvoie->ch_temp) { texte (T_ERR + 2); return (retour); } pvoie->sr_mem = pvoie->seq = FALSE; record = (unsigned) pvoie->noenr_menu; strn_cpy (40, mask, pvoie->ch_temp); fptr = fopen (d_disque ("WP\\WP.SYS"), "rb"); if (fptr == NULL) return (1); while (1) { deb_io (); fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); ok = fread (&rec, sizeof (Wps), 1, fptr); fin_io (); if (ok == 0) break; if ((*rec.first_homebbs) && (*rec.first_qth) && (*rec.first_qth != '?')) { if ((*rec.callsign) && (strstr (strupr (rec.first_qth), mask))) { display_wp_line (&rec); pvoie->temp1 = 1; } } ++record; if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 0; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 0; break; } } fclose (fptr); pvoie->noenr_menu = record; if (retour && (pvoie->temp1 == 0)) texte (T_ERR + 19); return (retour); } static int wp_search_zip (void) { char mask[42]; FILE *fptr; Wps rec; unsigned record; int retour = 1; int ok; if (!*pvoie->ch_temp) { texte (T_ERR + 2); return (retour); } pvoie->sr_mem = pvoie->seq = FALSE; record = (unsigned) pvoie->noenr_menu; strn_cpy (40, mask, pvoie->ch_temp); fptr = fopen (d_disque ("WP\\WP.SYS"), "rb"); if (fptr == NULL) return (1); while (1) { deb_io (); fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); ok = fread (&rec, sizeof (Wps), 1, fptr); fin_io (); if (ok == 0) break; if (*rec.first_homebbs) { if ((*rec.callsign) && (strmatch (rec.first_zip, mask))) { display_wp_line (&rec); pvoie->temp1 = 1; } } ++record; if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 0; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 0; break; } } fclose (fptr); pvoie->noenr_menu = record; if (retour && (pvoie->temp1 == 0)) texte (T_ERR + 19); return (retour); } static int wp_search_area (void) { char *ptr; char mask[42]; char route[42]; FILE *fptr; Wps rec; unsigned record; int retour = 1; int ok; if (!*pvoie->ch_temp) { texte (T_ERR + 2); return (retour); } pvoie->sr_mem = pvoie->seq = FALSE; record = (unsigned) pvoie->noenr_menu; strn_cpy (40, mask, pvoie->ch_temp); fptr = fopen (d_disque ("WP\\WP.SYS"), "rb"); if (fptr == NULL) return (1); while (1) { deb_io (); fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); ok = fread (&rec, sizeof (Wps), 1, fptr); fin_io (); if (ok == 0) break; if (*rec.first_homebbs) { strn_cpy (40, route, rec.first_homebbs); ptr = strtok (route, "."); while (ptr) { if (strcmp (ptr, mask) == 0) { display_wp_line (&rec); pvoie->temp1 = 1; break; } ptr = strtok (NULL, "."); } } ++record; if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 0; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 0; break; } } fclose (fptr); pvoie->noenr_menu = record; if (retour && (pvoie->temp1 == 0)) texte (T_ERR + 19); return (retour); } static char *replace_space (char *ptr) { char *scan = ptr; while (*scan) { if (*scan == ' ') *scan = '-'; ++scan; } return (ptr); } static void update_user_home_bbs (char *callsign, char *homebbs) { FILE *fpti; info frec; unsigned num_indic; char call[8]; char *ptr; /* Modifie le user eventuellement */ pvoie->emis = insnoeud (callsign, &num_indic); if (pvoie->emis->coord != 0xffff) { /* Seulement l'indicatif */ n_cpy (6, call, homebbs); ptr = strchr (call, '.'); if (ptr) *ptr = '\0'; fpti = ouvre_nomenc (); fseek (fpti, (long) pvoie->emis->coord * sizeof (info), 0); fread (&frec, sizeof (info), 1, fpti); strcpy (frec.home, call); fseek (fpti, (long) pvoie->emis->coord * sizeof (info), 0); fwrite (&frec, sizeof (info), 1, fpti); ferme (fpti, 39); } } static void modif_wp_record (long record) { int c; int err = 0; FILE *fptr; Wp wp; Wps rec; unsigned num_indic; fptr = fopen (d_disque ("WP\\WP.SYS"), "r+b"); if (fptr == NULL) return; deb_io (); fseek (fptr, record * sizeof (Wps), SEEK_SET); fread (&rec, sizeof (Wps), 1, fptr); c = *indd++; switch (toupper (c)) { case 'N': incindd (); n_cpy (12, rec.name, replace_space (indd)); break; case 'U': n_cpy (40, rec.first_homebbs, rec.secnd_homebbs); n_cpy (30, rec.first_qth, rec.secnd_qth); n_cpy (8, rec.first_zip, rec.secnd_zip); read_wp ((unsigned) record, &wp); wp.home = call2l (bbs_via (rec.first_homebbs)); write_wp ((unsigned) record, &wp); update_user_home_bbs (rec.callsign, rec.first_homebbs); break; case '1': c = *indd++; incindd (); if (strcmp (indd, ".") == 0) *indd = '\0'; switch (toupper (c)) { case 'H': strn_cpy (40, rec.first_homebbs, extend_bbs (indd)); read_wp ((unsigned) record, &wp); wp.home = call2l (bbs_via (rec.first_homebbs)); write_wp ((unsigned) record, &wp); update_user_home_bbs (rec.callsign, rec.first_homebbs); break; case 'Q': n_cpy (30, rec.first_qth, indd); break; case 'Z': strn_cpy (8, rec.first_zip, replace_space (indd)); /* Modifie le zip eventuellement */ pvoie->emis = insnoeud (rec.callsign, &num_indic); if (pvoie->emis->coord != 0xffff) { FILE *fpti; info frec; fpti = ouvre_nomenc (); fseek (fpti, (long) pvoie->emis->coord * sizeof (info), 0); fread (&frec, sizeof (info), 1, fpti); strcpy (frec.zip, rec.first_zip); fseek (fpti, (long) pvoie->emis->coord * sizeof (info), 0); fwrite (&frec, sizeof (info), 1, fpti); ferme (fpti, 39); } break; default: err = 1; texte (T_ERR + 0); break; } break; case '2': c = *indd++; incindd (); switch (toupper (c)) { case 'H': strn_cpy (40, rec.secnd_homebbs, extend_bbs (indd)); break; case 'Q': n_cpy (30, rec.secnd_qth, indd); break; case 'Z': strn_cpy (8, rec.secnd_zip, replace_space (indd)); break; default: err = 1; texte (T_ERR + 0); break; } break; default: err = 1; texte (T_ERR + 0); break; } if (!err) { rec.changed = 'U'; fseek (fptr, record * sizeof (Wps), SEEK_SET); fwrite (&rec, sizeof (Wps), 1, fptr); } fin_io (); fclose (fptr); display_wp_user (record, &rec); } static void kill_wp_record (long record) { FILE *fptr; Wp wp; Wps rec; fptr = fopen (d_disque ("WP\\WP.SYS"), "r+b"); if (fptr == NULL) return; deb_io (); fseek (fptr, record * sizeof (Wps), SEEK_SET); fread (&rec, sizeof (Wps), 1, fptr); *rec.callsign = '\0'; *rec.first_homebbs = '\0'; fseek (fptr, record * sizeof (Wps), SEEK_SET); fwrite (&rec, sizeof (Wps), 1, fptr); read_wp ((unsigned) record, &wp); wp.callsign = 0L; wp.home = 0L; write_wp ((unsigned) record, &wp); fin_io (); fclose (fptr); } static int wp_edit (void) { int fin = 1; int prompt = 1; char s[80]; sup_ln (indd); switch (pvoie->niv3) { case 20: prompt = 0; if (wp_list_user () == 0) { return (0); } if ((!*pvoie->ch_temp) || (pvoie->noenr_menu == -1L)) { fin = 1; } else { ch_niv3 (21); var_cpy (0, pvoie->ch_temp); texte (T_MBL + 30); fin = 0; } break; case 21: if (toupper (*indd) == Oui) { kill_wp_record (pvoie->noenr_menu); fin = 1; prompt = 0; } else { fin = 0; ch_niv3 (22); } break; case 22: if (*indd) { modif_wp_record (pvoie->noenr_menu); fin = 0; } else { fin = 1; prompt = 0; } break; } if (prompt) { sprintf (s, "(U)pdate,(N)ame,(1H)ome,(1Z)ip,(1Q)th,(2H)ome,(2Z)ip,(2Q)th,(Return) >"); outln (s, strlen (s)); } return (fin); } int menu_wp_search (void) { int menu = 1; int error = 0; int c; sup_ln (indd); c = *indd++; while_space (); pvoie->temp1 = 0; pvoie->noenr_menu = 0; strn_cpy (40, pvoie->ch_temp, indd); if (c == '\0') { mbl_info (); retour_mbl (); return (0); } if (!EMS_WPG_OK ()) { return (1); } switch (toupper (c)) { case ' ': if (wp_search_call () == 0) { menu = 0; ch_niv3 (1); } break; case '@': if (wp_search_bbs () == 0) { menu = 0; ch_niv3 (2); } break; case 'D': if (wp_stats () == 0) { menu = 0; ch_niv3 (10); } break; case 'E': if (droits (COSYSOP)) { ch_niv3 (20); if (wp_edit () == 0) { menu = 0; } } else error = 1; break; case 'H': if (wp_search_area () == 0) { menu = 0; ch_niv3 (4); } break; case 'L': if (droits (COSYSOP)) { if (wp_list_user () == 0) { menu = 0; ch_niv3 (5); } } else error = 1; break; case 'N': if (wp_search_name () == 0) { menu = 0; ch_niv3 (6); } break; case 'Q': if (wp_search_qth () == 0) { menu = 0; ch_niv3 (7); } break; case 'Z': if (wp_search_zip () == 0) { menu = 0; ch_niv3 (3); } break; default: error = 1; break; } if (!error && menu) retour_mbl (); return (error); } void wp_search (void) { int fin; switch (pvoie->niv3) { case 1: fin = wp_search_call (); break; case 2: fin = wp_search_bbs (); break; case 3: fin = wp_search_zip (); break; case 4: fin = wp_search_area (); break; case 5: fin = wp_list_user (); break; case 6: fin = wp_search_name (); break; case 7: fin = wp_search_qth (); break; case 10: fin = wp_stats (); break; case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: fin = wp_edit (); break; default: fin = 1; fbb_error (ERR_NIVEAU, "WP-SEARCH", pvoie->niv3); break; } if (fin) retour_mbl (); } /* Service WP */ static void wp_serv_callsign (FILE * fpto, char *mask) { unsigned record = 0; FILE *fptr; int nb = 0; Wps rec; Wp wp; fptr = fopen (d_disque ("WP\\WP.SYS"), "rb"); if (fptr == NULL) return; while (read_wp (record, &wp)) { if ((wp.callsign) && (strmatch (l2call (wp.callsign), mask))) { deb_io (); fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); fread (&rec, sizeof (Wps), 1, fptr); fin_io (); if (*rec.first_homebbs) { fprintf (fpto, "On %s %s @ %s zip %s %s %s\r\n", date_mbl (rec.last_modif), rec.callsign, (*rec.first_homebbs) ? rec.first_homebbs : "?", (*rec.first_zip) ? rec.first_zip : "?", (*rec.name) ? rec.name : "?", (*rec.first_qth) ? rec.first_qth : "?" ); if (++nb == 100) { fprintf (fpto, "*** More than 100 entries for %s.\r\n", mask); break; } } } ++record; } fclose (fptr); if (nb == 0) { fprintf (fpto, "*** %s not found.\n", mask); } } int wp_service (char *filename) { int ok; int premier = 1; FILE *fptr; FILE *fpto; char buffer[256]; char sender[80]; char commande[80]; char qmark[80]; if (!EMS_WPG_OK ()) return (1); fptr = fopen (filename, "rt"); /* Open the received message */ if (fptr == NULL) return (1); fgets (buffer, 80, fptr); /* Read the command line */ sscanf (buffer, "%s %s %s %s\n", commande, commande, commande, sender); *qmark = '\0'; fgets (buffer, 80, fptr); /* Read the subject */ if ((strcmp (sender, "WP") == 0) || (is_wpupdate (buffer))) { fclose (fptr); return (1); } fpto = fappend (MAILIN, "b"); if (fpto == NULL) return (1); while (fgets (buffer, 80, fptr)) { /* Read the lines */ strupr (buffer); *qmark = '\0'; /* Capitalize */ sscanf (buffer, "%s %s", commande, qmark); /* Scan lines */ ok = 0; if (*qmark == '?') { ok = 1; } else if (*qmark == '\0') { if (commande[strlen (commande) - 1] == '?') { commande[strlen (commande) - 1] = '\0'; ok = 1; } } if (ok) { if (premier) { fprintf (fpto, "#\r\n"); /* Tell that this is a message from this BBS */ fprintf (fpto, "SP %s @ %s < %s\r\n", sender, pvoie->mess_home, mycall); fprintf (fpto, "WP Reply\r\n"); premier = 0; } wp_serv_callsign (fpto, commande); } } if (!premier) fprintf (fpto, "[ From WP @ %s ]\r\n/EX\r\n", mycall); fclose (fpto); fclose (fptr); /* All needed is read */ return (0); /* Retour ok */ } /* Cherche un home BBS pour le destinataire specifie et le met dans bbsv le champ bbsv doit etre vide en entree. retourne 1 si le destinataire a ete trouve dans la base. */ int route_wp_home (bullist * pbull) { FILE *fptr; unsigned record; int retour = 0; Wps rec; record = search_wp_record (call2l (pbull->desti), USR_CALL, 0); if (record < 0xffff) { deb_io (); fptr = fopen (d_disque ("WP\\WP.SYS"), "rb"); if (fptr == NULL) { fin_io (); return (0); } fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); fread (&rec, sizeof (Wps), 1, fptr); fclose (fptr); if (*rec.first_homebbs) { strn_cpy (40, pbull->bbsv, rec.first_homebbs); retour = 1; } fin_io (); } return (retour); } /* Cherche l'extension hierarchique d'une BBS et la met dans bbsv le champ bbsv ne doit pas avoir d'extension en entree. retourne 1 si l'extension a ete trouvee dans la base. */ int route_wp_hier (bullist * pbull) { FILE *fptr; unsigned record; int retour = 0; Wps rec; if (!EMS_WPG_OK ()) return (0); record = search_wp_record (call2l (pbull->bbsv), BBS_CALL, 0); if (record < 0xffff) { deb_io (); fptr = fopen (d_disque ("WP\\WP.SYS"), "rb"); if (fptr == NULL) { fin_io (); return (0); } fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); fread (&rec, sizeof (Wps), 1, fptr); if (*rec.first_homebbs) { strn_cpy (40, pbull->bbsv, rec.first_homebbs); retour = 1; } fclose (fptr); fin_io (); } return (retour); } static char *l2call (lcall val) { static char callsign[7]; char *ptr = callsign; register unsigned long c; c = val / 69343957L; if (c) { val -= (c * 69343957L); *ptr++ = (char) ((c >= 11) ? c + 54 : c + 47); } c = val / 1874161L; if (c) { val -= (c * 1874161L); *ptr++ = (char) ((c >= 11) ? c + 54 : c + 47); } c = val / 50653L; if (c) { val -= (c * 50653L); *ptr++ = (char) ((c >= 11) ? c + 54 : c + 47); } c = val / 1369L; if (c) { val -= (c * 1369L); *ptr++ = (char) ((c >= 11) ? c + 54 : c + 47); } c = val / 37L; if (c) { val -= (c * 37L); *ptr++ = (char) ((c >= 11) ? c + 54 : c + 47); } c = val; if (c) { *ptr++ = (char) ((c >= 11) ? c + 54 : c + 47); } *ptr = '\0'; return (callsign); } fbb-7.04j/src/lzhuf.c0100644000175100017510000010000707726646105012500 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /************************************************************** lzhuf.c written by Haruyasu Yoshizaki 11/20/1988 some minor changes 4/6/1989 comments translated by Haruhiko Okumura 4/7/1989 adapted by Jean-Paul ROUBELAT F6FBB 10/31/90 **************************************************************/ #include #include static FILE *infile, *outfile; static char *in_f, *ou_f; static unsigned long int textsize, codesize, printcount; static char *head; static char bin_header[257]; static short headlen; static void write_huf_error (char *); static short take (void); static long numero; static ushort crc; static bullist *pbul; static short basic; static short init_huf = 0; static int crlf = 0; /********** LZSS compression **********/ #define N 2048 /* buffer size */ #define F 60 /* lookahead buffer size */ #define THRESHOLD 2 #define NIL N /* leaf of tree */ static unsigned char text_buf[N + F - 1]; static ushort chck; static short match_position, match_length; static short *lson, *rson, *dad; /* Declaration de fonctions */ static short crc_fgetc (FILE *); static short crc_fputc (short, FILE *); static void ins_route (int, char *); /**********************/ char *make_header (bullist * pbul, char *header) { long temps; struct tm *sdate; char tempo[200]; bullist *psauv; psauv = ptmes; ptmes = pbul; temps = ptmes->date; sdate = gmtime (&temps); if (std_header & 8) sprintf (tempo, "R:%02d%02d%02d/%02d%02dZ %%N@%%R%s", sdate->tm_year % 100, sdate->tm_mon + 1, sdate->tm_mday, sdate->tm_hour, sdate->tm_min, txtfwd); else sprintf (tempo, "R:%02d%02d%02d/%02d%02dZ @:%%R #:%%N%s", sdate->tm_year % 100, sdate->tm_mon + 1, sdate->tm_mday, sdate->tm_hour, sdate->tm_min, txtfwd); n_cpy (150, header, var_txt (tempo)); if (((std_header & 4) == 0) && (strlen (header) > 79)) { char *ptr; ptr = header + 79; while (*ptr != ' ') { --ptr; } *ptr = '\0'; } strcat (header, "\r"); ptmes = psauv; return (header); } void dde_huf (int voie, bullist * pbul, int mode) { desc_huf pthuf; long taille; FILE *fptr; char fic[128]; char temp[128]; make_header (pbul, pthuf.header); /* <--------- A mettre ds ENCODE */ pthuf.next = NULL; pthuf.voie = voie; pthuf.mode = mode; pthuf.bull = pbul; deb_io (); taille = 0L; if (pthuf.mode == ENCODE) { strcpy (fic, mess_name (MBINDIR, pthuf.bull->numero, temp)); if ((fptr = fopen (fic, "r")) != NULL) { if (fread (&taille, sizeof (long), 1, fptr) == 0) taille = 0L; fclose (fptr); } } fin_io (); if (taille == 0L) { taille = lzhuf (&pthuf); } svoie[voie]->ask = taille; } static short crc_fputc (short c, FILE * outfile) { crc = updcrc (c, crc); chck += (c & 0xff); return (fputc (c, outfile)); } static short crc_fgetc (FILE * infile) { short retour = getc (infile); if (retour != -1) { crc = updcrc (retour, crc); } return (retour); } /* * Date en chaine de caracteres sous la forme 960225 (25fev 96) * Retour en secondes depuis le 1 Jan 1970 */ long date_to_time (char *indd) { static char Days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; long x; register short i; register short days; short jour, mois, annee; for (i = 0; i < 6; i++) if (!isdigit (indd[i])) return (0L); if (indd[0] < '8') annee = ((indd[0] - '0') * 10) + 20 + (indd[1] - '0'); else annee = ((indd[0] - '8') * 10) + (indd[1] - '0'); mois = ((indd[2] - '0') * 10) + (indd[3] - '0'); jour = ((indd[4] - '0') * 10) + (indd[5] - '0'); if ((annee < 0) || (jour < 1) || (jour > 31) || (mois < 1) || (mois > 12)) { /* La date est incoherente */ x = 0L; } else { x = 315532800L + _timezone; /* Convertit de 1980 a 1970 */ x += (long) (annee >> 2) * 126230400L; /* 4 annees */ x += (long) (annee & 3) * 31536000L; /* 1 annee */ if (annee & 3) x += 86400L; days = 0; i = mois - 1; while (i > 0) { i--; days += Days[i]; } days += jour - 1; if ((mois > 2) && ((annee & 3) == 0)) days++; /* bissextile */ x += ((long) days * 86400L); } return (x); } /* * Heure sous la forme 1031 (10h31mn) * Retour en secondes depuis 00h00 */ long hour_to_time (char *indd) { long x; register short i; short hour, minute; for (i = 0; i < 4; i++) if (!isdigit (indd[i])) return (0L); hour = ((indd[0] - '0') * 10) + (indd[1] - '0'); minute = ((indd[2] - '0') * 10) + (indd[3] - '0'); x = (long) hour *3600L + (long) minute *60L; return (x); } char *bbs_via (char *s) { short nb = 0; static char bbs[7]; while (ISGRAPH (*s) && (*s != '.')) { if (nb == 6) break; bbs[nb++] = toupper (*s); ++s; } bbs[nb] = '\0'; return (bbs); } static void ins_route (int voie, char *route) { int i, alloue = 0; Hroute *pcurr, *pprec; if (svoie[voie]->r_tete == NULL) { svoie[voie]->r_tete = svoie[voie]->r_curr = (Route *) m_alloue (sizeof (Route)); alloue = 1; } if (svoie[voie]->r_pos == NBROUTE) { svoie[voie]->r_curr->suite = (Route *) m_alloue (sizeof (Route)); svoie[voie]->r_curr = svoie[voie]->r_curr->suite; alloue = 1; } if (alloue) { svoie[voie]->r_pos = 0; svoie[voie]->r_curr->suite = NULL; for (i = 0; i < NBROUTE; i++) *(svoie[voie]->r_curr->call[i]) = '\0'; } strn_cpy (6, svoie[voie]->r_curr->call[svoie[voie]->r_pos++], bbs_via (route)); if (h_ok) { pcurr = throute; pprec = NULL; if (pcurr) { while (pcurr) { pprec = pcurr; pcurr = pcurr->suiv; } pcurr = pprec->suiv = (Hroute *) m_alloue (sizeof (Hroute)); } else { pcurr = throute = (Hroute *) m_alloue (sizeof (Hroute)); } strn_cpy (40, pcurr->route, route); pcurr->suiv = NULL; } } void analyse_header (int voie, char *ptr) { int c; int champ; int nb; int bbs; long date; char rbbs[80]; char home[41]; char qth[31]; char zip[13]; ptr += 2; champ = 2; nb = 0; bbs = 0; *home = *zip = *qth = '\0'; date = 0L; svoie[voie]->mess_num = -1L; do { c = *ptr; switch (champ) { case 0: switch (c) { case '@': bbs = 1; champ = 3; nb = 0; break; case '#': champ = 6; nb = 0; break; case '$': champ = 7; nb = 0; break; case '[': champ = 4; nb = 0; break; case 'Z': if (*(ptr + 1) == ':') { ++ptr; champ = 5; nb = 0; } break; default: if ((bbs == 0) && (isdigit (c))) { nb = 0; rbbs[nb++] = c; champ = 6; } } case 1: if (isspace (c)) champ = 0; break; case 2: /* Lecture de la date - Mettre la date la plus ancienne */ if (nb <= 10) rbbs[nb] = c; if (nb == 10) { rbbs[11] = '\0'; rbbs[6] = '\0'; if ((date = date_to_time (rbbs)) != 0L) { date += hour_to_time (rbbs + 7); svoie[voie]->messdate = date; } champ = 1; } ++nb; break; case 3: /* Lecture du home BBS */ if ((nb == 0) && (c == ':')) break; if ((ISGRAPH (c)) && (nb < 40)) { rbbs[nb++] = c; } else { rbbs[nb] = '\0'; ins_route (voie, rbbs); strn_cpy (40, home, rbbs); strn_cpy (40, svoie[voie]->mess_home, rbbs); svoie[voie]->header = 1; champ = 0; } break; case 4: /* Lecture du Qth */ if ((c != ']') && (nb < 30)) { rbbs[nb++] = c; } else { rbbs[nb] = '\0'; n_cpy (30, qth, rbbs); champ = 0; } break; case 5: /* Lecture du Zip Code */ if ((ISGRAPH (c)) && (nb < 8)) { rbbs[nb++] = c; } else { rbbs[nb] = '\0'; strn_cpy (8, zip, rbbs); champ = 0; } break; case 6: /* Lecture du home premier numero */ if ((nb == 0) && (c == ':')) break; if ((isdigit (c)) && (nb < 10)) { rbbs[nb++] = c; } else { rbbs[nb] = '\0'; if (nb) svoie[voie]->mess_num = atol (rbbs); if ((bbs == 0) && (c == '@')) { bbs = 1; champ = 3; nb = 0; } else champ = 0; } break; case 7: /* Lecture du BID/MID */ if ((nb == 0) && (c == ':')) break; if ((ISGRAPH (c)) && (nb < 12)) { rbbs[nb++] = c; } else { rbbs[nb] = '\0'; if (nb) strn_cpy (12, svoie[voie]->mess_bid, rbbs); champ = 0; } break; } ++ptr; } while (ISPRINT (c)); header_wp (date, home, qth, zip); } void entete_mess_fwd (bullist * pbul, char *header) { char s[128]; bullist *sav_bul; deb_io (); sav_bul = ptmes; ptmes = pbul; *msg_header = '\0'; if ((ptmes->type == 'A') || (strcmp (ptmes->desti, "WP") == 0)) { if (*(ptmes->bbsf) == '\0') { strcpy (msg_header, header); strcat (msg_header, "\r"); } } else if (*(ptmes->bbsf)) { strcpy (msg_header, header); } else { strcpy (msg_header, header); sprintf (s, "\rFrom: %s@%s\rTo : %s@%s\r\r", ptmes->exped, mypath, ptmes->desti, ptmes->bbsv); strcat (msg_header, s); } ptmes = sav_bul; fin_io (); } static void write_huf_error (char *filename) { deb_io (); fclose (infile); fclose (outfile); unlink (ou_f); write_error (filename); fin_io (); } static void InitTree (void) /* initialize trees */ { int i; for (i = N + 1; i <= N + 256; i++) rson[i] = NIL; /* root */ for (i = 0; i < N; i++) dad[i] = NIL; /* node */ } static void InsertNode (short r) /* insert to tree */ { short i, p, cmp; unsigned char *key; ushort c; cmp = 1; key = &text_buf[r]; p = N + 1 + key[0]; rson[r] = lson[r] = NIL; match_length = 0; for (;;) { if (cmp >= 0) { if (rson[p] != NIL) p = rson[p]; else { rson[p] = r; dad[r] = p; return; } } else { if (lson[p] != NIL) p = lson[p]; else { lson[p] = r; dad[r] = p; return; } } for (i = 1; i < F; i++) if ((cmp = key[i] - text_buf[p + i]) != 0) break; if (i > THRESHOLD) { if (i > match_length) { match_position = ((r - p) & (N - 1)) - 1; if ((match_length = i) >= F) break; } else if (i == match_length) { if ((c = ((r - p) & (N - 1)) - 1) < match_position) { match_position = c; } } } } dad[r] = dad[p]; lson[r] = lson[p]; rson[r] = rson[p]; dad[lson[p]] = r; dad[rson[p]] = r; if (rson[dad[p]] == p) rson[dad[p]] = r; else lson[dad[p]] = r; dad[p] = NIL; /* remove p */ } static void DeleteNode (short p) /* remove from tree */ { short q; if (dad[p] == NIL) return; /* not registered */ if (rson[p] == NIL) q = lson[p]; else if (lson[p] == NIL) q = rson[p]; else { q = lson[p]; if (rson[q] != NIL) { do { q = rson[q]; } while (rson[q] != NIL); rson[dad[q]] = lson[q]; dad[lson[q]] = dad[q]; lson[q] = lson[p]; dad[lson[p]] = q; } rson[q] = rson[p]; dad[rson[p]] = q; } dad[q] = dad[p]; if (rson[dad[p]] == p) rson[dad[p]] = q; else lson[dad[p]] = q; dad[p] = NIL; } /* Huffman coding */ #define N_CHAR (256 - THRESHOLD + F) /* kinds of characters (character code = 0..N_CHAR-1) */ #define T (N_CHAR * 2 - 1) /* size of table */ #define R (T - 1) /* position of root */ #define MAX_FREQ 0x8000 /* updates tree when the */ /* root frequency comes to this value. */ /* table for encoding and decoding the upper 6 bits of position */ /* for encoding */ static uchar p_len[64] = { 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }; static uchar p_code[64] = { 0x00, 0x20, 0x30, 0x40, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78, 0x80, 0x88, 0x90, 0x94, 0x98, 0x9C, 0xA0, 0xA4, 0xA8, 0xAC, 0xB0, 0xB4, 0xB8, 0xBC, 0xC0, 0xC2, 0xC4, 0xC6, 0xC8, 0xCA, 0xCC, 0xCE, 0xD0, 0xD2, 0xD4, 0xD6, 0xD8, 0xDA, 0xDC, 0xDE, 0xE0, 0xE2, 0xE4, 0xE6, 0xE8, 0xEA, 0xEC, 0xEE, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF }; /* for decoding */ static uchar d_code[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F, 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 0x18, 0x18, 0x19, 0x19, 0x1A, 0x1A, 0x1B, 0x1B, 0x1C, 0x1C, 0x1D, 0x1D, 0x1E, 0x1E, 0x1F, 0x1F, 0x20, 0x20, 0x21, 0x21, 0x22, 0x22, 0x23, 0x23, 0x24, 0x24, 0x25, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x29, 0x2A, 0x2A, 0x2B, 0x2B, 0x2C, 0x2C, 0x2D, 0x2D, 0x2E, 0x2E, 0x2F, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, }; static uchar d_len[256] = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }; static ushort *freq; /* frequency table */ /* pointers to parent nodes, except for the elements [T..T + N_CHAR - 1] which are used to get the positions of leaves corresponding to the codes. */ static short *prnt; static short *fils; /* pointers to child nodes (fils[], fils[] + 1) */ static ushort getbuf; static uchar getlen; static short scan_header (char *chaine) { char *ptr = bin_header; while ((*ptr++ = *chaine) != '\0') { if (*chaine == '\r') *ptr++ = '\n'; ++chaine; } return (strlen (bin_header)); } static short take (void) { short c; if (headlen) { --headlen; c = ((short) *head++ & 0xff); } else { /* Gestion du LF -> CRLF */ if (crlf) { c = '\n'; crlf = 0; } else { do { /* Ignore les CR */ c = getc (infile); } while (c == '\r'); if (c == '\n') { crlf = c; c = '\r'; } } } return (c); } static short GetBit (void) /* get one bit */ { short i; while (getlen <= 8) { if ((i = crc_fgetc (infile)) < 0) i = 0; getbuf |= i << (8 - getlen); getlen += 8; } i = getbuf; getbuf <<= 1; getlen--; return (i < 0); } static short GetByte (void) /* get one byte */ { ushort i; while (getlen <= 8) { if ((i = crc_fgetc (infile)) == 0xffff) i = 0; getbuf |= i << (8 - getlen); getlen += 8; } i = getbuf; getbuf <<= 8; getlen -= 8; return i >> 8; } static ushort putbuf; static uchar putlen; static void Putcode (short l, ushort c) /* output c bits of code */ { putbuf |= c >> putlen; if ((putlen += l) >= 8) { if (crc_fputc (putbuf >> 8, outfile) == EOF) { write_huf_error (ou_f); } if ((putlen -= 8) >= 8) { if (crc_fputc (putbuf, outfile) == EOF) { write_huf_error (ou_f); } codesize += 2; putlen -= 8; putbuf = c << (l - putlen); } else { putbuf <<= 8; codesize++; } } } /* initialization of tree */ static void StartHuff (void) { short i, j; for (i = 0; i < N_CHAR; i++) { freq[i] = 1; fils[i] = i + T; prnt[i + T] = i; } i = 0; j = N_CHAR; while (j <= R) { freq[j] = freq[i] + freq[i + 1]; fils[j] = i; prnt[i] = prnt[i + 1] = j; i += 2; j++; } freq[T] = 0xffff; prnt[R] = 0; } /* reconstruction of tree */ static void reconst (void) { short i, j, k; ushort f, l; /* collect leaf nodes in the first half of the table */ /* and replace the freq by (freq + 1) / 2. */ j = 0; for (i = 0; i < T; i++) { if (fils[i] >= T) { freq[j] = (freq[i] + 1) / 2; fils[j] = fils[i]; j++; } } /* begin constructing tree by connecting sons */ for (i = 0, j = N_CHAR; j < T; i += 2, j++) { k = i + 1; f = freq[j] = freq[i] + freq[k]; for (k = j - 1; f < freq[k]; k--) ; k++; l = (j - k) * 2; memmove (&freq[k + 1], &freq[k], l); freq[k] = f; memmove (&fils[k + 1], &fils[k], l); fils[k] = i; } /* connect prnt */ for (i = 0; i < T; i++) { if ((k = fils[i]) >= T) { prnt[k] = i; } else { prnt[k] = prnt[k + 1] = i; } } } /* increment frequency of given code by one, and update tree */ static void update (short c) { short i, j, k, l; if (freq[R] == MAX_FREQ) { reconst (); } c = prnt[c + T]; do { k = ++freq[c]; /* if the order is disturbed, exchange nodes */ if (k > freq[l = c + 1]) { while (k > freq[++l]) ; l--; freq[c] = freq[l]; freq[l] = k; i = fils[c]; prnt[i] = l; if (i < T) prnt[i + 1] = l; j = fils[l]; fils[l] = i; prnt[j] = c; if (j < T) prnt[j + 1] = c; fils[c] = j; c = l; } } while ((c = prnt[c]) != 0); /* repeat up to root */ } static ushort code, len; static void EncodeChar (ushort c) { ushort i; short j, k; i = 0; j = 0; k = prnt[c + T]; /* travel from leaf to root */ do { i >>= 1; /* if node's address is odd-numbered, choose bigger brother node */ if (k & 1) i += 0x8000; j++; } while ((k = prnt[k]) != R); Putcode (j, i); code = i; len = j; update (c); } static void EncodePosition (ushort c) { ushort i; /* output upper 6 bits by table lookup */ i = c >> 6; Putcode (p_len[i], (ushort) p_code[i] << 8); /* output lower 6 bits verbatim */ Putcode (6, (c & 0x3f) << 10); } static void EncodeEnd (void) { if (putlen) { if (crc_fputc (putbuf >> 8, outfile) == EOF) { write_huf_error (ou_f); } codesize++; } } static short DecodeChar (void) { ushort c; c = fils[R]; /* travel from root to leaf, */ /* choosing the smaller child node (fils[]) if the read bit is 0, */ /* the bigger (fils[]+1} if 1 */ while (c < T) { c += GetBit (); c = fils[c]; } c -= T; update (c); return c; } static short DecodePosition (void) { ushort i, j, c; /* recover upper 6 bits from table */ i = GetByte (); c = (ushort) d_code[i] << 6; j = d_len[i]; /* read lower 6 bits verbatim */ j -= 2; while (j--) { i = (i << 1) + GetBit (); } return c | (i & 0x3f); } /* compression */ static void Encode (short voie) /* compression */ { char temp[128]; long filesize; short i, c, len, r, s, last_match_length; head = bin_header; fflush (infile); #if defined(__MSDOS__) || defined(__WINDOWS__) filesize = filelength (fileno (infile)) + (long) headlen; #else filesize = headlen; /* Read the file to compute the filesize under unix. Terminations = CRLF */ while ((c = getc (infile)) != EOF) { /* Ignore '\r' */ if (c == '\r') continue; /* LF -> CRLF */ if (c == '\n') ++filesize; ++filesize; } rewind (infile); #endif textsize = 0L; /* rewind and re-read */ crc = 0; /* CRC and textsize are 0 : no need to swap them for motorola */ if (basic) { if (fwrite (&textsize, sizeof textsize, 1, outfile) < 1) write_huf_error (ou_f); /* output size of text */ } else { if (fwrite (&crc, sizeof (crc), 1, outfile) < 1) write_huf_error (ou_f); /* output size of text */ memcpy (temp, &filesize, sizeof (filesize)); if (moto) { for (i = sizeof (filesize) -1 ; i >= 0 ; i-- ) crc_fputc (temp[i], outfile); } else { for (i = 0; i < sizeof (filesize); i++) crc_fputc (temp[i], outfile); } } StartHuff (); InitTree (); s = 0; r = N - F; for (i = s; i < r; i++) text_buf[i] = ' '; for (len = 0; len < F && (c = take ()) != EOF; len++) text_buf[r + len] = c; textsize = len; for (i = 1; i <= F; i++) InsertNode (r - i); InsertNode (r); do { if (match_length > len) match_length = len; if (match_length <= THRESHOLD) { match_length = 1; EncodeChar (text_buf[r]); } else { EncodeChar (255 - THRESHOLD + match_length); EncodePosition (match_position); } last_match_length = match_length; for (i = 0; i < last_match_length && (c = take ()) != EOF; i++) { DeleteNode (s); text_buf[s] = c; if (s < F - 1) text_buf[s + N] = c; s = (s + 1) & (N - 1); r = (r + 1) & (N - 1); InsertNode (r); } if ((textsize += i) > printcount) { compress_display (1, (textsize * 100) / filesize, numero); printcount += 500; } while (i++ < last_match_length) { DeleteNode (s); s = (s + 1) & (N - 1); r = (r + 1) & (N - 1); if (--len) InsertNode (r); } } while (len > 0); EncodeEnd (); compress_display (1, 100, numero); /* Ecrit le crc du fichier original */ deb_io (); rewind (outfile); if (basic) { memcpy (temp, &textsize, sizeof (textsize)); if (moto) { for (i = sizeof (textsize) -1 ; i >= 0 ; i-- ) crc_fputc (temp[i], outfile); } else { for (i = 0; i < sizeof (textsize); i++) crc_fputc (temp[i], outfile); } } else { if (moto) crc = xendien (crc); if (fwrite (&crc, sizeof (crc), 1, outfile) < 1) write_huf_error (ou_f); /* output crc */ } if (filesize != textsize) { cprintf ("Phase error !\r\n"); } aff_header (voie); if (numero) sprintf (temp, "Compress #%ld In: %-6ld- Out: %-6ld- Compress: %ld %%\r\n", numero, textsize, codesize, 100L - ((codesize * 100L) / textsize)); else sprintf (temp, "Compress XFwd In: %-6ld- Out: %-6ld- Compress: %ld %%\r\n", textsize, codesize, 100L - ((codesize * 100L) / textsize)); winputs (voie, W_SNDT, temp); textsize = codesize + 4; fin_io (); } void check_bin (bullist * pbul, char *ptr) { #define NB_PATTERN 8 #define LG_PATTERN 6 static char pattern[NB_PATTERN][LG_PATTERN + 1] = { " go_7+", " go_te", "\000\000\000\000\000\000", "\000\000\000\000\000\000", "\000\000\000\000\000\000", "\000\000\000\000\000\000", "\000\000\000\000\000\000", "\000\000\000\000\000\000" }; short i; /* Checks for data message and validates bin flag */ for (i = 0; i < NB_PATTERN; i++) { if (!(*pattern[i])) break; if (strncmp (pattern[i], ptr, LG_PATTERN) == 0) { pbul->bin = 1; } } } static void test_ligne (int voie, char *ligne) { char deb[5]; strn_cpy (4, deb, ligne); if ((svoie[voie]->m_ack) && (strncmp (deb, "/ACK", 4) == 0)) { svoie[voie]->m_ack = 2; } else if ((svoie[voie]->entete) && (strncmp (deb, "R:", 2) == 0)) { analyse_header (voie, ligne); } else if (*ligne) { check_bin (pbul, ligne); svoie[voie]->entete = 0; } } static int Decode (int voie) /* recover */ { char temp[128]; char ligne[82]; short i, j, k, r, c; short pos = 0; ushort fcrc; unsigned long int count; deb_io (); fseek (infile, 0L, 2); codesize = ftell (infile) - sizeof (textsize); if (!basic) { fseek (infile, 20L, 0); textsize = -1; crc = 0; if ((svoie[voie]->fbb >= 2) && (fread (&fcrc, sizeof fcrc, 1, infile) < 1)) { if (!svoie[CONSOLE]->sta.connect) cprintf ("File empty (%ld)!!\r\n", textsize); fin_io (); return (0); } if (moto) fcrc = xendien (fcrc); memset (temp, 0, sizeof (textsize)); if (moto) { for (i = sizeof (textsize) -1 ; i >= 0 ; i-- ) temp[i] = crc_fgetc (infile); } else { for (i = 0; i < sizeof (textsize); i++) temp[i] = crc_fgetc (infile); } memcpy (&textsize, temp, sizeof (textsize)); if ((textsize == 0L) || (textsize == 0xffffffffL)) { if (!svoie[CONSOLE]->sta.connect) cprintf ("File empty (%ld)!!\r\n", textsize); fin_io (); return (0); } if (textsize > (100L * codesize)) { if (!svoie[CONSOLE]->sta.connect) cprintf ("Cannot decompress to %ld bytes!!\r\n", textsize); fin_io (); return (0); } } else { rewind (infile); if ((fread (&textsize, sizeof textsize, 1, infile) < 1) || (textsize == 0)) { if (!svoie[CONSOLE]->sta.connect) cprintf ("File empty (%ld)!!\r\n", textsize); fin_io (); return (0); } if (moto) textsize = xendienl (textsize); if (textsize > (100L * codesize)) { if (!svoie[CONSOLE]->sta.connect) cprintf ("Cannot decompress to %ld bytes!!\r\n", textsize); fin_io (); return (0); } } fin_io (); StartHuff (); for (i = 0; i < N - F; i++) text_buf[i] = ' '; r = N - F; for (count = 0; count < textsize;) { c = DecodeChar (); if (c < 256) { if (!basic) { if ((c == '\r') || (c == '\n')) { ligne[pos] = '\0'; test_ligne (voie, ligne); pos = 0; } else if (pos < 80) { ligne[pos++] = c; } } if ((c == '\n') || (c == '\r')) { if ((crlf == 0) || (crlf == c)) { crlf = c; if (fputc ('\r', outfile) == EOF) { write_huf_error (ou_f); } if (fputc ('\n', outfile) == EOF) { write_huf_error (ou_f); } } } else { crlf = 0; if (fputc (c, outfile) == EOF) { write_huf_error (ou_f); } } text_buf[r++] = c; r &= (N - 1); count++; } else { i = (r - DecodePosition () - 1) & (N - 1); j = c - 255 + THRESHOLD; for (k = 0; k < j; k++) { c = text_buf[(i + k) & (N - 1)]; if (!basic) { if ((c == '\r') || (c == '\n')) { ligne[pos] = '\0'; test_ligne (voie, ligne); pos = 0; } else if (pos < 80) { ligne[pos++] = c; } } /* if (fputc (c, outfile) == EOF) { write_huf_error (ou_f); } */ if ((c == '\n') || (c == '\r')) { if ((crlf == 0) || (crlf == c)) { crlf = c; if (fputc ('\r', outfile) == EOF) { write_huf_error (ou_f); } if (fputc ('\n', outfile) == EOF) { write_huf_error (ou_f); } } } else { crlf = 0; if (fputc (c, outfile) == EOF) { write_huf_error (ou_f); } } text_buf[r++] = c; r &= (N - 1); count++; } } if (count > printcount) { compress_display (2, (count * 100) / textsize, numero); printcount += 500; } } compress_display (2, 100, numero); deb_io (); aff_header (voie); if (numero) sprintf (temp, "Decompress #%ld In: %-6ld- Out: %-6ld- Compress: %ld %%\r\n", numero, codesize, textsize, 100L - ((codesize * 100L) / textsize)); else sprintf (temp, "Decompress XFwd In: %-6ld- Out: %-6ld- Compress: %ld %%\r\n", codesize, textsize, 100L - ((codesize * 100L) / textsize)); winputs (voie, W_RCVT, temp); if ((!basic) && (svoie[voie]->fbb >= 2) && (crc != fcrc)) { if (!svoie[CONSOLE]->sta.connect) cprintf ("CRC Error : file %04x, computed %04x\r\n", fcrc, crc); fin_io (); return (0); } fin_io (); return (1); } void end_lzhuf (void) { if (init_huf) { m_libere (lson, sizeof (short) * (N + 1)); m_libere (rson, sizeof (short) * (N + 257)); m_libere (dad, sizeof (short) * (N + 1)); m_libere (prnt, sizeof (short) * (T + N_CHAR)); m_libere (fils, sizeof (short) * T); m_libere (freq, sizeof (ushort) * (T + 1)); init_huf = 0; } } static void alloue_lzhuf_buffers (void) { lson = (short *) m_alloue (sizeof (short) * (N + 1)); rson = (short *) m_alloue (sizeof (short) * (N + 257)); dad = (short *) m_alloue (sizeof (short) * (N + 1)); prnt = (short *) m_alloue (sizeof (short) * (T + N_CHAR)); fils = (short *) m_alloue (sizeof (short) * T); freq = (ushort *) m_alloue (sizeof (ushort) * (T + 1)); init_huf = 1; } static void init_huffman (void) { static int init = 0; if (!init) { alloue_lzhuf_buffers (); init = 1; } } long lzhuf (desc_huf * huf) { char bin_file[128]; char tmp_file[128]; char asc_file[128]; init_huffman (); basic = 0; crlf = 0; numero = huf->bull->numero; pbul = huf->bull; mess_name (MBINDIR, numero, bin_file); mess_name (MESSDIR, numero, asc_file); if (huf->mode == ENCODE) { temp_name (huf->voie, tmp_file); in_f = asc_file; ou_f = tmp_file; deb_io (); entete_mess_fwd (pbul, huf->header); headlen = scan_header (msg_header); fin_io (); } else if (huf->mode == DECODE) { strcpy (tmp_file, svoie[huf->voie]->sr_fic); in_f = tmp_file; ou_f = asc_file; } if ((outfile = fopen (ou_f, "wb")) == NULL) write_error (ou_f); if ((infile = fopen (in_f, "rb")) == NULL) { fprintf (outfile, "\r\nMessage file %s missing in %s\r\n", in_f, mycall); fclose (outfile); return (40L); } textsize = 0; /* text size counter */ codesize = 0; /* code size counter */ printcount = 0; /* counter for reporting progress every 1K bytes */ getbuf = getlen = putbuf = putlen = 0; if (huf->mode == ENCODE) { Encode (huf->voie); } else if (huf->mode == DECODE) { if (!Decode (huf->voie)) textsize = -1L; } fclose (infile); fclose (outfile); deb_io (); if (huf->mode == ENCODE) { rename_temp (huf->voie, bin_file); } tot_mem = 0; free_mem (); compress_display (0, 0, numero); fin_io (); return (textsize); } long basic_lzhuf (int mode, char *in_file, char *out_file) { chck = 0; basic = 1; crlf = 0; init_huffman (); in_f = in_file; ou_f = out_file; if ((infile = fopen (in_f, "rb")) == NULL) return 0L; if ((outfile = fopen (ou_f, "wb")) == NULL) write_error (ou_f); numero = 0; textsize = 0; /* text size counter */ codesize = 0; /* code size counter */ printcount = 0; /* counter for reporting progress every 1K bytes */ getbuf = getlen = putbuf = putlen = 0; if (mode == ENCODE) { Encode (voiecur); } else if (mode == DECODE) { if (!Decode (voiecur)) textsize = -1L; } fclose (infile); fclose (outfile); tot_mem = 0; free_mem (); compress_display (0, 0, 0); svoie[voiecur]->checksum = chck; return (textsize); } fbb-7.04j/src/maint_fw.c0100644000175100017510000001373207726646105013164 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include static int data_ok(recfwd *prec, int data_mode) { if ((data_mode == 0) && (prec->bin)) return 0; if ((data_mode == 3) && (!prec->bin)) return 0; if ((data_mode == 2) && (prec->bin) && (!PRIVATE (prec->type))) return 0; return 1; } int print_fwd (int nobbs, uchar max, uchar old, uchar typ, int data_mode) { int pos; int noctet; int ok = 0; int pass = 2; int aff = 0; char cmpmsk; recfwd *prec; lfwd *ptr_fwd; rd_list *ptemp = NULL; time_t date = time(NULL) - 3600L * (long)old; unsigned offset; bloc_mess *bptr; bullist bul; libere_tlist (voiecur); noctet = (nobbs - 1) / 8; cmpmsk = 1 << ((nobbs - 1) % 8); ouvre_dir (); if (fast_fwd) { while (pass) { pos = 0; ptr_fwd = tete_fwd; while (1) { aff = 0; if (pos == NBFWD) { ptr_fwd = ptr_fwd->suite; if (ptr_fwd == NULL) break; pos = 0; } prec = &ptr_fwd->fwd[pos]; if (prec->type) { if (data_ok(prec, data_mode)) { if ((prec->fbbs[noctet] & cmpmsk) && (prec->date <= date) && (prec->kb <= max)) { if ((prec->type == 'P') || (prec->type == 'A')) { if (pass == 2) aff = 1; } else { if (pass == 1) aff = 1; } if (aff) { if (ptemp) { ptemp->suite = (rd_list *) m_alloue (sizeof (rd_list)); ptemp = ptemp->suite; } else { pvoie->t_list = ptemp = (rd_list *) m_alloue (sizeof (rd_list)); } ptemp->suite = NULL; ptemp->nmess = prec->nomess; ptemp->verb = 1; ok = 1; } } } } pos++; } if (typ) break; --pass; } } else { while (pass) { offset = 0; bptr = tete_dir; while (bptr) { if (bptr->st_mess[offset].noenr) { read_dir (bptr->st_mess[offset].noenr, &bul); if (bul.type) { int kb = (int) (bul.taille >> 10); if ((bul.fbbs[noctet] & cmpmsk) && (bul.date <= date) && (kb <= max)) { if ((bul.type == 'P') || (bul.type == 'A')) { if (pass == 2) aff = 1; } else { if (pass == 1) aff = 1; } if (aff) { if (ptemp) { ptemp->suite = (rd_list *) m_alloue (sizeof (rd_list)); ptemp = ptemp->suite; } else { pvoie->t_list = ptemp = (rd_list *) m_alloue (sizeof (rd_list)); } ptemp->suite = NULL; ptemp->nmess = bul.numero; ptemp->verb = 1; ok = 1; } } } } if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } } if (typ) break; --pass; } } ferme_dir (); maj_niv (N_MBL, 16, 0); mess_liste (1); return (ok); } #if 0 int print_fwd (int nobbs, uchar max, uchar typ) { int pos; int noctet; int ok = 0; int pass = 2; int aff; char cmpmsk; rd_list *ptemp = NULL; unsigned offset; bloc_mess *bptr; bullist bul; libere_tlist (voiecur); pos = 0; noctet = (nobbs - 1) / 8; cmpmsk = 1 << ((nobbs - 1) % 8); ouvre_dir (); while (pass) { offset = 0; bptr = tete_dir; while (bptr) { if (bptr->st_mess[offset].noenr) { read_dir (bptr->st_mess[offset].noenr, &bul); if (bul.type) { int kb = (int) (bul.taille >> 10); if ((bul.fbbs[noctet] & cmpmsk) && (kb <= max)) { if ((bul.type == 'P') || (bul.type == 'A')) { if (pass == 2) aff = 1; } else { if (pass == 1) aff = 1; } if (aff) { if (ptemp) { ptemp->suite = (rd_list *) m_alloue (sizeof (rd_list)); ptemp = ptemp->suite; } else { pvoie->t_list = ptemp = (rd_list *) m_alloue (sizeof (rd_list)); } ptemp->suite = NULL; ptemp->nmess = bul.numero; ptemp->verb = 1; ok = 1; } } } } if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } } if (typ) break; --pass; } ferme_dir (); maj_niv (N_MBL, 16, 0); mess_liste (1); return (ok); } #endif void maj_fwd (void) { int i, nb = 5; char temp[NBMASK]; df ("maj_fwd", 0); ouvre_dir (); selvoie (CONSOLE); vlang = 0; pvoie->mode |= F_FOR; while (nb) { if (read_dir (p_forward, ptmes) == 0) { p_forward = 0; maj_options (); aff_etat ('A'); aff_nbsta (); break; } if ((*ptmes->bbsv) && (ptmes->status != 'H') && ((ptmes->status == 'N') || (ptmes->status == 'Y') || (ptmes->status == '$') )) { aff_etat ('O'); nb = 0; for (i = 0; i < NBMASK; i++) { temp[i] = ptmes->fbbs[i]; ptmes->fbbs[i] = '\0'; } test_forward (2); if (memcmp (ptmes->fbbs, temp, NBMASK) != 0) { clear_fwd (ptmes->numero); ins_fwd (ptmes); write_dir (p_forward, ptmes); } } else --nb; ++p_forward; } ferme_dir (); ff (); } fbb-7.04j/src/maintinf.c0100644000175100017510000003022507726646105013161 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #define ENGLISH #ifdef __LINUX__ #include #include #include #define __NO_CTYPE #define INF_NEW "inf.new" #define INF_SYS "inf.sys" #define __a2__ __attribute__ ((packed, aligned(2))) #else #define __a2__ #define INF_NEW "inf.new" #define INF_SYS "inf.sys" #endif #include #include #include #include "version.h" #include #define FALSE 0 #define TRUE 1 #define uchar unsigned char #define ushort unsigned short #define EXCLUDED(buf) (buf.flags & 0x1) typedef struct typindic { char call[7]; char num; } indicat; typedef struct { indicat indic; /* 8 Callsign */ indicat relai[8]; /* 64 Digis path */ long lastmes __a2__; /* 4 Last L number */ long nbcon __a2__; /* 4 Number of connexions */ long hcon __a2__; /* 4 Last connexion date */ long lastyap __a2__; /* 4 Last YN date */ ushort flags; /* 2 Flags */ ushort on_base; /* 2 ON Base number */ uchar nbl; /* 1 Lines paging */ uchar lang; /* 1 Language */ long newbanner __a2__; /* 4 Last Banner date */ ushort download; /* 2 download size (KB) = 100 */ char free[20]; /* 20 Reserved */ char theme; /* 1 Current topic */ char nom[18]; /* 18 1st Name */ char prenom[13]; /* 13 Christian name */ char adres[61]; /* 61 Address */ char ville[31]; /* 31 City */ char teld[13]; /* 13 home phone */ char telp[13]; /* 13 modem phone */ char home[41]; /* 41 home BBS */ char qra[7]; /* 7 Qth Locator */ char priv[13]; /* 13 PRIV directory */ char filtre[7]; /* 7 LC choice filter */ char pass[13]; /* 13 Password */ char zip[9]; /* 9 Zipcode */ } info; /* Total : 360 bytes */ typedef struct typindictri { char indic[7]; long pos; struct typindictri *suiv; } indictri; FILE *fichi, *ficho; char temp[500]; char system_dir[256]; indictri *tete; int rejet, nbindic; int ext_call = 0; static void defauts (void); static int find (char *s); static void check (info * bul); static void err_alloc (void); static void insere (char *ind, long pos); static void ouvre_nomenc (void); #ifdef __LINUX__ char *strupr (char *txt) { char *scan = txt; while (*scan) { if (islower (*scan)) *scan = toupper (*scan); ++scan; } return (txt); } char *strlwr (char *txt) { char *scan = txt; while (*scan) { if (isupper (*scan)) *scan = tolower (*scan); ++scan; } return (txt); } #endif char *test_back_slash (char *chaine) { if ((strlen(chaine) == 0) #ifdef __LINUX__ || (chaine[strlen (chaine) - 1] != '/')) strcat(chaine, "/"); #else || (chaine[strlen (chaine) - 1] != '\\')) strcat(chaine, "\\"); #endif return (chaine); } void err_keyword(char *keyword) { fprintf(stderr, "Error : keyword \"%s\"missing in fbb.conf file\n", keyword); exit(1); } void epure (char *ligne) { int lg; lg = strlen (ligne); if (ligne[lg - 1] == '\n') ligne[lg - 1] = '\0'; lg = strlen (ligne); if (ligne[lg - 1] == '\r') ligne[lg - 1] = '\0'; if (*ligne == '\032') *ligne = '\0'; } int main (int ac, char **av) { int rep; int auto_rep = 0; int monthes; info buf; long rinfo = 0; long i = 0; indictri *ptr; long temps = time (NULL); long timout; #ifdef LETTRE fprintf (stderr, "\nMAINTINF V %d.%02d%c\n\n", MAJEUR, MINEUR, LETTRE); #else fprintf (stderr, "\nMAINTINF V %d.%02d\n\n", MAJEUR, MINEUR); #endif #ifdef ENGLISH fprintf (stderr, "FBB software MUST be stopped !! \n\n"); #else fprintf (stderr, "Le logiciel FBB Doit etre arrt !!\n\n"); #endif defauts (); rejet = nbindic = 0; timout = 86400L * 31L; /* 31 jours / mois */ if (ac == 1) { #ifdef ENGLISH fprintf (stderr, "Format : MAINTINF Monthes [/A]\n\nMonthes is \"time check\" to kill old callsigns (0 = no check) \n \n"); #else fprintf (stderr, "Format : MAINTINF Mois [/A]\n\nMois est le \"Test des dates\" pour supprimer les indicatifs obsoletes\n(0 = pas de test)\n"); #endif exit (0); } monthes = atoi (av[1]); timout *= monthes; if (ac >= 3) { ext_call = (strcmp (strupr (av[2]), "/N") == 0); if (ext_call) { --ac; ++av; #ifdef ENGLISH printf ("No callsign check \n"); #else printf ("Pas de test d'indicatif\n"); #endif } } if (ac == 3) auto_rep = (strcmp (strupr (av[2]), "/A") == 0); #ifdef ENGLISH if (monthes) printf ("Time check : %d monthes\n", monthes); else printf ("No Time check \n"); #else if (monthes) printf ("Test dates : %d mois \n", monthes); else printf ("Pas de test dates\n"); #endif sleep (2); ouvre_nomenc (); if ((tete = (indictri *) malloc (sizeof (indictri))) == NULL) err_alloc (); tete->suiv = NULL; rewind (fichi); while (fread ((char *) &buf, (int) sizeof (buf), 1, fichi)) { if ((!EXCLUDED (buf)) && (timout) && ((temps - buf.hcon) > timout)) { #ifdef ENGLISH printf ("rejects <%s> : Old callsign \n", buf.indic.call); #else printf ("rejte <%s> : Indicatif inusit\n", buf.indic.call); #endif ++rejet; } else if (find (buf.indic.call)) { insere (buf.indic.call, rinfo); } else { #ifdef ENGLISH printf ("rejects <%s> : Incorrect callsign\n", buf.indic.call); #else printf ("rejte <%s> : Indicatif incorrect\n", buf.indic.call); #endif ++rejet; } ++rinfo; } #ifdef ENGLISH printf ("%d callsigns ok \n", nbindic); printf ("%d callsigns rejected\n", rejet); printf ("---------------------------------------------\n\n"); #else printf ("%d indicatifs inseres\n", nbindic); printf ("%d indicatifs rejetes\n", rejet); printf ("---------------------------------- \n\n"); #endif if (!auto_rep) { while (TRUE) { #ifdef ENGLISH fprintf (stderr, "Create %s (Y/N) : ", INF_NEW); #else fprintf (stderr, "Creation de %s (O/N) : ", INF_NEW); #endif rep = getchar (); #ifdef ENGLISH if ((rep == 'y') || (rep == 'Y') || (rep == 'n') || (rep == 'N')) #else if ((rep == 'o') || (rep == 'O') || (rep == 'n') || (rep == 'N')) #endif break; } putchar ('\n'); } #ifdef ENGLISH if ((auto_rep) || (toupper (rep) == 'Y')) { #else if ((auto_rep) || (toupper (rep) == 'O')) { #endif char filename[256]; sprintf (filename, "%s%s", system_dir, INF_NEW); if ((ficho = fopen (filename, "wb")) == NULL) { #ifdef ENGLISH fprintf (stderr, "Error creating %s \n", filename); #else fprintf (stderr, "Impossible de creer %s\n", filename); #endif } else { ptr = tete; while ((ptr = ptr->suiv) != NULL) { fseek (fichi, ptr->pos * (long) sizeof (buf), 0); fread (&buf, sizeof (buf), 1, fichi); check (&buf); fwrite (&buf, sizeof (buf), 1, ficho); if ((++i % 10) == 0) #ifdef ENGLISH fprintf (stderr, "\r%ld callsigns ", i); #else fprintf (stderr, "\r%ld indicatifs ", i); #endif } #ifdef ENGLISH fprintf (stderr, "\r%ld callsigns ", i); #else fprintf (stderr, "\r%ld indicatifs ", i); #endif fclose (ficho); fputc ('\r', stderr); } #ifdef ENGLISH printf ("\nFile %s created\n\n", INF_NEW); printf ("\nYou must now change %s with %s !!\n", INF_SYS, INF_NEW); printf ("---------------------------------------------\n\n"); #else printf ("\nFichier %s cr\n\n", INF_NEW); printf ("\nRemplacer %s par %s !! \n", INF_SYS, INF_NEW); printf ("---------------------------------- \n\n"); #endif } fclose (fichi); return 0; } static void check (info * bul) { int i; bul->indic.call[6] = '\0'; for (i = 0; i < 8; i++) bul->relai[i].call[6] = '\0'; bul->nom[17] = '\0'; bul->prenom[12] = '\0'; bul->adres[60] = '\0'; bul->ville[30] = '\0'; bul->teld[12] = '\0'; bul->telp[12] = '\0'; bul->home[40] = '\0'; bul->qra[6] = '\0'; bul->priv[12] = '\0'; bul->filtre[6] = '\0'; bul->pass[12] = '\0'; bul->zip[8] = '\0'; if ((bul->nbcon < 0) || (bul->nbcon > 100000L)) bul->nbcon = 0L; if ((bul->nbl < (uchar) 4) || (bul->nbl > (uchar) 50)) bul->nbl = (uchar) 25; if (bul->lang > (uchar) 99) bul->lang = (uchar) 1; } static void insere (char *ind, long pos) { int cmp; indictri *pprec, *ptr, *ptemp; pprec = ptr = tete; while ((ptr = ptr->suiv) != NULL) { cmp = strcmp (ind, ptr->indic); if (cmp == 0) { printf ("rejects <%s> : already inserted\n", ind); ++rejet; return; } else if (cmp < 0) break; pprec = ptr; } if ((ptemp = (indictri *) malloc (sizeof (indictri))) == NULL) err_alloc (); ++nbindic; ptemp->suiv = ptr; pprec->suiv = ptemp; ptemp->pos = pos; strcpy (ptemp->indic, ind); } static int find (char *s) { char *t = s; int n = 0; int dernier = 0, chiffre = 0, lettre = 0; while (*t) { if (!isalnum (*t)) return (FALSE); *t = toupper (*t); dernier = (isdigit (*t)); if (isdigit (*t)) ++chiffre; else ++lettre; ++t; ++n; } /* * L'indicatif doit avoir entre 3 et 6 caracteres . * doit contenir 1 ou 2 chiffres . * ne doit pas se terminer par un chiffre . */ if (ext_call) { /* * L'indicatif doit avoir entre 3 et 6 caracteres . * doit contenir au moins un chiffre * doit contenir au moins une lettre */ if ((n < 3) || (n > 6) || (chiffre < 1) || (lettre < 1)) return (0); } else { /* * L'indicatif doit avoir entre 3 et 6 caracteres . * doit contenir 1 ou 2 chiffres . * ne doit pas se terminer par un chiffre . */ if ((n < 3) || (n > 6) || (chiffre < 1) || (chiffre > 2) || dernier) return (0); } t = temp; while (isalnum (*s)) *t++ = *s++; *t = '\0'; t = temp; return (TRUE); } static void ouvre_nomenc (void) { char filename[256]; sprintf (filename, "%s%s", system_dir, INF_SYS); if ((fichi = fopen (filename, "rb")) == NULL) { #ifdef ENGLISH fprintf (stderr, "Cannot find %s !! \n", filename); #else fprintf (stderr, "Erreur ouverture %s !!\n", filename); #endif exit (1); } } static void err_alloc (void) { #ifdef ENGLISH fprintf (stderr, "Memory allocation error \n"); #else fprintf (stderr, "Erreur allocation memoire\n"); #endif exit (1); } static void defauts (void) { unsigned int flag; char *ptr; char temp[20]; if (read_fbb_conf(NULL) > 0) { #ifdef ENGLISH fprintf (stderr, "Cannot open fbb.conf file \n"); #else fprintf (stderr, "Erreur ouverture fichier fbb.conf\n"); #endif exit (1); /* and users base directory */ } ptr = find_fbb_conf("vers", 0); if (ptr == NULL) { #ifdef ENGLISH fprintf (stderr, "Version number missing in fbb.conf\n"); #else fprintf (stderr, "Pas de numro dans le fbb.conf\n"); #endif exit (1); } sprintf (temp, "FBB%d.%02d", MAJEUR, MINEUR); if (strncasecmp (temp, ptr, 7) != 0) { #ifdef ENGLISH fprintf (stderr, "Wrong version number in fbb.conf\n"); #else fprintf (stderr, "Numro de version erron dans fbb.conf\n"); #endif exit (1); } fprintf (stderr, "Configuration version : %s\r\n", ptr); /* path of conf files */ ptr = find_fbb_conf("data", 0); if (ptr == NULL) ptr = def_fbb_conf("data"); if (ptr == NULL) err_keyword("data"); strcpy (system_dir, test_back_slash(strlwr (ptr))); /* flags */ ptr = find_fbb_conf("fbbf", 0); if (ptr == NULL) ptr = def_fbb_conf("fbbf"); if (ptr == NULL) err_keyword("fbbf"); flag = 0; sscanf (ptr, "%s %u", temp, &flag); ext_call = ((flag & 4096) != 0); } fbb-7.04j/src/mbl_edit.c0100644000175100017510000004623507726646105013143 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* * Module MBL_EDIT.C */ static void ch_home (ind_noeud *, info *); static void ch_password (ind_noeud *, info *); static void ch_prenom (ind_noeud *, info *); static void ch_private (ind_noeud *, info *); static void ch_zip (ind_noeud *, info *); static void header_edit (void); static void modif_header (void); static void modif_user (info *); static void user_edit (void); static void option_edit (void); static char *lit_ind (char *); static int lit_prenom (void); static int lit_homebbs (void); static int lit_locator (void); static int lit_zip (void); #include "aff_stat.c" int mbl_edit (void) { int error = 0; if (pvoie->niv3 == 0) { switch (toupper (*indd)) { case ' ': ch_niv3 (20); pvoie->typlist = 0; header_edit (); break; case 'O': ch_niv3 (40); option_edit (); break; case 'U': ch_niv3 (0); user_edit (); break; case 'M': if (voiecur == CONSOLE) { ++indd; if ((teste_espace ()) && (*indd) && (*indd == '#' || isdigit (*indd))) { if ((pvoie->nmess = lit_chiffre (1)) != 0L) { if (ch_record (ptmes, pvoie->nmess, '\0')) { reply = 4; pvoie->enrcur = pvoie->nmess; #ifdef __WINDOWS__ if (win_edit () == 5) end_win_edit (); error = 0; #endif #ifdef __LINUX__ error = 1; #endif #ifdef __FBBDOS__ if (mini_edit () == 5) end_mini_edit (); error = 0; #endif break; } else { ptmes->numero = pvoie->nmess; texte (T_ERR + 10); } } else texte (T_ERR + 3); } else texte (T_ERR + 3); retour_mbl (); } else error = 1; break; default: /* varx[0][0] = 'E' ; strn_cpy(79, varx[0] + 1, indd) ; texte(T_ERR + 1) ; retour_mbl() ; */ error = 1; break; } } else { if (*indd) indd[strlen (indd) - 1] = '\0'; switch (pvoie->niv3 / 20) { case 0: user_edit (); break; case 1: header_edit (); break; case 2: option_edit (); break; } } return (error); } static void option_display(void) { char buf[80]; int i; i = sprintf(buf, "System Options : "); buf[i++] = (bip) ? 'B' : '.'; buf[i++] = (gate) ? 'G' : '.'; buf[i++] = (sed) ? 'M' : '.'; buf[i++] = (ok_tell) ? 'T' : '.'; buf[i++] = (aff_inexport) ? 'X' : '.'; buf[i++] = (aff_popsmtp) ? 'P' : '.'; buf[i] = '\0'; outln(buf, strlen(buf)); sprintf(buf, "(B)eep, (T)alk, (G)ateway, (M)sgEdit, e(X)port, (P)opSmtp : "); out(buf, strlen(buf)); } static void option_edit (void) { int ok; switch (pvoie->niv3) { case 40: option_display(); ch_niv3 (41); break; case 41: if (*indd) { ok = 1; if (islower(*indd)) *indd = toupper(*indd); switch (*indd) { case 'B' : bip = !bip; break; case 'G' : gate = !gate; break; case 'M' : sed = !sed; break; case 'T' : ok_tell = !ok_tell; break; case 'X' : aff_inexport = !aff_inexport; break; case 'P' : aff_popsmtp = !aff_popsmtp; break; default : texte (T_ERR + 0); ok = 0; break; } if (ok) maj_options(); option_display(); } else retour_mbl (); break; } } static void header_edit (void) { switch (pvoie->niv3) { case 20: if ((teste_espace ()) && (*indd) && (*indd == '#' || isdigit (*indd))) { if ((pvoie->nmess = lit_chiffre (1)) != 0L) { if (ch_record (ptmes, pvoie->nmess, '\0')) { entete_liste (); aff_status (ptmes); texte (T_MBL + 39); texte (T_MBL + 27); ch_niv3 (21); break; } else { ptmes->numero = pvoie->nmess; texte (T_ERR + 10); } } else texte (T_ERR + 3); } else texte (T_ERR + 3); retour_mbl (); break; case 21: if (*indd) { modif_header (); entete_liste (); aff_status (ptmes); texte (T_MBL + 39); texte (T_MBL + 27); } else retour_mbl (); break; } } static void modif_header (void) { char c; int i; char *sptr; unsigned num_indic; ind_noeud *noeud; while_space (); c = toupper (*indd); incindd (); switch (c) { case 'T': /* Desti */ if ((sptr = lit_ind (indd)) != NULL) { noeud = insnoeud (ptmes->desti, &num_indic); if (ptmes->status == 'N') --(noeud->nbnew); --(noeud->nbmess); strcpy (ptmes->desti, sptr); ptmes->status = 'N'; maj_rec (pvoie->nmess, ptmes); num_indic = insarbre (ptmes); chg_mess (num_indic, ptmes->numero); ins_iliste (ptmes); } else texte (T_ERR + 0); break; case 'V': /* Via */ if (*indd) { if (*indd == '.') *ptmes->bbsv = '\0'; else strn_cpy (39, ptmes->bbsv, indd); clear_fwd (ptmes->numero); for (i = 0; i < NBMASK; i++) { ptmes->forw[i] = ptmes->fbbs[i] = '\0'; } if (ptmes->type == 'B') ptmes->status = '$'; else { if (ptmes->status != 'N') { /* increment counter of new messages */ noeud = insnoeud (ptmes->desti, &num_indic); ++(noeud->nbnew); aff_msg_cons (); } ptmes->status = 'N'; } if (*ptmes->bbsv) { swapp_bbs (ptmes); if (cherche_route (ptmes)) { texte (T_MBL + 41); } if (test_forward (1)) ins_fwd (ptmes); cr (); } maj_rec (pvoie->nmess, ptmes); } break; case 'F': /* Exped */ if (*indd) { if ((sptr = lit_ind (indd)) != NULL) { strcpy (ptmes->exped, sptr); maj_rec (pvoie->nmess, ptmes); } else texte (T_ERR + 0); } break; case 'I': /* Titre */ if (*indd) { n_cpy (60, ptmes->titre, indd); maj_rec (pvoie->nmess, ptmes); } break; case 'Y': /* Type */ if (*indd) { *indd = toupper (*indd); if (*indd == 'A' || *indd == 'B' || *indd == 'P' || *indd == 'T') { ptmes->type = *indd; maj_rec (pvoie->nmess, ptmes); } else texte (T_ERR + 0); } break; case 'B': /* Bid */ if (*indd) { strn_cpy (12, ptmes->bid, indd); maj_rec (pvoie->nmess, ptmes); } break; case 'S': /* Status */ if (*indd) { *indd = toupper (*indd); noeud = insnoeud (ptmes->desti, &num_indic); if ((ptmes->status == 'N') && (*indd != 'N')) { --(noeud->nbnew); } else if ((ptmes->status != 'N') && (*indd == 'N')) { ++(noeud->nbnew); } if ((ptmes->status != 'A') && (ptmes->status != 'K') && ((*indd == 'A') || (*indd == 'K'))) { --(noeud->nbmess); chg_mess (0xffff, ptmes->numero); } else if (((ptmes->status == 'A') || (ptmes->status == 'K')) && (*indd != 'A') && (*indd != 'K')) { ++(noeud->nbmess); chg_mess (num_indic, ptmes->numero); } if (*indd == 'Y' || *indd == 'F' || *indd == 'N' || *indd == '$' || *indd == 'K' || *indd == 'A') { ptmes->status = *indd; /* if (ptmes->status == 'H') { for (i = 0 ; i < NBMASK ; i++) ptmes->fbbs[i] = '\0'; } */ maj_rec (pvoie->nmess, ptmes); aff_msg_cons (); } else texte (T_ERR + 0); } break; default: /* Erreur */ texte (T_ERR + 0); break; } } void ch_info (void) { FILE *fptr; unsigned r = pvoie->ncur->coord; if (r == 0xffff) dump_core (); fptr = ouvre_nomenc (); fseek (fptr, ((long) r) * ((long) sizeof (info)), 0); fwrite ((char *) &(pvoie->finf), (int) sizeof (info), 1, fptr); ferme (fptr, 19); } static char *lit_ind (char *indic) { while ((*indic) && (!ISGRAPH (*indic))) ++indic; strupr (indic); if (strlen (indic) > 6) return (NULL); return (indic); } int tstqra (qra) char *qra; { if (strlen (qra) == 6) return (isalpha (qra[0]) && isalpha (qra[1]) && isdigit (qra[2]) && isdigit (qra[3]) && isalpha (qra[4]) && isalpha (qra[5])); else return (0); } static int lit_locator (void) { char s[80]; if (ISGRAPH (*indd)) { strupr (epure (s, 6)); if ((*s == '.') || tstqra (s)) { if (*s == '.') { s[0] = '?'; s[1] = '\0'; } strcpy (pvoie->finf.qra, s); return (2); } else { texte (T_NOM + 14); } } return (1); } static int lit_zip (void) { char s[80]; if (ISGRAPH (*indd)) { strupr (epure (s, 8)); if (*s == '.') *s = '\0'; strcpy (pvoie->finf.zip, s); user_wp (&pvoie->finf); /* pvoie->wp = 1; */ return (2); } return (1); } static int lit_qth (void) { char s[80]; if (ISGRAPH (*indd)) { epure (s, 30); if (*s == '.') *s = '\0'; strcpy (pvoie->finf.ville, s); user_wp (&pvoie->finf); /* pvoie->wp = 1; */ return (2); } return (1); } static int lit_homebbs (void) { char s[80]; char temp[80]; char *ptr; if (ISGRAPH (*indd)) { strupr (epure (s, 40)); if (*s == '.') *s = '\0'; /* Seul l'indicatif est enregistre */ ptr = strchr (s, '.'); if (ptr) *ptr = '\0'; /* Pas de SSID */ ptr = strchr (s, '-'); if (ptr) *ptr = '\0'; strcpy (temp, s); if (find (temp)) { /* Seul l'indicatif est enregistre */ strcpy (pvoie->finf.home, s); user_wp (&pvoie->finf); /* pvoie->wp = 1; */ return (2); } else texte (T_ERR + 7); } return (1); } static int lit_prenom (void) { info frec; if (ISGRAPH (*indd)) { ch_prenom (pvoie->ncur, &frec); strcpy (pvoie->finf.prenom, frec.prenom); return (2); } return (1); } int mbl_name (void) { int modif = 0; int error = 0; switch (pvoie->niv3) { case 0: if (toupper (*indd) == 'P') { int p = no_port (voiecur); if ((p_port[p].typort == TYP_MOD) || (p_port[p].typort == TYP_TCP)) { if (read_only ()) { modif = 1; break; } out ("Enter old password :", 20); maj_niv (N_MOD, 3, 0); } else error = 1; } else if (toupper (*indd) == 'L') { if (read_only ()) { modif = 1; break; } ++indd; if (teste_rep (sup_ln (indd))) { incindd (); modif = lit_locator (); } else { texte (T_NOM + 11); ch_niv3 (2); } } else if (toupper (*indd) == 'Q') { if (read_only ()) { modif = 1; break; } ++indd; if (teste_rep (sup_ln (indd))) { incindd (); modif = lit_qth (); } else { texte (T_NOM + 8); ch_niv3 (5); } } else if (toupper (*indd) == 'Z') { if (read_only ()) { modif = 1; break; } ++indd; if (teste_rep (sup_ln (indd))) { incindd (); modif = lit_zip (); } else { texte (T_MBL + 54); ch_niv3 (3); } } else if (toupper (*indd) == 'H') { if (read_only ()) { modif = 1; break; } ++indd; if (teste_rep (sup_ln (indd))) { incindd (); modif = lit_homebbs (); } else { texte (T_MBL + 53); ch_niv3 (4); } } else if (!ISGRAPH (*indd)) { if (read_only ()) { modif = 1; break; } if (teste_rep (sup_ln (indd))) { incindd (); modif = lit_prenom (); } else { texte (T_MBL + 9); ch_niv3 (1); } } else error = 1; break; case 1: modif = lit_prenom (); break; case 2: modif = lit_locator (); break; case 3: modif = lit_zip (); break; case 4: modif = lit_homebbs (); break; case 5: modif = lit_qth (); break; } if (modif) { if (modif == 2) { ch_info (); texte (T_MBL + 10); } retour_mbl (); } return (error); } static void ch_private (ind_noeud * noeud, info * frec) { FILE *fptr; fptr = ouvre_nomenc (); if (noeud->coord == 0xffff) dump_core (); fseek (fptr, ((long) noeud->coord * sizeof (info)), 0); fread (frec, sizeof (info), 1, fptr); /* strupr (indd); */ if (!iscntrl (*indd)) { if (*indd == '.') *indd = '\0'; epure (frec->priv, 12); fseek (fptr, ((long) noeud->coord * sizeof (info)), 0); fwrite (frec, sizeof (info), 1, fptr); } ferme (fptr, 36); } static void ch_home (ind_noeud * noeud, info * frec) { char *ptr; char temp[80]; FILE *fptr; if (noeud->coord == 0xffff) dump_core (); fptr = ouvre_nomenc (); fseek (fptr, ((long) noeud->coord * sizeof (info)), 0); fread (frec, sizeof (info), 1, fptr); if (!iscntrl (*indd)) { strupr (indd); if (*indd == '.') *indd = '\0'; ptr = strchr (indd, '.'); if (ptr) *ptr = '\0'; ptr = strchr (indd, '-'); if (ptr) *ptr = '\0'; strn_cpy (40, temp, indd); if (find (temp)) { epure (frec->home, 40); fseek (fptr, ((long) noeud->coord * sizeof (info)), 0); fwrite (frec, sizeof (info), 1, fptr); user_wp (frec); /* pvoie->wp = 1; */ } else texte (T_ERR + 7); } ferme (fptr, 36); } static void ch_zip (ind_noeud * noeud, info * frec) { FILE *fptr; char *scan; if (noeud->coord == 0xffff) dump_core (); fptr = ouvre_nomenc (); fseek (fptr, ((long) noeud->coord * sizeof (info)), 0); fread (frec, sizeof (info), 1, fptr); strupr (indd); if (!iscntrl (*indd)) { if (*indd == '.') *indd = '\0'; epure (frec->zip, 8); scan = frec->zip; while (*scan) { if (*scan == ' ') *scan = '-'; ++scan; } fseek (fptr, ((long) noeud->coord * sizeof (info)), 0); fwrite (frec, sizeof (info), 1, fptr); user_wp (frec); /* pvoie->wp = 1; */ } ferme (fptr, 36); } static void ch_password (ind_noeud * noeud, info * frec) { FILE *fptr; if (noeud->coord == 0xffff) dump_core (); fptr = ouvre_nomenc (); fseek (fptr, ((long) noeud->coord * sizeof (info)), 0); fread (frec, sizeof (info), 1, fptr); strupr (indd); if (!iscntrl (*indd)) { if (*indd == '.') *indd = '\0'; epure (frec->pass, 12); fseek (fptr, ((long) noeud->coord * sizeof (info)), 0); fwrite (frec, sizeof (info), 1, fptr); } ferme (fptr, 36); } static void ch_prenom (ind_noeud * noeud, info * frec) { FILE *fptr; char *scan; if (noeud->coord == 0xffff) dump_core (); fptr = ouvre_nomenc (); fseek (fptr, ((long) noeud->coord * sizeof (info)), 0); fread (frec, sizeof (info), 1, fptr); if (!iscntrl (*indd)) { if (*indd == '.') *indd = '\0'; epure (frec->prenom, 12); scan = frec->prenom; while (*scan) { if (*scan == ' ') *scan = '-'; ++scan; } fseek (fptr, ((long) noeud->coord * sizeof (info)), 0); fwrite (frec, sizeof (info), 1, fptr); user_wp (frec); /* pvoie->wp = 1; */ } ferme (fptr, 36); } static void user_edit (void) { int voie; char s[80]; char *ind, *ptr; indicat indic; unsigned num_indic; FILE *fptr; info frec; sup_ln (indd); switch (pvoie->niv3) { case 0: ++indd; if ((teste_espace ()) && (*indd) && find (indd)) { /* if (num_voie(indd) != -1) { texte(T_MBL + 24) ; retour_mbl() ; break ; } */ pvoie->emis = insnoeud (indd, &num_indic); if (pvoie->emis->coord == 0xffff) { var_cpy (0, indd); texte (T_MBL + 29); } else { fptr = ouvre_nomenc (); fseek (fptr, (long) pvoie->emis->coord * sizeof (frec), 0); fread (&frec, sizeof (info), 1, fptr); ferme (fptr, 39); texte (T_MBL + 11); affiche_user (&frec, 1); var_cpy (0, indd); texte (T_MBL + 30); } ch_niv3 (1); break; } else texte (T_ERR + 7); retour_mbl (); break; case 1: if (toupper (*indd) == Oui) { if (pvoie->emis->coord == 0xffff) { pvoie->emis->coord = rinfo++; /* cprintf("Rinfo : %ld\r\n", rinfo) ; */ ind = s; ptr = pvoie->emis->indic; pvoie->emis->val = 1; /* *ind++ = *ptr++; if (pvoie->emis->lettre) *ind++ = pvoie->emis->lettre ; */ while ((*ind++ = *ptr++) != '\0'); indic.num = extind (s, indic.call); init_info (&frec, &indic); if (pvoie->emis->coord == 0xffff) dump_core (); fptr = ouvre_nomenc (); fseek (fptr, (long) pvoie->emis->coord * ((long) sizeof (info)), 0); fwrite ((char *) &frec, (int) sizeof (info), 1, fptr); ferme (fptr, 40); texte (T_MBL + 11); affiche_user (&frec, 1); texte (T_MBL + 28); ch_niv3 (2); break; } else { if (pvoie->emis->coord == 0xffff) dump_core (); fptr = ouvre_nomenc (); fseek (fptr, (long) pvoie->emis->coord * ((long) sizeof (info)), 0); fread ((char *) &frec, sizeof (info), 1, fptr); *(frec.indic.call) = '\0'; fseek (fptr, (long) pvoie->emis->coord * ((long) sizeof (info)), 0); fwrite ((char *) &frec, (int) sizeof (info), 1, fptr); ferme (fptr, 41); pvoie->emis->coord = 0xffff; retour_mbl (); } } else { if (pvoie->emis->coord == 0xffff) retour_mbl (); else { texte (T_MBL + 28); ch_niv3 (2); } } break; case 2: if (*indd) { fptr = ouvre_nomenc (); fseek (fptr, (long) pvoie->emis->coord * sizeof (frec), 0); fread (&frec, sizeof (info), 1, fptr); ferme (fptr, 39); modif_user (&frec); texte (T_MBL + 11); affiche_user (&frec, 1); texte (T_MBL + 28); for (voie = 0; voie < NBVOIES; ++voie) { if (svoie[voie]->sta.connect && indcmp (svoie[voie]->sta.indicatif.call, frec.indic.call)) { svoie[voie]->finf = frec; } } } else retour_mbl (); break; } } static void modif_user (info * frec) { char c; while_space (); c = toupper (*indd); incindd (); switch (c) { case 'B': ch_bit (pvoie->emis, frec, F_BBS, '\0'); break; case 'E': ch_bit (pvoie->emis, frec, F_EXC, '\0'); break; case 'G': if (isdigit (*indd)) { ch_language (atoi (indd), pvoie->emis, frec); } break; case 'F': ch_bit (pvoie->emis, frec, F_PMS, '\0'); break; case 'H': ch_home (pvoie->emis, frec); break; case 'I': ch_bit (pvoie->emis, frec, F_NEW, '\0'); break; case 'L': ch_bit (pvoie->emis, frec, F_LOC, '\0'); break; case 'M': ch_bit (pvoie->emis, frec, F_MOD, '\0'); break; case 'N': ch_prenom (pvoie->emis, frec); break; case 'P': ch_bit (pvoie->emis, frec, F_PAG, '\0'); break; case 'R': ch_bit (pvoie->emis, frec, F_PRV, '\0'); break; case 'S': ch_bit (pvoie->emis, frec, F_SYS, '\0'); break; case 'U': ch_bit (pvoie->emis, frec, F_UNP, '\0'); break; case 'V': ch_private (pvoie->emis, frec); break; case 'W': ch_password (pvoie->emis, frec); break; case 'X': ch_bit (pvoie->emis, frec, F_EXP, '\0'); break; case 'Z': ch_zip (pvoie->emis, frec); break; default: /* Erreur */ texte (T_ERR + 0); break; } } void maj_rec (long nomess, bullist * pbul) { mess_noeud *mptr = findmess (nomess); if (mptr) { ouvre_dir (); /********* Test overflow ********** if ((long) mptr->noenr > maxrec) exit_prg(-1901); ********** Fin du test ***********/ write_dir (mptr->noenr, pbul); ferme_dir (); } } fbb-7.04j/src/mbl_expo.c0100644000175100017510000001554707726646105013173 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #define CTRL_Z '\032' static int out_disk (FILE *, char *); static int mess_export (FILE * fptr, int voie, long temps, long no_message) { char lastchar = '\0'; char type; char s[255]; char ret[2]; char header[160]; char via[80]; FILE *f_mptr; char buffer[300]; ret[0] = 13; ret[1] = 0; if (*svoie[voie]->entmes.bbsv) sprintf (via, "@ %s ", svoie[voie]->entmes.bbsv); else *via = '\0'; type = svoie[voie]->entmes.type; if (type == 'A') type = 'P'; sprintf (s, "S%c %s %s< %s", type, svoie[voie]->entmes.desti, via, svoie[voie]->entmes.exped); if (!out_disk (fptr, s)) return (0); if (*(svoie[voie]->entmes.bid)) { sprintf (s, " $%s", svoie[voie]->entmes.bid); if (!out_disk (fptr, s)) return (0); } if (!out_disk (fptr, ret)) return (0); if (!out_disk (fptr, svoie[voie]->entmes.titre)) return (0); if (!out_disk (fptr, ret)) return (0); deb_io (); make_header (&(svoie[voie]->entmes), header); entete_mess_fwd (&(svoie[voie]->entmes), header); if (!out_disk (fptr, msg_header)) return (0); fin_io (); if ((f_mptr = ouvre_mess (O_TEXT, svoie[voie]->entmes.numero, svoie[voie]->entmes.status)) != NULL) { while (1) { if (fgets (buffer, 256, f_mptr) == NULL) break; lastchar = buffer[strlen (buffer) - 1]; if (!out_disk (fptr, lf_to_cr (buffer))) { ferme (f_mptr, 31); return (0); } } ferme (f_mptr, 31); } else { dde_warning (W_ASC); sprintf (s, "\rMessage file %s missing in %s\r", pvoie->sr_fic, mycall); if (!out_disk (fptr, s)) return (0); } if ((lastchar != '\n') && (!out_disk (fptr, "\r"))) return (0); if (!out_disk (fptr, "/EX\r")) return (0); tst_warning (ptmes); return (1); } static int out_disk (FILE * fptr, char *texte) { int nb = 0; int retour; char buffer[300]; char *optr = buffer; aff_bas (voiecur, W_SNDT, texte, strlen (texte)); while (*texte) { if (*texte == '\r') { *optr = '\r'; ++optr; if (++nb == 300) break; *optr = '\n'; } else if (*texte != '\n') *optr = *texte; ++optr; ++texte; if (++nb == 300) break; } if (nb == 0) return (1); deb_io (); retour = ((int) fwrite (buffer, nb, 1, fptr)); fin_io (); return (retour > 0); } int export_message (char *nom_fich) { int i; int fd; FILE *fptr; char temp[200]; aff_etat ('J'); aff_header (voiecur); aff_forward (); pvoie->lignes = -1; pvoie->finf.lang = langue[0]->numlang; for (i = 0; i < 2; i++) { /* Checks for the lock file and creates it */ fd = open (lfile (nom_fich), O_EXCL | O_CREAT, S_IREAD | S_IWRITE); if (fd == -1) { #ifdef __WIN32__ long tt; WIN32_FIND_DATA ff; SYSTEMTIME t; FILETIME ft; if (errno != EEXIST) { sprintf (temp, "*** error : Cannot create lock file %s\r", lfile (nom_fich)); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); break; } if (FindFirstFile ((char *) lfile (nom_fich), &ff) != (HANDLE) - 1) { GetSystemTime (&t); SystemTimeToFileTime (&t, &ft); /* Add one hour to File time (approximative) */ ff.ftLastWriteTime.dwHighDateTime += 9; if (CompareFileTime (&ft, &ff.ftLastWriteTime) > 0L) { /* If more than 1 hour, delete the lock file if possible */ unlink (lfile (nom_fich)); sprintf (temp, "*** file %s was locked since more than 1 hour, lock deleted !!\r", nom_fich); aff_bas (voiecur, W_SNDT, temp, strlen (temp)); } else { sprintf (temp, "*** file %s locked !!\r", nom_fich); aff_bas (voiecur, W_SNDT, temp, strlen (temp)); break; } } #else /* Checks the date of the lock file */ struct stat statbuf; long t = time (NULL); if (errno != EEXIST) { sprintf (temp, "*** error : Cannot create lock file %s\r", lfile (nom_fich)); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); break; } if ((stat (lfile (nom_fich), &statbuf) == 0) && ((t - statbuf.st_ctime) > 3600L)) { /* If more than 1 hour, delete the lock file if possible */ unlink (lfile (nom_fich)); sprintf (temp, "*** file %s was locked from more than 1 hour (%ld), lock deleted (%ld)!!\r", nom_fich, statbuf.st_ctime, t); aff_bas (voiecur, W_SNDT, temp, strlen (temp)); } else { sprintf (temp, "*** file %s locked !!\r", nom_fich); aff_bas (voiecur, W_SNDT, temp, strlen (temp)); break; } #endif } else break; } if (fd == -1) { aff_bas (voiecur, W_SNDT, "*** done\r", 9); inexport = 0; deconnexion (voiecur, 1); init_etat (); status (voiecur); return (0); } close (fd); if ((fptr = fappend (nom_fich, "b")) == NULL) { #ifdef ENGLISH sprintf (temp, " File error %s ", nom_fich); #else sprintf (temp, "Erreur fichier %s", nom_fich); #endif win_message (5, temp); aff_bas (voiecur, W_RCVT, "*** disk error !!\r", 18); aff_bas (voiecur, W_SNDT, "*** done\r", 9); inexport = 0; deconnexion (voiecur, 1); init_etat (); status (voiecur); unlink (lfile (nom_fich)); return (0); } if (mess_suiv (mail_ch)) { if (mess_export (fptr, mail_ch, svoie[mail_ch]->entmes.date, svoie[mail_ch]->entmes.numero)) { fin_envoi_fwd (mail_ch); aff_bas (voiecur, W_RCVT, "Export>\r", 8); } else { fclose (fptr); unlink (lfile (nom_fich)); #ifdef ENGLISH sprintf (temp, " File error %s ", nom_fich); #else sprintf (temp, "Erreur fichier %s", nom_fich); #endif aff_bas (voiecur, W_RCVT, "*** disk error !!\r", 18); aff_bas (voiecur, W_SNDT, "*** done\r", 9); inexport = 0; deconnexion (voiecur, 1); /* ferme(fptr, 7) ; */ #if defined(__WINDOWS__) || defined(__LINUX__) window_disconnect (voiecur); #endif init_etat (); status (voiecur); return (0); } } else { aff_bas (voiecur, W_SNDT, "*** done\r", 9); inexport = 0; deconnexion (voiecur, 1); init_etat (); } ferme (fptr, 7); unlink (lfile (nom_fich)); status (voiecur); return (1); } fbb-7.04j/src/mbl_impo.c0100644000175100017510000004201307726646105013150 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include static long skip_header (FILE * fptr) { char ligne[256]; long record = 0L; record = ftell (fptr); while (fgets (ligne, 256, fptr)) { strupr (ligne); if ((ligne[0] != '\n') && (strncmp (ligne, "R:", 2) != 0) && (strncmp (ligne, "TO:", 3) != 0) && (strncmp (ligne, "TO :", 5) != 0) && (strncmp (ligne, "FROM:", 5) != 0)) break; record = ftell (fptr); } return (record); } int mess_fic (void) { int fd_orig, fd_dest; FILE *fptr; char *ptr; int verbose = 0; int header = 0; int append = 0; int access; bullist *pbul; long numess; long nb_oct = 1L; char fichier[256]; ptr = indd; if (toupper (*indd) == 'V') { verbose = 1; ++indd; } else if (toupper (*indd) == 'H') { header = 1; ++indd; } if (toupper (*indd) == 'A') { append = 1; ++indd; } if (ISGRAPH (*indd)) return (1); if (read_only ()) { retour_mbl (); return (0); } fbb_log (voiecur, 'M', strupr (ptr)); strcpy (pvoie->dos_path, "\\"); pvoie->temp1 = N_MBL; incindd (); if (((isdigit (*indd)) && ((numess = lit_chiffre (1)) != 0L)) || ((numess = ptmes->numero) > 0L)) { if (((pbul = ch_record (NULL, numess, ' ')) != NULL) && (droit_ok (pbul, 1))) { while (isdigit (*indd)) ++indd; incindd (); strupr (sup_ln (indd)); if (*indd) { if ((!tst_point (indd)) || (!aut_ecr (ch_slash (indd), 1))) { retour_mbl (); return (0); } strcpy (fichier, tot_path (ch_slash (indd), pvoie->dos_path)); if ((fptr = ouvre_mess (O_TEXT, numess, '\0')) != NULL) { fd_orig = fileno (fptr); if (!verbose) lseek (fd_orig, skip_header (fptr), 0); } else { retour_mbl (); return (0); } access = O_WRONLY | O_CREAT | O_TEXT; if (append) access |= O_APPEND; else access |= O_TRUNC; if ((fd_dest = open (fichier, access, S_IREAD | S_IWRITE)) == EOF) { strn_cpy (40, pvoie->appendf, indd); texte (T_ERR + 30); fclose (fptr); retour_mbl (); return (0); } if (*ptmes->bbsv) sprintf (varx[0], "@%-6s ", ptmes->bbsv); else *varx[0] = '\0'; if (header || verbose) { ptr = expand (langue[vlang]->plang[T_MBL + 35 - 1]); nb_oct += (long) write (fd_dest, ptr, strlen (ptr)); ptr = expand (langue[vlang]->plang[T_MBL + 38 - 1]); nb_oct += (long) write (fd_dest, ptr, strlen (ptr)); nb_oct += 2L; } else if (append) lseek (fd_dest, 0, SEEK_END); nb_oct += copy_fic (fd_orig, fd_dest, NULL); fclose (fptr); close (fd_dest); wr_dir (fichier, pvoie->sta.indicatif.call); w_label (fichier, ptmes->titre); ltoa (nb_oct, varx[0], 10); texte (T_DOS + 7); } else texte (T_ERR + 20); } else texte (T_ERR + 10); } else texte (T_ERR + 3); retour_mbl (); return (0); } int routage (long no) { int c, ok; int route = 0, n = 0; long curr, rec = 0L; FILE *fptr; char ligne[256]; char *scan, *ptr; strn_cpy (40, ptmes->bbsv, mycall); mess_name (MESSDIR, no, ligne); if ((fptr = fopen (ligne, "rb")) != NULL) { /* Binaire obligatoire */ curr = 0L; while (fgets (ligne, 255, fptr)) { if (strncmp ("R:", ligne, 2) == 0) { scan = ligne; while (*scan) { if (*scan == '@') { rec = curr; break; } ++scan; ++curr; } } else break; curr = ftell (fptr); } if (rec) { route = 1; fseek (fptr, rec, 0); ptr = ptmes->bbsv; ok = 0; while ((c = fgetc (fptr)) != EOF) { if ((!ok) && (isalnum (c))) ok = 1; if (ok) { if (ISGRAPH (c)) { *ptr++ = toupper (c); if (++n == 40) break; } else break; } } *ptr = '\0'; } fclose (fptr); } return (route); } static void lit_fich (char *champ, int nb) { while ((nb--) && (ISGRAPH (*indd))) { *champ++ = toupper (*indd); indd++; } *champ = '\0'; } void send_reply (void) { long numess; bullist *pbul; char temp[80]; incindd (); if (((isdigit (*indd) || (*indd == '#')) && ((numess = lit_chiffre (1)) != 0L)) || ((numess = ptmes->numero) > 0L)) { if ((pbul = ch_record (NULL, numess, '\0')) != NULL) { ini_champs (voiecur); strn_cpy (6, ptmes->desti, pbul->exped); strn_cpy (6, ptmes->exped, pvoie->sta.indicatif.call); routage (numess); swapp_bbs (ptmes); ptmes->type = 'P'; ptmes->status = 'N'; reacheminement (); teste_espace (); sup_ln (indd); if ((*indd == '+') && (droits (ACCESDOS))) { incindd (); lit_fich (pvoie->appendf, 79); if (access (pvoie->appendf, 0) != 0) { texte (T_ERR + 11); retour_mbl (); return; } incindd (); } if (*indd) { n_cpy (60, ptmes->titre, indd); } else { /* strn_cpy (3, temp, pbul->titre); */ if (strncmpi (pbul->titre, "RE:", 3) == 0) strcpy (ptmes->titre, pbul->titre); else if (strncmpi (pbul->titre, "CP SYSOP: ", 10) == 0) strcpy (ptmes->titre, 10 + pbul->titre); else { n_cpy (55, temp, pbul->titre); sprintf (ptmes->titre, "Re: %s", temp); } } texte (T_MBL + 50); entete_saisie (); maj_niv (15, 0, 2); texte (T_MBL + 6); if ((sed) && (EditorOff) && (voiecur == CONSOLE)) { aff_etat ('E'); /* send_buf (voiecur); */ reply = 1; pvoie->enrcur = numess; #ifdef __WINDOWS__ maj_niv (N_MBL, 3, 0); if (win_edit () == 5) end_win_edit (); #endif #ifdef __LINUX__ if (daemon_mode) editor_request = 1; else { maj_niv (N_MBL, 3, 0); if (xfbb_edit () == 5) end_xfbb_edit (); } #endif #ifdef __FBBDOS__ maj_niv (N_MBL, 3, 0); if (mini_edit () == 5) end_mini_edit (); #endif } return; } else texte (T_ERR + 10); } else texte (T_ERR + 3); retour_mbl (); } void send_copy (void) { bullist *pbul; int retour = 1; incindd (); if (((isdigit (*indd)) && ((ptmes->numero = lit_chiffre (1)) != 0L)) || ((*indd == '#') && (ptmes->numero > 0L))) { if (((pbul = ch_record (NULL, ptmes->numero, ' ')) != NULL) && (droit_ok (pbul, 1))) { if (copy_mess (ptmes->numero, indd, '\0')) retour = 0; } else texte (T_ERR + 10); } else { texte (T_ERR + 3); } if (retour) retour_mbl (); } /* Ecrit les headers reduits dans data */ static long reduit_message (long numero, char *filename, char *last_header) { int file; FILE *fptr; int c, first = 1; int nb = 0; int call = 0; char ligne[90]; char header[90]; char *ptr = ligne; int flag = FALSE; long record = 0L; int access = O_WRONLY | O_CREAT | O_TEXT | O_TRUNC; short int postexte = 0; char *hdr = header; *hdr = '\0'; *last_header = '\0'; if ((fptr = ouvre_mess (O_TEXT, numero, '\0')) == NULL) { return (0); } if ((file = open (filename, access, S_IREAD | S_IWRITE)) == EOF) { fclose (fptr); return (0); } while ((c = fgetc (fptr)) != EOF) { if ((flag) && (c == '\n')) { record = ftell (fptr); postexte = 0; call = 0; flag = FALSE; *hdr = '\0'; strcpy (last_header, header); hdr = header; } else { switch (call) { case 0: break; case 1: if (isalnum (c)) { *ptr++ = c; nb++; call = 2; } break; case 2: if (isalnum (c)) { *ptr++ = c; nb++; } else { *ptr++ = '!'; nb++; call = 0; if (nb >= 65) { *ptr++ = '\n'; ++nb; write (file, ligne, nb); nb = 0; ptr = ligne; first = 2; } } break; } if (postexte == 0) { if (c != 'R') /*return(record) */ break; else flag = TRUE; } if ((postexte == 1) && (flag) && (c != ':')) /*return(record) */ { flag = FALSE; break; } ++postexte; if (postexte < 80) *hdr++ = c; } if ((flag) && (c == '@')) { if (first) { if (first == 1) write (file, "Path: !", 7); else write (file, " !", 7); first = 0; } call = 1; } } if (nb) { *ptr++ = '\n'; ++nb; write (file, ligne, nb); } fseek (fptr, record, 0); fflush (fptr); copy_fic (fileno (fptr), file, NULL); fclose (fptr); close (file); return (1); } int copy_mess (long numero, char *chaine, char car_fin) { int i; int test; char temp[256]; char last_header[128]; bullist *pbul; int retour = 1; if ((pbul = ch_record (NULL, numero, '\0')) != NULL) { ptmes->status = 'N'; ptmes->type = 'P'; ptmes->taille = 0L; ptmes->theme = 0; ptmes->numero = 0L; pvoie->messdate = time (NULL); pvoie->mess_num = -1L; *(pvoie->mess_bid) = '\0'; *(ptmes->desti) = '\0'; *(ptmes->bbsv) = '\0'; *(ptmes->bbsf) = '\0'; *(ptmes->bid) = '\0'; strcpy (pvoie->appendf, copy_name (voiecur, temp)); strn_cpy (6, ptmes->exped, pbul->exped); for (i = 0; i < NBMASK; i++) ptmes->forw[i] = ptmes->fbbs[i] = '\0'; if (strcmp(pvoie->sta.indicatif.call, "SYSOP") == 0) { /* SYSOP private message keeps the original sender */ strn_cpy (6, ptmes->exped, pbul->exped); /* Copy the bbsf field to avoid the from/to lines... */ strn_cpy (6, ptmes->bbsf, pbul->bbsf); } else { /* Not a sysop message */ strn_cpy (6, ptmes->exped, pvoie->sta.indicatif.call); } n_cpy (48, temp, pbul->titre); sprintf (ptmes->titre, "CP %s: %s", pvoie->sta.indicatif.call, temp); indd = chaine; if (*indd == '#') *indd = 'P'; if (scan_com_fwd ()) { if (deja_recu (ptmes, 1, &test) == 1) { texte (T_MBL + 45); retour = 0; } else { struct tm *sdate; reduit_message (numero, pvoie->appendf, last_header); sdate = gmtime (&pvoie->messdate); sprintf (temp, "%s\r\rOriginal to %s@%s\r\r%c", last_header, pbul->desti, pbul->bbsv, car_fin); get_mess_fwd ('C', temp, strlen (temp), 2); if (car_fin == '\0') { maj_niv (15, 0, 2); texte (T_MBL + 6); } } } else retour = 0; } else { texte (T_ERR + 10); retour = 0; } return (retour); } void import_message (char *nom_fich) { int i; int fd; int type, retour; int test; int recu; int sav_mode; FILE *fptr; char s[80]; char ligne[81]; char temp[256]; char lock_name[256]; retour = 1; aff_etat ('I'); while (hupdate ()); aff_header (voiecur); sav_mode = pvoie->mode; pvoie->lignes = -1; pvoie->finf.lang = langue[0]->numlang; strcpy (lock_name, lfile (nom_fich)); for (i = 0; i < 2; i++) { /* Checks for the lock file and creates it */ fd = open (lock_name, O_EXCL | O_CREAT, S_IREAD | S_IWRITE); if (fd == -1) { #ifdef __WIN32__ long tt; WIN32_FIND_DATA ff; SYSTEMTIME t; FILETIME ft; if (errno != EEXIST) { sprintf (temp, "*** error : Cannot create lock file %s\r", lock_name); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); retour = 2; break; } if (FindFirstFile ((char *) lock_name, &ff) != (HANDLE) - 1) { FileTimeToSystemTime (&ff.ftLastWriteTime, &t); sprintf (temp, "*** File %02d:%02d:%02d\r", t.wHour, t.wMinute, t.wSecond); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); GetSystemTime (&t); SystemTimeToFileTime (&t, &ft); sprintf (temp, "*** System %02d:%02d:%02d\r", t.wHour, t.wMinute, t.wSecond); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); /* Add one hour to File time (approximative) */ ff.ftLastWriteTime.dwHighDateTime += 9; if (CompareFileTime (&ft, &ff.ftLastWriteTime) > 0L) { /* If more than 1 hour, delete the lock file if possible */ unlink (lock_name); sprintf (temp, "*** file %s was locked since more than 1 hour, lock deleted !!\r", nom_fich); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); } else { sprintf (temp, "*** file %s locked !!\r", nom_fich); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); retour = 2; break; } } #else /* Checks the date of the lock file */ struct stat statbuf; long t = time (NULL); if (errno != EEXIST) { sprintf (temp, "*** error : Cannot create lock file %s\r", lock_name); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); retour = 2; break; } if ((stat (lock_name, &statbuf) == 0) && ((t - statbuf.st_ctime) > 3600L)) { /* If more than 1 hour, delete the lock file if possible */ if (unlink (lock_name) != 0) { sprintf (temp, "*** error : Cannot unlink lock file %s, %s\r", lock_name, strerror (errno)); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); } sprintf (temp, "*** file %s was locked from more than 1 hour, lock deleted !!\r", nom_fich); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); } else { sprintf (temp, "*** file %s locked !!\r", nom_fich); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); retour = 2; break; } #endif } else break; } if (fd != -1) { close (fd); if ((fptr = fopen (nom_fich, "rt")) != NULL) { long pos = svoie[mail_ch]->enrcur; fseek (fptr, pos, 0); while (1) { type = 2; libere_route (voiecur); if (fgets (ligne, 80, fptr) == NULL) break; lf_to_cr (ligne); if (*ligne == '#') { pvoie->mode = 0; continue; } if ((*ligne == '\r') || (toupper (*ligne) != 'S') || ((ligne[1] != ' ') && (ligne[2] != ' '))) continue; if (aff_inexport) aff_bas (voiecur, W_RCVT, ligne, strlen (ligne)); indd = ligne + 1; if (lit_com_fwd () == 0) { outln ("NO", 2); type = 3; } recu = deja_recu (&(svoie[voiecur]->entmes), 1, &test); if ((recu == 1) || (recu == 4)) { sprintf (s, "N - Bid %s", svoie[voiecur]->entmes.bid); outln (s, strlen (s)); type = 3; } if (type == 2) { /* reacheminement() ; */ outln ("OK", 2); } aff_etat ('E'); send_buf (voiecur); if (fgets (ligne, 80, fptr) == NULL) break; lf_to_cr (ligne); if (type == 2 && aff_inexport) aff_bas (voiecur, W_RCVT, ligne, strlen (ligne)); indd = sup_ln (ligne); rcv_titre (); while (1) { if (fgets (ligne, 80, fptr) == NULL) break; lf_to_cr (ligne); if (type == 2 && aff_inexport) aff_bas (voiecur, W_RCVT, ligne, strlen (ligne)); /* Closes the mail.in in case of calling a server */ if ((strchr (ligne, 'Z' - '@') != NULL) || (strncmpi (ligne, "/EX", 3) == 0)) { svoie[mail_ch]->enrcur = ftell (fptr); #ifdef __WIN32__ /* One more than true position in WIN32 ... Why ??? */ if (svoie[mail_ch]->enrcur > 0L) --svoie[mail_ch]->enrcur; #endif ferme (fptr, 7); fptr = NULL; if (unlink (lock_name) != 0) { sprintf (temp, "*** error : Cannot unlink lock file %s, %s\r", lock_name, strerror (errno)); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); } } if (get_mess_fwd ('I', ligne, strlen (ligne), type)) { retour = 0; break; } free_mem (); } break; } if (fptr) { svoie[mail_ch]->enrcur = ftell (fptr); #ifdef __WIN32__ /* One more than true position in WIN32 ... Why ??? */ if (svoie[mail_ch]->enrcur > 0L) --svoie[mail_ch]->enrcur; #endif ferme (fptr, 7); if (unlink (lock_name) != 0) { sprintf (temp, "*** error : Cannot unlink lock file %s, %s\r", lock_name, strerror (errno)); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); } } } else { char buf[80]; sprintf (buf, "*** Cannot import %s\r", nom_fich); /* outln (buf, strlen(buf)); */ aff_bas (voiecur, W_RCVT, buf, strlen (buf)); if (unlink (lock_name) != 0) { sprintf (temp, "*** error : Cannot unlink lock file %s, %s\r", lock_name, strerror (errno)); aff_bas (voiecur, W_RCVT, temp, strlen (temp)); } } } /* Remet le mode par defaut */ pvoie->mode = sav_mode; if (retour) { if (aff_inexport) aff_bas (voiecur, W_RCVT, "*** done\r", 9); if ((retour == 1) && (strcmp (io_fich, MAILIN) == 0)) unlink (MAILIN); inexport = 0; deconnexion (voiecur, 1); #if defined(__WINDOWS__) || defined(__LINUX__) window_disconnect (voiecur); #endif init_etat (); } else { outln ("Import>", 7); aff_etat ('E'); send_buf (voiecur); } aff_etat ('A'); status (voiecur); } fbb-7.04j/src/mbl_kill.c0100644000175100017510000002250507726646105013143 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* * Module N1 emulation WA7MBL */ static int mbl_kill_liste (void); static int mbl_kx (void); static int teste_liste (bullist *); static char *ltitre (int mode, bullist * pbul) /* Mode = 1 pour LS */ { int lg = 80; static char buf[100]; if (pvoie->typlist) { sprintf (buf, "%-12s ", pbul->bid); if (mode) strn_cpy (lg, buf + 13, pbul->titre); else n_cpy (lg, buf + 13, pbul->titre); } else { if (mode) strn_cpy (lg, buf, pbul->titre); else n_cpy (lg, buf, pbul->titre); } return (buf); } static int strfind (bullist * pbul, char *cherche) { return (strmatch (ltitre (1, pbul), cherche)); } static int teste_liste (bullist * lbul) { if (lbul->numero < pvoie->recliste.debut) return (0); if (lbul->numero > pvoie->recliste.fin) return (0); if (lbul->date < pvoie->recliste.avant) return (0); if (lbul->date > pvoie->recliste.apres) return (0); if (!droits (COSYSOP)) { if (strcmp (lbul->desti, "KILL") == 0) return (0); if (lbul->type == 'A') return (0); if ((lbul->status == 'K') && (pvoie->recliste.status != 'K')) return (0); if ((lbul->status == 'A') && (pvoie->recliste.status != 'A')) return (0); } if (*pvoie->recliste.find) return (strfind (lbul, pvoie->recliste.find)); if ((pvoie->recliste.type) && (pvoie->recliste.type != lbul->type)) return (0); if ((pvoie->recliste.status) && (pvoie->recliste.status != lbul->status)) return (0); if ((*pvoie->recliste.exp) && (!strmatch (lbul->exped, pvoie->recliste.exp))) return (0); if ((*pvoie->recliste.dest) && (!strmatch (lbul->desti, pvoie->recliste.dest))) return (0); if (*pvoie->recliste.bbs) { if (*pvoie->recliste.bbs == '-') { if (*lbul->bbsv) return (0); } else { if (!strmatch (lbul->bbsv, pvoie->recliste.bbs)) return (0); } } return (1); } /* Commande 'K' -> Kill messages ou 'H' -> hold message */ int supp_nomess (long no, int archive) { int i; int kill_new = 0; bullist lbul; char s[80]; char type = '\0'; if (archive >= 0x80) { archive -= 0x80; kill_new = 1; } switch (archive) { case 0: type = 'K'; break; case 1: type = 'A'; break; case 2: type = 'H'; break; } if (!ch_record (&lbul, no, 0)) return (2); if (archive == 2) { if ((lbul.status != '$') && (lbul.status != 'N') && (lbul.status != 'Y')) return (2); } if (!droit_ok (&lbul, (archive == 1) ? 3 : ((kill_new) ? 4 : 2))) return (3); ch_record (&lbul, no, (kill_new) ? (type | 0x80) : type); sprintf (s, "%c %ld", type, lbul.numero); fbb_log (voiecur, 'M', s); clear_fwd (lbul.numero); lbul.status = type; for (i = 0; i < NBMASK; i++) { lbul.fbbs[i] = '\0'; } maj_rec (lbul.numero, &lbul); if (archive == 2) ++nb_hold; return (1); } static void kill_mine (int archive) { /* Suppression des messages personnels */ int trouve = 0; unsigned num_ind = pvoie->no_indic; unsigned offset = 0; bullist bul; bloc_mess *bptr = tete_dir; mess_noeud *mptr; ouvre_dir (); while (bptr) { mptr = &(bptr->st_mess[offset]); if (mptr->noenr == 0) break; if (mptr->no_indic == num_ind) { read_dir (mptr->noenr, &bul); *ptmes = bul; if (bul.status != 'H') { trouve = 1; if (bul.status != 'N') { switch (supp_nomess (bul.numero, archive)) { case 1: texte (T_MBL + 7); break; case 2: /* Deja tue ! */ break; case 3: texte (T_ERR + 12); break; } } else texte (T_ERR + 12); } } if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } } ferme_dir (); if (!trouve) texte (T_MBL + 3); } static int mbl_kill_liste (void) { int retour = 1; bullist ligne; unsigned offset = pvoie->recliste.offset; bloc_mess *bptr = pvoie->recliste.ptemp; int archive = pvoie->recliste.l; mess_noeud *mptr; pvoie->sr_mem = pvoie->seq = FALSE; ouvre_dir (); while (bptr) { mptr = &(bptr->st_mess[offset]); if (mptr->noenr == 0) break; read_dir (mptr->noenr, &ligne); if (ligne.numero < pvoie->recliste.debut) break; if (teste_liste (&ligne)) { if (pvoie->recliste.last-- == 0L) break; if (droit_ok (&ligne, 2)) { switch (supp_nomess (ligne.numero, archive)) { case 1: if (archive == 2) outln ("Msg #$M held.", 13); else texte (T_MBL + 7); break; case 2: /* Deja tue ! */ ptmes->numero = ligne.numero; break; case 3: ptmes->numero = ligne.numero; if (archive == 2) texte (T_ERR + 13); else texte (T_ERR + 12); break; } pvoie->temp1 = 0; } } if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 0; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 0; break; } } ferme_dir (); pvoie->recliste.offset = offset; pvoie->recliste.ptemp = bptr; if ((retour) && (pvoie->temp1)) texte (T_MBL + 3); return (retour); } int mbl_kill (void) { int error = 0; switch (pvoie->niv3) { case 0: error = mbl_kx (); break; case 1: if (mbl_kill_liste ()) retour_mbl (); break; default: fbb_error (ERR_NIVEAU, "MESS-KILL", pvoie->niv3); } return (error); } static int mbl_kx (void) { long no; char c; int archive = 0, fin = 1, suite = 1; int error = 0; sup_ln (indd); c = toupper (*indd); init_recliste (voiecur); pvoie->aut_nc = 1; if (droits (SUPMES)) { if (c == 'K') { ++indd; c = toupper (*indd); archive = 1; } switch (c) { case '>': ++indd; suite = 0; if (teste_espace ()) { strn_cpy (6, pvoie->recliste.dest, indd); fin = 0; } else { texte (T_ERR + 2); } break; case '<': ++indd; suite = 0; if (teste_espace ()) { strn_cpy (6, pvoie->recliste.exp, indd); fin = 0; } else { texte (T_ERR + 2); } break; case 'F': ++indd; suite = 0; pvoie->recliste.status = 'F'; fin = 0; break; case '@': ++indd; suite = 0; if (teste_espace ()) { strn_cpy (6, pvoie->recliste.bbs, indd); fin = 0; } else { texte (T_ERR + 2); } break; default: break; } if ((!fin) && (!suite)) { pvoie->recliste.ptemp = tete_dir; pvoie->recliste.offset = 0; pvoie->recliste.l = archive; pvoie->temp1 = 1; if (mbl_kill_liste ()) fin = 1; else ch_niv3 (1); } } if (suite) { if (c == 'M') { kill_mine (archive); } else { if (teste_espace ()) { while ((no = lit_chiffre (1)) != 0L) { /* Autorise la suppression des messages non lus */ switch (supp_nomess (no, archive + 0x80)) { case 1: texte (T_MBL + 7); break; case 2: texte (T_ERR + 10); break; case 3: texte (T_ERR + 12); break; } } } else { /* texte(T_ERR + 3) ; */ error = 1; fin = 0; } } } if (fin) retour_mbl (); return (error); } /* * Archive = 0 -> K * 1 -> A * 2 -> H */ int hold_kill (int archive) { long no; char c; int fin = 1, suite = 1; int error = 0; c = toupper (*indd); switch (c) { case '>': ++indd; suite = 0; if (teste_espace ()) { strn_cpy (6, pvoie->recliste.dest, indd); fin = 0; } else { texte (T_ERR + 2); } break; case '<': ++indd; suite = 0; if (teste_espace ()) { strn_cpy (6, pvoie->recliste.exp, indd); fin = 0; } else { texte (T_ERR + 2); } break; case 'F': if (archive != 2) { ++indd; suite = 0; pvoie->recliste.status = 'F'; fin = 0; } break; case '@': ++indd; suite = 0; if (teste_espace ()) { strn_cpy (6, pvoie->recliste.bbs, indd); fin = 0; } else { texte (T_ERR + 2); } break; default: break; } if ((!fin) && (!suite)) { pvoie->recliste.ptemp = tete_dir; pvoie->recliste.offset = 0; pvoie->recliste.l = archive; pvoie->temp1 = 1; if (mbl_kill_liste ()) fin = 1; else ch_niv3 (1); } if (suite) { if (teste_espace ()) { while ((no = lit_chiffre (1)) != 0L) { switch (supp_nomess (no, archive)) { case 1: outln ("Msg #$M held.", 13); break; case 2: break; case 3: texte (T_ERR + 10); break; } } } else { error = 1; fin = 0; } } if (fin) retour_mbl (); return (error); } fbb-7.04j/src/mbl_lc.c0100644000175100017510000000653707726646105012615 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* * Module commande LC */ #define NB_THEMES 1000 static void list_themes (void); typedef struct theme { char nom[6]; int nb; struct theme *suiv; } Theme; int list_lc (void) { int error = 0; sup_ln (indd); /************** Tester l'espace ******************/ incindd (); if ((*indd == ';') || (*indd == '?')) list_themes (); else { if (*indd) { strn_cpy (6, pvoie->finf.filtre, indd); if (strcmp (pvoie->finf.filtre, "*") == 0) { *pvoie->finf.filtre = '\0'; } } outln ("=> $l", 5); } retour_mbl (); return (error); } static void list_themes (void) { char s[30]; char temp[30]; Theme *tptr = NULL; Theme *cptr; Theme *sptr; Theme *prec; int nb; int comp; unsigned offset; bloc_mess *bptr = tete_dir; bullist ligne; ouvre_dir (); offset = 0; while (bptr) { if (bptr->st_mess[offset].noenr) { read_dir (bptr->st_mess[offset].noenr, &ligne); if ((ligne.type == 'B') && (droit_ok (&ligne, 1))) { if (tptr == NULL) { tptr = (Theme *) m_alloue (sizeof (Theme)); tptr->suiv = NULL; strncpy (tptr->nom, ligne.desti, 6); tptr->nb = 1; } else { prec = NULL; sptr = tptr; for (;;) { if (sptr == NULL) { cptr = (Theme *) m_alloue (sizeof (Theme)); cptr->suiv = NULL; strncpy (cptr->nom, ligne.desti, 6); cptr->nb = 1; if (prec) prec->suiv = cptr; else tptr = cptr; break; } comp = strncmp (sptr->nom, ligne.desti, 6); if (comp == 0) { ++sptr->nb; break; } if (comp > 0) { cptr = (Theme *) m_alloue (sizeof (Theme)); strncpy (cptr->nom, ligne.desti, 6); cptr->nb = 1; if (prec) prec->suiv = cptr; else tptr = cptr; cptr->suiv = sptr; break; } prec = sptr; sptr = sptr->suiv; } } } } if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } } ferme_dir (); nb = 0; cptr = tptr; while (cptr) { strn_cpy (6, temp, cptr->nom); sprintf (s, "%-6s %d ", temp, cptr->nb); out (s, 13); if (++nb == 6) { cr (); nb = 0; } prec = cptr; cptr = cptr->suiv; m_libere (prec, sizeof (Theme)); } if (nb != 0) cr (); } fbb-7.04j/src/mbl_list.c0100644000175100017510000004247407726646105013172 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* * Module N1 emulation WA7MBL */ static int mbl_lx (void); static int mbl_bloc_liste (void); static int strfind (bullist *, char *); static int teste_liste (bullist *); static int mess_bloc_liste (void); static void list_mine (char); /* Commande 'L' -> List messages */ #include "aff_stat.c" static int strfind (bullist * pbul, char *cherche) { return (strmatch (ltitre (1, pbul), cherche)); } static int manque_forward (bullist * lbul) { int i; if ((*lbul->bbsv) && (lbul->status == 'N')) { for (i = 0; i < NBMASK; i++) if (lbul->fbbs[i]) return (0); return (1); } return (0); } static int teste_liste (bullist * lbul) { if (lbul->numero < pvoie->recliste.debut) return (0); if (lbul->numero > pvoie->recliste.fin) return (0); if (lbul->date < pvoie->recliste.avant) return (0); if (lbul->date > pvoie->recliste.apres) return (0); if (!droits (COSYSOP)) { if (strcmp (lbul->desti, "KILL") == 0) return (0); if (lbul->type == 'A') return (0); if ((lbul->status == 'K') && (pvoie->recliste.status != 'K')) return (0); if ((lbul->status == 'A') && (pvoie->recliste.status != 'A')) return (0); } if ((pvoie->recliste.type) && (pvoie->recliste.type != lbul->type)) return (0); if ((pvoie->recliste.status) && (pvoie->recliste.status != lbul->status)) return (0); if ((pvoie->recliste.route) && (!manque_forward (lbul))) return (0); if ((*pvoie->recliste.exp) && (!strmatch (lbul->exped, pvoie->recliste.exp))) return (0); if ((*pvoie->recliste.dest) && (!strmatch (lbul->desti, pvoie->recliste.dest))) return (0); if (*pvoie->recliste.find) return (strfind (lbul, pvoie->recliste.find)); if (*pvoie->recliste.bbs) { if (*pvoie->recliste.bbs == '-') { if (*lbul->bbsv) return (0); } else { if (!strmatch (bbs_via (lbul->bbsv), pvoie->recliste.bbs)) return (0); } } return (1); } static int mbl_bloc_liste (void) { int retour = 1; unsigned offset = pvoie->recliste.offset; bloc_mess *bptr = pvoie->recliste.ptemp; bullist ligne; pvoie->sr_mem = pvoie->seq = FALSE; ouvre_dir (); while (bptr) { if (!pvoie->reverse) --offset; if (bptr->st_mess[offset].noenr) { read_dir (bptr->st_mess[offset].noenr, &ligne); if (ligne.numero < pvoie->recliste.debut) break; if ((ligne.type) && (droit_ok (&ligne, 1)) && (teste_liste (&ligne))) { if (pvoie->recliste.last-- == 0L) break; if (pvoie->temp1) { pvoie->temp2 -= entete_liste (); pvoie->temp1 = 0; } aff_status (&ligne); --pvoie->temp2; } } if (pvoie->reverse) { if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } } else { if (offset == 0) { bptr = prec_dir (bptr); offset = T_BLOC_MESS; } } if (pvoie->temp2 == 0) { retour = 2; break; } if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 0; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 0; break; } } ferme_dir (); pvoie->recliste.offset = offset; pvoie->recliste.ptemp = bptr; if ((retour) && (pvoie->temp1)) texte (T_MBL + 3); return (retour); } void mess_liste (int pr) { int mode_list = 1; int verbose = 0; switch (pvoie->niv3) { case 0: pvoie->temp1 = 1; pvoie->temp2 = pvoie->lignes; ch_niv3 (1); break; case 1: break; case 2: while_space (); switch (toupper (*indd)) { case 'A': mode_list = 0; retour_mbl (); break; case 'V': verbose = 1; case 'R': mode_list = 0; incindd (); if (isdigit (*indd)) { list_read (verbose); pvoie->sr_mem = 1; if (mbl_mess_read () == 0) { pvoie->sr_mem = 0; texte (T_QST + 6); } } else { texte (T_ERR + 3); texte (T_QST + 6); } break; default: pvoie->temp2 = pvoie->lignes; ch_niv3 (1); break; } break; case 3: mode_list = 0; if (read_mess (1) == 0) ch_niv3 (4); break; case 4: mode_list = 0; pvoie->sr_mem = 1; if (mbl_mess_read () == 0) { pvoie->sr_mem = 0; texte (T_QST + 6); ch_niv3 (2); } break; default: fbb_error (ERR_NIVEAU, "MESS-LIST", pvoie->niv3); } if (mode_list) { if (pr) { pvoie->lignes = -1; switch (mess_bloc_liste ()) { case 0: break; case 1: retour_mbl (); break; case 2: texte (T_QST + 6); ch_niv3 (2); break; } } else { pvoie->lignes = -1; #if 0 switch (mess_bloc_liste ()) { case 0: break; case 1: retour_mbl (); break; case 2: ch_niv3 (1); break; } #else mess_bloc_liste (); pvoie->sr_mem = pvoie->seq = FALSE; libere_tread (voiecur); libere_tlist (voiecur); pvoie->mbl = 1; maj_niv (N_MBL, 0, 0); #endif } } } static int mess_bloc_liste (void) { int retour = 1; rd_list *ptemp; bullist ligne; mess_noeud *mptr; pvoie->sr_mem = pvoie->seq = FALSE; ouvre_dir (); while ((ptemp = pvoie->t_list) != NULL) { if (pvoie->temp1) { pvoie->temp1 = 0; entete_liste (); --pvoie->temp2; } mptr = findmess (ptemp->nmess); if (mptr) { read_dir (mptr->noenr, &ligne); aff_status (&ligne); } --pvoie->temp2; pvoie->t_list = pvoie->t_list->suite; m_libere (ptemp, sizeof (rd_list)); if (pvoie->temp2 == 0) { retour = 2; break; } if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 0; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 0; break; } } ferme_dir (); if ((retour) && (pvoie->temp1)) texte (T_MBL + 3); return (retour); } static void list_mine (char mode) { char s[2]; int nouveau = 0; unsigned num_ind; if (isdigit (mode)) { s[0] = mode; s[1] = '\0'; insnoeud (s, &num_ind); } else { if (mode == 'N') nouveau = TRUE; num_ind = pvoie->no_indic; } list_messages (nouveau, num_ind, 1); } void send_list(int voie) { unsigned offset; bloc_mess *bptr = tete_dir; mess_noeud *mptr; bullist bul; char buf[80]; sprintf(buf, "S%d", svoie[voie]->ncur->nbmess); sta_drv (voie, SNDCMD, buf); ouvre_dir (); /* Read messages */ while (bptr) { for (offset = 0 ; offset < T_BLOC_MESS ; offset++) { mptr = &(bptr->st_mess[offset]); if ((mptr->noenr) && (mptr->no_indic == svoie[voie]->no_indic)) { read_dir (mptr->noenr, &bul); if (bul.status != 'N' && bul.status != 'K' && bul.status != 'A') { sprintf(buf, "M%ld %ld %c", bul.numero, bul.taille, bul.status); sta_drv (voie, SNDCMD, buf); } } } bptr = bptr->suiv; } bptr = tete_dir; /* Unread messages */ while (bptr) { for (offset = 0 ; offset < T_BLOC_MESS ; offset++) { mptr = &(bptr->st_mess[offset]); if ((mptr->noenr) && (mptr->no_indic == svoie[voie]->no_indic)) { read_dir (mptr->noenr, &bul); if (bul.status == 'N') { sprintf(buf, "M%ld %ld %c", bul.numero, bul.taille, bul.status); sta_drv (voie, SNDCMD, buf); } } } bptr = bptr->suiv; } ferme_dir (); sta_drv (voie, SNDCMD, "M0 0 N"); } void list_messages (int nouveau, unsigned num_ind, int pr) { int trouve = 0; unsigned offset = 0; bloc_mess *bptr = tete_dir; mess_noeud *mptr; rd_list *ptemp = NULL; bullist bul; ouvre_dir (); /* pvoie->typlist = 0; */ while (bptr->suiv) bptr = bptr->suiv; while (bptr) { offset = T_BLOC_MESS; while (offset--) { mptr = &(bptr->st_mess[offset]); if ((mptr->noenr) && (mptr->no_indic == num_ind)) { read_dir (mptr->noenr, &bul); if (((!nouveau) || (nouveau && (bul.status == 'N'))) && (bul.status != 'H') && (bul.status != 'A')) { if (ptemp) { ptemp->suite = (rd_list *) m_alloue (sizeof (rd_list)); ptemp = ptemp->suite; } else { pvoie->t_list = ptemp = (rd_list *) m_alloue (sizeof (rd_list)); } ptemp->suite = NULL; ptemp->nmess = mptr->nmess; ptemp->verb = 1; trouve = 1; } } } bptr = prec_dir (bptr); } ferme_dir (); if (!trouve) { if (nouveau) texte (T_MBL + 4); else texte (T_MBL + 3); retour_mbl (); } else { maj_niv (N_MBL, 16, 0); mess_liste (pr); } } static int copy_word(char *dest, char *str, int max) { int nb = 0; while (!isspace(*str) && !iscntrl(*str)) { *dest++ = *str++; ++nb; if (max && nb == max) break; } *dest = '\0'; return nb; } static int cmd_list(int cmd) { char cde; int ok = 1; long date; switch (cmd) { case 'A': pvoie->recliste.status = 'A'; break; case 'B': pvoie->recliste.type = 'B'; break; case 'D': cde = *indd++; if ((cde == '<') || (cde == '>')) { if (teste_espace ()) { if ((date = date_to_time (indd)) == 0L) { ok = 0; texte (T_ERR + 3); } else { char tmp[20]; indd += copy_word(tmp, indd, 19); switch (cde) { case '>': pvoie->recliste.avant = date /* + 86400L */ ; break; case '<': pvoie->recliste.apres = date - 86400L; break; } } } else { texte (T_ERR + 2); ok = 0; } } else { ok = 0; sprintf (varx[0], "LD%c", cmd); texte (T_ERR + 1); } break; case 'E': pvoie->recliste.route = 1; break; case 'F': pvoie->recliste.status = 'F'; break; case 'H': pvoie->temp1 = 0; list_held (); ok = 0; break; case 'K': pvoie->recliste.status = 'K'; break; case 'L': if (!ISPRINT (*indd)) { pvoie->recliste.last = 1; } else if (teste_espace ()) { if (isdigit (*indd)) pvoie->recliste.last = lit_chiffre (0); else { texte (T_ERR + 3); ok = 0; } } else { texte (T_ERR + 2); ok = 0; } break; case 'M': case 'N': list_mine (cmd); ok = 2; break; case 'P': pvoie->recliste.type = 'P'; break; case 'S': if (teste_espace ()) { int len = 0; char *ptr = indd; while (*ptr && *ptr != ' ') { ++ptr; ++len; } pvoie->recliste.find[0] = '*'; strn_cpy ((len > 17) ? 17 : len, (pvoie->recliste.find) + 1, strupr (indd)); indd += len; strcat (pvoie->recliste.find, "*"); } else { texte (T_ERR + 2); ok = 0; } break; case 'T': pvoie->recliste.type = 'T'; break; case 'U': pvoie->recliste.type = 'P'; pvoie->recliste.status = 'N'; break; case 'X': pvoie->recliste.status = 'X'; break; case 'Y': pvoie->recliste.status = 'Y'; break; case '$': pvoie->recliste.status = '$'; break; case '<': if (teste_espace ()) { indd += copy_word(pvoie->recliste.exp, indd, 6); } else { texte (T_ERR + 2); ok = 0; } break; case '>': if (teste_espace ()) { indd += copy_word(pvoie->recliste.dest, indd, 6); } else { texte (T_ERR + 2); ok = 0; } break; case '@': if (teste_espace ()) { indd += copy_word(pvoie->recliste.bbs, indd, 6); } else { strcpy (pvoie->recliste.bbs, "-"); } break; case 'R': pvoie->reverse = 1; case ' ': teste_espace (); if (*indd == '\0') { pvoie->recliste.l = TRUE; pvoie->recliste.debut = pvoie->finf.lastmes + 1; pvoie->l_mess = nomess; break; } if (strchr (indd, '-')) { if (isdigit (*indd)) pvoie->recliste.debut = lit_chiffre (1); else { texte (T_ERR + 3); ok = 0; break; } ++indd; if (isdigit (*indd)) pvoie->recliste.fin = lit_chiffre (1); if (pvoie->recliste.fin <= pvoie->recliste.debut) ok = 0; } else { if (isdigit (*indd)) pvoie->recliste.fin = pvoie->recliste.debut = lit_chiffre (1); else ok = 0; } break; default: if (isdigit (cmd)) { list_mine (cmd); ok = 0; } else { /* sprintf(varx[0], "L%c", c) ; texte(T_ERR + 1) ; */ ok = 3; } break; } return ok; } int mbl_lx (void) { char c; int ok = 1; int i; bloc_mess *temp; long numero; pvoie->reverse = 0; init_recliste (voiecur); if (!ISPRINT (*indd)) { pvoie->recliste.debut = pvoie->finf.lastmes + 1; pvoie->l_mess = nomess; } else { sup_ln (indd); fbb_log (voiecur, 'M', strupr (indd - 1)); c = *indd++; for (;;) { ok = cmd_list(c); if (ok == 0) break; while_space(); c = *indd++; if (c == '\0') break; if (c != '&') { ok = 3; break; } incindd(); c = *indd++; if (c != 'L' && c != 'l') { ok = 3; break; } c = *indd++; } } if (ok == 1) { if (pvoie->reverse) { temp = tete_dir; numero = pvoie->recliste.debut; while (temp->suiv) { if (temp->suiv->st_mess[0].nmess > numero) break; temp = temp->suiv; } for (i = 0; i < T_BLOC_MESS; i++) { if (temp->st_mess[i].nmess == 0) { --i; break; } if (temp->st_mess[i].nmess >= numero) break; } if (i == T_BLOC_MESS) --i; pvoie->recliste.ptemp = temp; pvoie->recliste.offset = i; } else { pvoie->recliste.ptemp = last_dir (); pvoie->recliste.offset = T_BLOC_MESS; } pvoie->temp1 = 1; } return (ok); } void list_read (int verbose) { long no; bullist *pbul; rd_list *ptemp = NULL; libere_tread (voiecur); while ((no = lit_chiffre (1)) != 0L) { if ((pbul = ch_record (NULL, no, 'Y')) != NULL) { if (droit_ok (pbul, 1)) { if (ptemp) { ptemp->suite = (rd_list *) m_alloue (sizeof (rd_list)); ptemp = ptemp->suite; } else { pvoie->t_read = ptemp = (rd_list *) m_alloue (sizeof (rd_list)); } ptemp->suite = NULL; ptemp->nmess = no; ptemp->verb = verbose; } else texte (T_ERR + 10); } else texte (T_ERR + 10); } } int mbl_list (void) { int mode_list = 1; int verbose = 0; int error = 0; switch (pvoie->niv3) { case 0: if (toupper (*indd) == 'C') { return (list_lc ()); } switch (mbl_lx ()) { case 0: retour_mbl (); case 2: mode_list = 0; break; case 1: pvoie->temp2 = pvoie->lignes; ch_niv3 (1); break; case 3: mode_list = 0; error = 1; --indd; break; } break; case 1: break; case 2: while_space (); switch (toupper (*indd)) { case 'A': mode_list = 0; retour_mbl (); break; case 'V': verbose = 1; case 'R': mode_list = 0; incindd (); if (isdigit (*indd)) { pvoie->aut_nc = 1; list_read (verbose); pvoie->sr_mem = 1; if (mbl_mess_read () == 0) { pvoie->sr_mem = 0; texte (T_QST + 6); } } else { texte (T_ERR + 3); texte (T_QST + 6); } break; default: pvoie->temp2 = pvoie->lignes; ch_niv3 (1); break; } break; case 3: mode_list = 0; pvoie->aut_nc = 1; if (read_mess (1) == 0) ch_niv3 (4); break; case 4: mode_list = 0; pvoie->aut_nc = 1; pvoie->sr_mem = 1; if (mbl_mess_read () == 0) { pvoie->sr_mem = 0; texte (T_QST + 6); ch_niv3 (2); } break; default: fbb_error (ERR_NIVEAU, "MSG-LIST", pvoie->niv3); } if (mode_list) { pvoie->lignes = -1; switch (mbl_bloc_liste ()) { case 0: break; case 1: retour_mbl (); break; case 2: texte (T_QST + 6); ch_niv3 (2); break; } } return (error); } /* Test du password */ void mbl_passwd (void) { char buffer[80]; switch (pvoie->niv3) { case 0: snd_passwd (buffer); if (*buffer == '\0') retour_mbl (); else { outln (buffer, strlen (buffer)); ch_niv3 (1); } break; case 1: if (tst_passwd (indd)) { outln ("Ok", 2); change_droits (voiecur); sprintf (buffer, "SYS OK"); } else { *pvoie->passwd = '\0'; sprintf (buffer, "SYS FAILED"); } fbb_log (voiecur, 'M', buffer); retour_mbl (); break; } } /* Commande 'S' -> Send messages */ int mbl_send (void) { int error = 0; switch (toupper (*indd)) { case 'X': if (!read_only ()) { --indd; maj_niv (N_XFWD, 1, 0); xfwd (); } else retour_mbl (); break; case 'Y': if ((toupper (indd[1]) == 'S') && (!pvoie->read_only) && (droits (CMDSYS))) { maj_niv (N_MBL, 14, 0); mbl_passwd (); } else { error = 1; /* cmd_err(--indd) ; */ } break; case 'R': if (!read_only ()) { *indd = toupper (*indd); send_reply (); } else retour_mbl (); break; case 'C': if (!read_only ()) { fbb_log (voiecur, 'S', strupr (indd)); send_copy (); } else retour_mbl (); break; default: maj_niv (N_FORW, 0, 0); error = fwd (); break; } return (error); } /* Commande 'I' -> Info */ void mbl_info (void) { char buffer[257]; sprintf (buffer, "LANG\\%s.INF", nomlang + nlang * LG_LANG); if (!outfich (c_disque (buffer))) q_mark (); } fbb-7.04j/src/mbl_log.c0100644000175100017510000000251207726646105012765 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MBL_LOG.C * */ #include void ouvre_log (void) { char fichier[80]; sprintf (fichier, "LOG\\FBBLOG.%02d", num_semaine); log_ptr = fappend (d_disque (fichier), "b"); } void ferme_log (void) { if (log_ptr) { fclose (log_ptr); log_ptr = NULL; } } fbb-7.04j/src/mbl_menu.c0100644000175100017510000003030007726646105013144 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MBL_MENU.C * */ #include /* * Pas de forward si read-only * si pas dclar BBS sur un port GUEST */ int forward_auth (int voie) { /* Toujours OK sur l'import/export */ if (voie == INEXPORT) return (1); if (POP (no_port (voie))) return (1); if (svoie[voie]->read_only) return 0; if (std_header & 128) { /* N'accepte que si BBS declarees */ if ((BBS (svoie[voie]->finf.flags)) || (PMS (svoie[voie]->finf.flags))) return (1); else return (0); } if ((P_GUEST (voie)) && (!BBS (svoie[voie]->finf.flags))) return 0; return 1; } static void menu_mbl (void) { int c, error = 0; int cmd = 1; char com[80]; char *pt_err = indd; char *ptr; limite_commande (); while (*indd && (!ISGRAPH (*indd))) indd++; strn_cpy (70, com, indd); ptr = strchr (com, ' '); if (ptr) *ptr = '\0'; c = *indd++; if ((!SYS (pvoie->finf.flags)) && (voiecur != CONSOLE) && (!LOC (pvoie->finf.flags)) && (P_GUEST (voiecur))) { switch (toupper (c)) { case 'A': interruption (voiecur); break; case 'B': if (bye ()) { maj_niv (N_MENU, 0, 0); sortie (); } else { cmd_err (--indd); } break; case 'F': if (FOR (pvoie->mode)) { if (*indd == '>') { maj_niv (N_FORW, 1, 0); rcv_rev_fwd (); } else { maj_niv (N_MENU, 0, 0); sortie (); } } else error = 1; break; case 'K': if (!read_only ()) { if (toupper (*indd) == 'M') { maj_niv (N_MBL, 4, 0); mbl_kill (); } else error = 1; } else retour_mbl (); break; case 'L': if ((toupper (*indd) == 'M') || (toupper (*indd) == 'N')) { maj_niv (N_MBL, 1, 0); mbl_list (); } else error = 1; break; case 'N': maj_niv (N_MBL, 7, 0); error = mbl_name (); break; case 'O': maj_niv (N_MBL, 11, 0); error = mbl_options (); retour_mbl (); break; case 'R': if ((toupper (*indd) == 'M') || (toupper (*indd) == 'N')) { maj_niv (N_MBL, 2, 0); mbl_read (0); } else error = 1; break; case 'S': maj_niv (N_MBL, 3, 0); mbl_send (); break; case 'T': maj_niv (N_MBL, 9, 0); mbl_tell (); break; case 'X': if (EXP (pvoie->finf.flags)) { pvoie->finf.flags &= (~F_EXP); texte (T_MBL + 18); } else { pvoie->finf.flags |= F_EXP; texte (T_MBL + 17); } /* pvoie->finf.flags = pvoie->mode ; */ if (!pvoie->read_only) ch_info (); retour_mbl (); break; case '[': if (forward_auth (voiecur)) { while (ISGRAPH (*indd)) ++indd; if (*(indd - 1) == ']') { analyse_idnt (pt_err); if (pvoie->prot_fwd & FWD_FBB) { pvoie->temp1 = 0; pvoie->ind_mess = 0; pvoie->temp2 = FALSE; init_rec_fwd (voiecur); maj_niv (N_FORW, 5, 2); return; } else pvoie->mode |= F_BBS; prompt (pvoie->finf.flags, pvoie->niv1); } else cmd_err (pt_err); } else cmd_err (--indd); break; case '*': /* if ((*indd == '*') && (*(indd + 1) == '*')) { indd += 3; if (test_linked ()) { traite_voie (voiecur); } } else */ { cmd_err (--indd); } cmd = 0; break; case 'H': if ((*indd) && (strncmpi (indd, "ELP", 3) == 0)) { int nb = 0; while ((*indd) && (!isspace (*indd))) { ++indd; ++nb; } if (nb != 3) { error = 1; break; } } else if (ISGRAPH (*indd)) { error = 1; break; } case '?': while (isspace (*indd)) ++indd; help (indd); break; case ';': cmd = 0; break; case '\0': cmd = 0; prompt (pvoie->finf.flags, N_MBL); break; default: cmd = 0; --indd; if (!defaut ()) error = 1; break; } if (error) { cmd_err (pt_err); } } else { if (!appel_pg (com)) { switch (toupper (c)) { case 'A': if (!ISGRAPH (*indd)) interruption (voiecur); else error = 1; break; case 'B': if (bye ()) { maj_niv (N_MENU, 0, 0); sortie (); } else error = 1; /* { cmd_err(--indd) ; } */ break; case 'C': maj_niv (N_CONF, 0, 0); error = conference (); break; case 'D': maj_niv (N_MBL, 8, 0); error = mbl_dump (); break; case 'E': if (droits (COSYSOP)) { maj_niv (N_MBL, 11, 0); error = mbl_edit (); } else error = 1; /* { cmd_err(--indd) ; } */ break; case 'F': switch (toupper (*indd)) { case '>': if (FOR (pvoie->mode)) { if (pvoie->prot_fwd & FWD_XPRO) { maj_niv (N_XFWD, 1, 5); xfwd (); } else { maj_niv (N_FORW, 1, 0); rcv_rev_fwd (); } } else error = 1; break; case '<': if (FOR (pvoie->mode)) { send_binary_mess (); } else error = 1; break; case '\r': if (miniserv & 1) { pvoie->mbl = FALSE; texte (T_MBL + 19); /* pvoie->finf.flags |= F_EXP ; */ maj_niv (0, 1, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else error = 1; break; default: if (droits (COSYSOP)) error = maint_fwd (); else error = 1; break; } break; case 'G': if (!ISGRAPH (*indd)) { if (((gate) && nbgate () && (!pvoie->read_only)) || (voiecur == CONSOLE)) { pvoie->temp3 = pvoie->niv1; maj_niv (N_TELL, 0, 0); pvoie->mbl = 0; duplex_tnc (); } else { texte (T_GAT + 8); retour_mbl (); } } else error = 1; break; case 'H': sup_ln (indd); if (*indd) { if (strncmpi (indd, "ELP", 3) == 0) { int nb = 0; while ((*indd) && (!isspace (*indd))) { ++indd; ++nb; } if (nb != 3) { error = 1; break; } } else { error = mbl_hold (); break; } } case '?': while (isspace (*indd)) ++indd; help (indd); break; case 'I': maj_niv (N_MBL, 5, 0); error = menu_wp_search (); break; case 'J': maj_niv (N_MBL, 10, 0); error = mbl_jheard (); break; case 'K': if (!read_only ()) { maj_niv (N_MBL, 4, 0); error = mbl_kill (); } else retour_mbl (); break; case 'L': maj_niv (N_MBL, 1, 0); pvoie->typlist = 0; error = mbl_list (); break; case 'M': c = toupper (*indd); if ((!ISGRAPH (c)) || (c == 'V') || (c == 'H') || (c == 'A')) { error = mess_fic (); } else { if (droits (COSYSOP)) { maj_niv (N_MBL, 1, 0); pvoie->typlist = 1; error = mbl_list (); } else { error = 1; /* cmd_err(--indd) ; */ } } break; case 'N': maj_niv (N_MBL, 7, 0); error = mbl_name (); break; case 'O': maj_niv (N_MBL, 11, 0); error = mbl_options (); retour_mbl (); break; case 'P': if (!p_cmd ()) error = 1; break; case 'R': maj_niv (N_MBL, 2, 0); error = mbl_read (0); break; case 'S': maj_niv (N_MBL, 3, 0); error = mbl_send (); break; case 'T': if (!ISGRAPH (*indd)) { maj_niv (N_MBL, 9, 0); mbl_tell (); } else if (toupper (*indd) == 'H') { maj_niv (N_THEMES, 0, 0); error = themes (); } else error = 1; break; case 'U': if (!ISGRAPH (*indd)) { if (!is_room ()) { outln ("*** Disk full !", 15); retour_mbl (); break; } --indd; pvoie->temp1 = pvoie->niv1; strcpy (pvoie->dos_path, "\\"); maj_niv (N_DOS, 3, 0); receive_file (); } else error = 1; break; case 'V': maj_niv (N_MBL, 6, 0); error = mbl_read (1); break; case 'W': if (!ISGRAPH (*indd)) { --indd; pvoie->temp1 = pvoie->niv1; strcpy (pvoie->dos_path, "\\"); maj_niv (N_DOS, 1, 0); dir (); } else error = 1; break; case 'X': if (!ISGRAPH (*indd)) { if (EXP (pvoie->finf.flags)) { pvoie->finf.flags &= (~F_EXP); texte (T_MBL + 18); } else { pvoie->finf.flags |= F_EXP; texte (T_MBL + 17); } /* pvoie->finf.flags = pvoie->mode ; */ if (!pvoie->read_only) ch_info (); retour_mbl (); } else error = 1; break; case 'Y': if (ISGRAPH (*indd)) { if ((toupper (*indd) == 'D') && (!user_ok ())) { texte (T_ERR + 18); retour_mbl (); } else { maj_niv (N_YAPP, 0, 0); pvoie->temp1 = pvoie->niv1; error = (menu_yapp () == 0); } } else help ("Y"); break; case 'Z': if (!ISGRAPH (*indd)) { --indd; pvoie->temp1 = pvoie->niv1; strcpy (pvoie->dos_path, "\\"); maj_niv (N_DOS, 7, 0); del_file (); } else error = 1; break; case '$': if (droits (COSYSOP)) { incindd (); mbl_disbul (); retour_mbl (); } else error = 1; break; case '[': if (forward_auth (voiecur)) { while (ISGRAPH (*indd)) ++indd; if (*(indd - 1) == ']') { analyse_idnt (pt_err); if (pvoie->prot_fwd & FWD_FBB) { pvoie->temp1 = 0; pvoie->ind_mess = 0; pvoie->temp2 = FALSE; init_rec_fwd (voiecur); maj_niv (N_FORW, 5, 2); return; } else pvoie->mode |= F_BBS; prompt (pvoie->finf.flags, pvoie->niv1); } else cmd_err (pt_err); } else cmd_err (--indd); break; case '*': if ((*indd == '*') && (*(indd + 1) == '*')) { indd += 3; if (test_linked ()) { traite_voie (voiecur); /* Il y a des actions */ } } else { cmd_err (--indd); } cmd = 0; break; case ';': cmd = 0; break; case '\0': cmd = 0; prompt (pvoie->finf.flags, N_MBL); break; default: cmd = 0; --indd; if (defaut () == 0) { ++indd; if (appel_pg (com) == 0) error = 1; } break; } if (error) { cmd_err (com); } } } if (cmd) { pvoie->aut_linked = 0; } } void mbl_emul (void) { df ("mbl_emul", 0); switch (pvoie->niv2) { case N_MENU: menu_mbl (); break; case N_FORW: mbl_send (); break; case 1: mbl_list (); break; case 2: mbl_read (pvoie->recliste.l); break; case 3: break; case 4: mbl_kill (); break; case 5: wp_search (); break; case 6: mbl_read (pvoie->recliste.l); break; case 7: mbl_name (); break; case 8: mbl_dump (); break; case 9: mbl_tell (); break; case 11: mbl_edit (); break; case 13: duplex_tnc (); break; case 14: mbl_passwd (); break; case 16: mess_liste (1); break; case 17: exec_pg (); break; case 18: review (); break; case 19: #ifdef __WINDOWS__ end_win_edit (); #endif #ifdef __FBBDOS__ end_mini_edit (); #endif break; #ifdef __LINUX__ case 20: exec_cmd (NULL); break; #endif case 98: export_message (io_fich); break; case 99: import_message (io_fich); break; } ff (); } fbb-7.04j/src/mbl_opt.c0100644000175100017510000002443507726646105013016 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* * Module emulation WA7MBL */ static int len_bbs (char *); void mbl_disbul (void) { long no; int nobbs, cmpmsk, noctet, debut; char s[80]; bullist *pbul; if ((*indd) && ((no = lit_chiffre (1)) != 0L)) { if ((pbul = ch_record (NULL, no, '\0')) != NULL) { debut = 1; s[0] = ' '; ltoa (no, varx[0], 10); texte (T_MBL + 34); for (nobbs = 0; nobbs < NBBBS; nobbs++) { noctet = (nobbs - 1) / 8; cmpmsk = 1 << ((nobbs - 1) % 8); if ((pbul->type) && (pbul->fbbs[noctet] & cmpmsk)) { strn_cpy (6, s + 1, bbs_ptr + (nobbs - 1) * 7); if (debut) { debut = 0; out ("Fwd:", 4); } out (s, strlen (s)); } } if (!debut) cr (); debut = 1; for (nobbs = 0; nobbs < NBBBS; nobbs++) { noctet = (nobbs - 1) / 8; cmpmsk = 1 << ((nobbs - 1) % 8); if ((pbul->type) && (pbul->forw[noctet] & cmpmsk)) { if (*(bbs_ptr + (nobbs - 1) * 7)) { if (debut) { debut = 0; out ("Ok :", 4); } strn_cpy (6, s + 1, bbs_ptr + (nobbs - 1) * 7); out (s, strlen (s)); } } } if (!debut) cr (); } else { ptmes->numero = no; texte (T_ERR + 10); } } else texte (T_ERR + 3); } void mbl_tell (void) { int sav_voie = voiecur; char s[80]; pvoie->lignes = -1; switch (pvoie->niv3) { case 0: tst_appel (); if ((!ok_tell) || (svoie[CONSOLE]->sta.connect) || (v_tell)) { texte (T_MBL + 12); retour_mbl (); } else { pvoie->sniv1 = N_MBL; pvoie->sniv2 = 0; pvoie->sniv3 = 0; texte (T_MBL + 13); #ifdef ENGLISH sprintf (s, "%6s (%s) calling ", pvoie->sta.indicatif.call, pvoie->finf.prenom); #else sprintf (s, "Appel de %6s (%s)", pvoie->sta.indicatif.call, pvoie->finf.prenom); #endif #if defined(__WINDOWS__) || defined(__LINUX__) sysop_call (s); #endif #ifdef __FBBDOS__ console_on (); trait (-1, s); #endif v_tell = voiecur; music (1); ch_niv3 (1); } break; case 1: if (t_tell == 0) { #if defined(__WINDOWS__) || defined(__LINUX__) sysop_end (); #endif #ifdef __FBBDOS__ console_off (); trait (0, " "); #endif t_tell = -1; texte (T_MBL + 14); v_tell = 0; retour_mbl (); } break; case 2: if (v_tell) { if (voiecur == v_tell) { selvoie (CONSOLE); outs (indd, strlen (indd)); } else { selvoie (v_tell); outs (indd, strlen (indd)); } selvoie (sav_voie); } else { console_off (); maj_niv (0, 0, 0); pvoie->deconnect = -1; close_print (); } if (t_tell == 0) t_tell = -1; break; } } int affiche_forward (int nobbs) { int pos, noctet, i, j; int ok = 0; char cmpmsk; char *ptr; char s[80]; recfwd *prec; lfwd *ptr_fwd = tete_fwd; unsigned offset = 0; bloc_mess *bptr = tete_dir; bullist bul; pos = 0; noctet = (nobbs - 1) / 8; cmpmsk = 1 << ((nobbs - 1) % 8); ptr = bbs_ptr + (nobbs - 1) * 7; if (fast_fwd) { while (1) { if (pos == NBFWD) { ptr_fwd = ptr_fwd->suite; if (ptr_fwd == NULL) break; pos = 0; } prec = &ptr_fwd->fwd[pos]; if ((prec->type) && ((nobbs == 0) || (prec->fbbs[noctet] & cmpmsk))) { sprintf (s, "%c %6ld %2d KB ", prec->type, prec->nomess, prec->kb); outs (s, strlen (s)); ++ok; if (nobbs == 0) { ptr = bbs_ptr; for (i = 0; i < NBMASK; i++) { cmpmsk = '\001'; for (j = 0; j < 8; j++) { if (prec->fbbs[i] & cmpmsk) { outs (ptr, len_bbs (ptr)); outs (" ", 1); } ptr += 7; cmpmsk <<= 1; } } cr (); } else { outsln (ptr, len_bbs (ptr)); } } pos++; } } else { ouvre_dir (); while (bptr) { if (bptr->st_mess[offset].noenr) { read_dir (bptr->st_mess[offset].noenr, &bul); if (bul.type) { int kb = (int) (bul.taille >> 10); if ((bul.type) && ((nobbs == 0) || (bul.fbbs[noctet] & cmpmsk))) { sprintf (s, "%c %6ld %2d KB ", bul.type, bul.numero, kb); outs (s, strlen (s)); ++ok; if (nobbs == 0) { ptr = bbs_ptr; for (i = 0; i < NBMASK; i++) { cmpmsk = '\001'; for (j = 0; j < 8; j++) { if (bul.fbbs[i] & cmpmsk) { outs (ptr, len_bbs (ptr)); outs (" ", 1); } ptr += 7; cmpmsk <<= 1; } } cr (); } else { outsln (ptr, len_bbs (ptr)); } } } } if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } } } return (ok); } int bye (void) { sup_ln (indd); return ((strcmpi (indd, "YE") == 0) || (!ISGRAPH (*indd))); } static int len_bbs (char *bbs) { int nb = 0; while (nb < 6) { if (*bbs++ == '\0') break; ++nb; } return (nb); } static void opt_choix (char c) { if (c == Oui) strcpy (varx[0], langue[vlang]->plang[OUI - 1]); else strcpy (varx[0], langue[vlang]->plang[NON - 1]); } int mbl_options (void) { int nb, ok = 0; int error = 0; FILE *fptr; info frec; long base; char c; if (((c = *indd++) != 0) && (ISGRAPH (c))) { switch (toupper (c)) { case 'L': /* Langue */ if (*indd == ' ') { teste_espace (); if (isdigit (*indd)) { nb = atoi (indd); if ((ok = ch_language (nb, pvoie->ncur, &frec)) != 0) { pvoie->finf.lang = nb - 1; init_langue (voiecur); texte (2); } else texte (T_ERR + 22); } else texte (T_ERR + 3); } else { texte (T_MBL + 31); for (nb = 0; nb < maxlang; nb++) { sprintf (varx[0], "%2d", nb + 1); sprintf (varx[1], "%-10s", nomlang + nb * LG_LANG); /* itoa(nb + 1, varx[0], 10) ; var_cpy(1, nomlang + nb * LG_LANG) ; */ texte (T_MBL + 32); if (((nb + 1) % 4) == 0) cr (); } cr_cond (); } break; case 'M': /* Nouveaux messages */ if (NEW (pvoie->finf.flags)) { ch_bit (pvoie->ncur, &frec, F_NEW, Non); pvoie->finf.flags &= (~F_NEW); opt_choix (Non); } else { ch_bit (pvoie->ncur, &frec, F_NEW, Oui); pvoie->finf.flags |= (F_NEW); opt_choix (Oui); } texte (T_MBL + 52); break; case 'N': /* Base messages */ if (*indd == ' ') { teste_espace (); if (isdigit (*indd)) { base = atol (indd); if (base > (nomess >> 7)) base /= 1000L; pvoie->finf.on_base = (int) base; } else texte (T_ERR + 3); } /************ SERA A SUPPRIMER -> REMPLACE PAR $q ************/ ltoa (1000L * (long) pvoie->finf.on_base, varx[0], 10); texte (T_MBL + 26); break; case 'P': /* Pagination */ if (*indd == ' ') { teste_espace (); if (isdigit (*indd)) { ch_bit (pvoie->ncur, &frec, F_PAG, Oui); nb = atoi (indd); if (nb < 4) nb = 4; if (nb > 100) nb = 100; pvoie->finf.nbl = nb; pvoie->finf.flags |= (F_PAG); ok = 1; texte (T_MBL + 23); } else texte (T_ERR + 3); } else { if (PAG (pvoie->finf.flags)) { ch_bit (pvoie->ncur, &frec, F_PAG, Non); pvoie->finf.flags &= (~F_PAG); texte (T_MBL + 22); } else { ch_bit (pvoie->ncur, &frec, F_PAG, Oui); pvoie->finf.flags |= (F_PAG); texte (T_MBL + 23); } } break; case 'R': /* Lecture restreinte */ if (droits (CONSMES)) { if (PRV (pvoie->finf.flags)) { ch_bit (pvoie->ncur, &frec, F_PRV, Non); pvoie->finf.flags &= (~F_PRV); opt_choix (Non); } else { ch_bit (pvoie->ncur, &frec, F_PRV, Oui); pvoie->finf.flags |= (F_PRV); opt_choix (Oui); } texte (T_MBL + 51); } else { sprintf (varx[0], "O%c", c); texte (T_ERR + 1); } break; default: /* Erreur */ error = 1; --indd; /* sprintf(varx[0], "O%c", c) ; texte(T_ERR + 1) ; */ break; } } else { if (PAG (pvoie->finf.flags)) texte (T_MBL + 23); else texte (T_MBL + 22); if (droits (CONSMES)) { if (PRV (pvoie->finf.flags)) opt_choix (Oui); else opt_choix (Non); texte (T_MBL + 51); } if (NEW (pvoie->finf.flags)) opt_choix (Oui); else opt_choix (Non); texte (T_MBL + 52); texte (2); /************ SERA A SUPPRIMER -> REMPLACE PAR $q ************/ ltoa (1000L * (long) pvoie->finf.on_base, varx[0], 10); texte (T_MBL + 26); } if (!pvoie->read_only && ok) { if (pvoie->ncur->coord == 0xffff) dump_core (); fptr = ouvre_nomenc (); fseek (fptr, (long) pvoie->ncur->coord * sizeof (info), 0); fread (&frec, sizeof (info), 1, fptr); frec.nbl = pvoie->finf.nbl; frec.lang = pvoie->finf.lang; fseek (fptr, (long) pvoie->ncur->coord * sizeof (info), 0); fwrite (&frec, sizeof (info), 1, fptr); ferme (fptr, 36); } return (error); } int ch_language (int nb, ind_noeud * noeud, info * frec) { int ok = 1; FILE *fptr; if ((nb < 1) || (nb > maxlang)) ok = 0; else if (!pvoie->read_only) { if (noeud->coord == 0xffff) dump_core (); fptr = ouvre_nomenc (); fseek (fptr, ((long) noeud->coord * sizeof (info)), 0); fread (frec, sizeof (info), 1, fptr); frec->lang = nb - 1; fseek (fptr, ((long) noeud->coord * sizeof (info)), 0); fwrite (frec, sizeof (info), 1, fptr); ferme (fptr, 36); } return (ok); } fbb-7.04j/src/mbl_prn.c0100644000175100017510000001401107726646105013000 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MBL_PRN.C */ #include #ifdef __FBBDOS__ static char print_name[128]; static int print_string (char *, FILE *); #endif static int open_print (void); static int print_mess (int, bullist *); #ifdef __FBBDOS__ static void print_file (char *ptr); #endif int mbl_print (void) { bullist *pbul; long no; int ok = 0; int verbose = 0; int old_print = print; if (voiecur != CONSOLE) return (0); incindd (); if (!ISGRAPH (*indd)) { if (print) { close_print (); } else { open_print (); } return (1); } #ifdef __FBBDOS__ if (*indd == '>') { incindd (); print_file (indd); return (1); } #endif if (toupper (*indd) == 'V') { verbose = 1; incindd (); } if (!print) open_print (); while ((no = lit_chiffre (1)) != 0L) { ok = 1; if ((pbul = ch_record (NULL, no, '\0')) != NULL) { if (!print_mess (verbose, pbul)) break; } else texte (T_ERR + 10); } if (!old_print) close_print (); return (ok); } static int print_mess (int verbose, bullist * pbul) { #ifdef __FBBDOS__ char *ptr; FILE *fptr; int fd; int c, first = 1; int nb = 0; int call = 0; char ligne[90]; char chaine[256]; int flag = FALSE; long record = 0L; short postexte = 0; trait_time = 0; *ptmes = *pbul; if (*ptmes->bbsv) sprintf (varx[0], "@%-6s ", ptmes->bbsv); else *varx[0] = '\0'; fputc ('\r', file_prn); if (!print) return (0); fputc ('\n', file_prn); if (!print) return (0); ptr = expand (langue[vlang]->plang[T_MBL + 35 - 1]); if (!print_string (ptr, file_prn)) return (0); ptr = expand (langue[vlang]->plang[T_MBL + 38 - 1]); if (!print_string (ptr, file_prn)) return (0); if ((fptr = fopen (mess_name (MESS, ptmes->numero, chaine), "rb")) == NULL) return (0); if (!verbose) { /* fseek(fptr, supp_header(fptr, 0), 0) ; */ ptr = ligne; while ((c = fgetc (fptr)) != EOF) { if ((flag) && (c == '\n')) { record = ftell (fptr); postexte = 0; call = 0; flag = FALSE; } else { switch (call) { case 0: break; case 1: if (isalnum (c)) { *ptr++ = c; nb++; call = 2; } break; case 2: if (isalnum (c)) { *ptr++ = c; nb++; } else { *ptr++ = '!'; nb++; call = 0; if (nb >= 65) { *ptr++ = '\r'; *ptr++ = '\n'; nb += 2; fflush (file_prn); write (fileno (file_prn), ligne, nb); nb = 0; ptr = ligne; first = 2; } } break; } if (postexte == 0) { if (c != 'R') /*return(record) */ break; else flag = TRUE; } if ((postexte == 1) && (flag) && (c != ':')) /*return(record) */ break; ++postexte; } if ((flag) && (c == '@')) { if (first) { fflush (file_prn); if (first == 1) { write (fileno (file_prn), "Path: !", 7); } else { write (fileno (file_prn), " !", 7); } first = 0; } call = 1; } } if (nb) { *ptr++ = '\r'; *ptr++ = '\n'; nb += 2; fflush (file_prn); write (fileno (file_prn), ligne, nb); } } if (!print) return (0); fseek (fptr, record, 0); fflush (fptr); fflush (file_prn); fd = fileno (fptr); copy_fic (fd, fileno (file_prn), NULL); fclose (fptr); #endif return (1); } #ifdef __FBBDOS__ static int print_string (char *ptr, FILE * fptr) { while (*ptr) { if (*ptr == '\n') { fputc ('\r', fptr); if (!print) return (0); } fputc (*ptr, fptr); if (!print) return (0); ++ptr; } return (1); } #endif void init_print (void) { #ifdef __FBBDOS__ file_prn = stdprn; strcpy (print_name, "PRN:"); #endif } #ifdef __FBBDOS__ static void print_file (char *ptr) { char old[128]; char s[256]; int ok = print; sup_ln (ptr); if (*ptr) { strcpy (old, print_name); close_print (); if (*ptr == '-') { file_prn = stdprn; strcpy (print_name, "PRN:"); } else { strcpy (print_name, strupr (ptr)); } ok = open_print (); print = 0; if (!ok) { #ifdef ENGLISH sprintf (s, "Error printing to %s ", print_name); #else sprintf (s, "Erreur impression sur %s", print_name); #endif strcpy (print_name, old); } } #ifdef ENGLISH sprintf (s, "Printing to %s ", print_name); #else sprintf (s, "Impression sur %s", print_name); #endif outln (s, strlen (s)); print = ok; } #endif void close_print (void) { print = 0; #if defined( __WINDOWS__) || defined(__LINUX__) SpoolLine (0, 0, NULL, 0); #endif #ifdef __FBBDOS__ if ((file_prn != stdprn) && (file_prn)) { fclose (file_prn); } file_prn = NULL; trait (0, ""); #endif } static int open_print (void) { #ifdef __LINUX__ print = 1; #endif #ifdef __WINDOWS__ print = 1; #endif #ifdef __FBBDOS__ if (file_prn) close_print (); if (strcmp (print_name, "PRN:") == 0) { print = 1; file_prn = stdprn; } else if ((file_prn = fopen (print_name, "ab")) != NULL) { print = 1; } trait (0, ""); #endif return (print); } fbb-7.04j/src/mbl_read.c0100644000175100017510000004144307726646105013125 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* * Module MBL_READ.C */ #define NO_STATUS static int mbl_rx (int); static int read_mine (int); static int teste_liste (bullist *); /* Commande 'R' -> Read message */ /* Commande 'V' -> Read verbose message */ #include "aff_stat.c" static int strfind (bullist * pbul, char *cherche) { return (strmatch (ltitre (1, pbul), cherche)); } static int teste_liste (bullist * lbul) { if (lbul->numero < pvoie->recliste.debut) return (0); if (lbul->numero > pvoie->recliste.fin) return (0); if (lbul->date < pvoie->recliste.avant) return (0); if (lbul->date > pvoie->recliste.apres) return (0); if (!droits (COSYSOP)) { if (strcmp (lbul->desti, "KILL") == 0) return (0); if (lbul->type == 'A') return (0); if ((lbul->status == 'K') && (pvoie->recliste.status != 'K')) return (0); if ((lbul->status == 'A') && (pvoie->recliste.status != 'A')) return (0); } if (*pvoie->recliste.find) return (strfind (lbul, pvoie->recliste.find)); if ((pvoie->recliste.type) && (pvoie->recliste.type != lbul->type)) return (0); if ((pvoie->recliste.status) && (pvoie->recliste.status != lbul->status)) return (0); if ((*pvoie->recliste.exp) && (!strmatch (lbul->exped, pvoie->recliste.exp))) return (0); if ((*pvoie->recliste.dest) && (!strmatch (lbul->desti, pvoie->recliste.dest))) return (0); if (*pvoie->recliste.bbs) { if (*pvoie->recliste.bbs == '-') { if (*lbul->bbsv) return (0); } else { if (!strmatch (lbul->bbsv, pvoie->recliste.bbs)) return (0); } } return (1); } static int read_mine (int mode) { /* Lecture des messages personnels */ bloc_mess *temp = tete_dir; int i, nouveau = 0, trouve = 0; unsigned indic; bullist pbul; mess_noeud *lptr; char s[80]; rd_list *ptemp = NULL; if (isdigit (mode)) { s[0] = (char) mode; s[1] = '\0'; insnoeud (s, &indic); } else { if (mode == 'N') nouveau = 1; indic = pvoie->no_indic; } ouvre_dir (); while (temp->suiv) temp = temp->suiv; while (temp) { i = T_BLOC_MESS; while (i--) { lptr = &temp->st_mess[i]; if ((lptr->noenr) && (lptr->no_indic == indic)) { read_dir (lptr->noenr, &pbul); if ((pbul.type) && (pbul.status != 'H') && ((!nouveau) || (nouveau && (pbul.status == 'N')))) { trouve = 1; if (ptemp) { ptemp->suite = (rd_list *) m_alloue (sizeof (rd_list)); ptemp = ptemp->suite; } else pvoie->t_read = ptemp = (rd_list *) m_alloue (sizeof (rd_list)); ptemp->suite = NULL; ptemp->nmess = lptr->nmess; ptemp->verb = pvoie->recliste.l; } } } temp = prec_dir (temp); } ferme_dir (); if (!trouve) { if (nouveau) texte (T_MBL + 4); else texte (T_MBL + 3); } return (trouve); } int mbl_bloc_list (void) { int retour = 0; bullist ligne; rd_list *ptemp; unsigned offset = pvoie->recliste.offset; bloc_mess *bptr = pvoie->recliste.ptemp; mess_noeud *mptr; ptemp = pvoie->t_read; while (ptemp) ptemp = ptemp->suite; pvoie->seq = FALSE; ouvre_dir (); while (bptr) { --offset; mptr = &(bptr->st_mess[offset]); read_dir (mptr->noenr, &ligne); if (ligne.numero < pvoie->recliste.debut) break; if ((mptr->noenr) && (droit_ok (&ligne, 1)) && (teste_liste (&ligne))) { if (pvoie->recliste.last-- == 0L) break; if (pvoie->temp1) pvoie->temp1 = 0; /* Entre le numero trouve en liste */ if (ptemp) { ptemp->suite = (rd_list *) m_alloue (sizeof (rd_list)); ptemp = ptemp->suite; } else { pvoie->t_read = ptemp = (rd_list *) m_alloue (sizeof (rd_list)); } ptemp->suite = NULL; ptemp->nmess = ligne.numero; ptemp->verb = pvoie->recliste.l; } if (offset == 0) { bptr = prec_dir (bptr); offset = T_BLOC_MESS; } if (!(POP (no_port (voiecur))) && (trait_time > MAXTACHE)) { pvoie->seq = TRUE; retour = 1; break; } } ferme_dir (); pvoie->recliste.offset = offset; pvoie->recliste.ptemp = bptr; if ((!retour) && (pvoie->t_read)) retour = 2; return (retour); } int mbl_rx (int verbose) { int error = 0; long no; int c, ok = TRUE; bullist *pbul; rd_list *ptemp = NULL; df ("mbl_rx", 1); /* print_fonction(stdout); print_history(stdout); sleep_(10); for (;;); */ sup_ln (indd); c = toupper (*indd); ++indd; if ((c != ' ') && (*indd != ' ') && (*indd != '\0')) { ff (); return (1); } pvoie->aut_nc = 1; libere_tread (voiecur); init_recliste (voiecur); pvoie->recliste.l = verbose; switch (c) { case 'A': pvoie->recliste.status = 'A'; break; case 'B': pvoie->recliste.type = 'B'; break; case 'E': if (droits (COSYSOP)) { int v; for (v = 0; v < NBVOIES; v++) { if ((svoie[v]->niv1 == N_MBL) && (svoie[v]->niv2 == 18)) { texte (T_TRT + 0); ok = 0; /* Interdit le multi-acces */ break; } } if (ok) { maj_niv (N_MBL, 18, 0); ff (); return (review ()); } } else { --indd; error = 1; ok = 4; } break; case 'F': pvoie->recliste.status = 'F'; break; case 'K': pvoie->recliste.status = 'K'; break; case 'L': if (teste_espace ()) { if (isdigit (*indd)) pvoie->recliste.last = lit_chiffre (0); else { texte (T_ERR + 3); ok = 0; } } else { /* texte(T_ERR + 2) ; */ --indd; error = 1; ok = 4; } break; case 'M': case 'N': if (read_mine (c)) ok = 2; else ok = 0; break; case 'P': pvoie->recliste.type = 'P'; break; case 'S': if (teste_espace ()) strn_cpy (19, pvoie->recliste.find, indd); else { /* texte(T_ERR + 2) ; */ --indd; error = 1; ok = 4; } break; case 'T': pvoie->recliste.type = 'T'; break; case 'U': pvoie->recliste.type = 'P'; pvoie->recliste.status = 'N'; break; case 'X': pvoie->recliste.status = 'X'; break; case 'Y': pvoie->recliste.status = 'Y'; break; case '$': pvoie->recliste.status = '$'; break; case '<': if (teste_espace ()) { strn_cpy (6, pvoie->recliste.exp, indd); } else { texte (T_ERR + 2); ok = 0; } break; case '>': if (teste_espace ()) { strn_cpy (6, pvoie->recliste.dest, indd); } else { texte (T_ERR + 2); ok = 0; } break; case '@': if (teste_espace ()) { strn_cpy (6, pvoie->recliste.bbs, indd); } else { /* texte(T_ERR + 2) ; */ --indd; error = 1; ok = 4; } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (read_mine (c)) ok = 2; else ok = 0; break; case ' ': if (strchr (indd, '-')) { if (isdigit (*indd)) pvoie->recliste.debut = lit_chiffre (1); else { texte (T_ERR + 3); ok = 0; break; } ++indd; /* saute le tiret */ if (isdigit (*indd)) pvoie->recliste.fin = lit_chiffre (1); if (pvoie->recliste.fin <= pvoie->recliste.debut) ok = 0; } else { ok = 0; while ((no = lit_chiffre (1)) != 0L) { if ((pbul = ch_record (NULL, no, ' ')) != NULL) { if (droit_ok (pbul, 1)) { if (ptemp) { ptemp->suite = (rd_list *) m_alloue (sizeof (rd_list)); ptemp = ptemp->suite; } else { pvoie->t_read = ptemp = (rd_list *) m_alloue (sizeof (rd_list)); } ptemp->suite = NULL; ptemp->nmess = no; ptemp->verb = verbose; ok = 2; } else texte (T_ERR + 10); } else texte (T_ERR + 10); /* Only one message by request in POP mode */ if (POP (no_port (voiecur))) break; } } break; default: if ((c == '\0') && (verbose)) { texte (T_MBL + 8); ok = 0; } else { error = 1; --indd; ok = 4; } break; } switch (ok) { case 0: retour_mbl (); break; case 1: pvoie->recliste.ptemp = last_dir (); pvoie->recliste.offset = T_BLOC_MESS; pvoie->temp1 = 1; pvoie->sr_mem = 1; ch_niv3 (1); mbl_read (verbose); break; case 2: pvoie->sr_mem = 1; ch_niv3 (2); mbl_read (verbose); break; } ff (); return (error); } int mbl_read (int verbose) { int error = 0; df ("mbl_read", 1); switch (pvoie->niv3) { case 0: error = mbl_rx (verbose); break; case 1: switch (mbl_bloc_list ()) { case 0: /* Pas de message */ texte (T_MBL + 3); retour_mbl (); case 1: /* Pas fini */ break; case 2: /* Termine */ ch_niv3 (2); mbl_read (verbose); break; } break; case 2: if (mbl_mess_read () == 0) { retour_mbl (); } break; case 3: if (read_mess (1) == 0) ch_niv3 (2); break; default: fbb_error (ERR_NIVEAU, "MSG-READ", pvoie->niv3); } ff (); return (error); } static void entete_mess (bullist * ligne) { *ptmes = *ligne; if (*(ligne->bbsv)) sprintf (varx[0], "@%-6s ", ligne->bbsv); else *varx[0] = '\0'; texte (T_MBL + 35); texte (T_MBL + 38); } static void end_read_mess (void) { char s[80]; rd_list *ptemp = pvoie->t_read; if (ptemp) { sprintf (s, "R %ld", ptemp->nmess); fbb_log (voiecur, 'M', s); cr_cond (); if (POP (no_port (voiecur))) { out("\033", 1); } else { texte (T_MBL + 33); } marque_obuf (); pvoie->t_read = ptemp->suite; m_libere (ptemp, sizeof (rd_list)); } } char *pop_date(long date) { char *day[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; char *mon[]= {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; struct tm *sdate; static char cdate[40]; sdate = localtime (&date); sprintf (cdate, "%s, %02d %s %d %02d:%02d:%02d %+03ld00", day[sdate->tm_wday], sdate->tm_mday, mon[sdate->tm_mon], sdate->tm_year + 1900, sdate->tm_hour, sdate->tm_min, sdate->tm_sec, -timezone/3600); return cdate; } int read_mess (int verbose) { int nb; FILE *fptr; char chaine[256]; rd_list *ptemp = pvoie->t_read; nb = 0; if ((fptr = ouvre_mess (O_TEXT, ptemp->nmess, '\0')) != NULL) { fseek (fptr, pvoie->enrcur, 0); if (!verbose) fseek (fptr, supp_header (fptr, 1), 0); fflush (fptr); while ((nb = read (fileno (fptr), chaine, 250)) > 0) { outs (chaine, nb); if (!(POP (no_port (voiecur))) && (pvoie->memoc >= MAXMEM)) { /* if (!getvoie(CONSOLE]->connect) cprintf("Max atteint\r\n") ; */ pvoie->enrcur = ftell (fptr); break; } } ferme (fptr, 45); } if (nb == 0) end_read_mess (); return (nb); } static void trans_header (char *ptr, char *bbsfrom, long date) { static char ligne[80]; int c; int champ; int nb; int len; int bbs; char rbbs[80]; char home[41]; ptr += 2; champ = 2; nb = 0; bbs = 0; *home = '\0'; date = 0L; do { c = *ptr; switch (champ) { case 0: switch (c) { case '@': bbs = 1; champ = 3; nb = 0; break; case '#': champ = 6; nb = 0; break; case '$': champ = 7; nb = 0; break; case '[': champ = 4; nb = 0; break; case 'Z': if (*(ptr + 1) == ':') { ++ptr; champ = 5; nb = 0; } break; default: if ((bbs == 0) && (isdigit (c))) { nb = 0; rbbs[nb++] = c; champ = 6; } } case 1: if (isspace (c)) champ = 0; break; case 2: /* Lecture de la date - Mettre la date la plus ancienne */ if (nb <= 10) rbbs[nb] = c; if (nb == 10) { long rdate ; rbbs[11] = '\0'; rbbs[6] = '\0'; if ((rdate = date_to_time (rbbs)) != 0L) date = rdate + hour_to_time (rbbs + 7); champ = 1; } ++nb; break; case 3: /* Lecture du home BBS */ if ((nb == 0) && (c == ':')) break; if ((ISGRAPH (c)) && (nb < 40)) { rbbs[nb++] = c; } else { rbbs[nb] = '\0'; strn_cpy (40, home, rbbs); champ = 0; } break; case 4: /* Lecture du Qth */ if ((c != ']') && (nb < 30)) { rbbs[nb++] = c; } else { rbbs[nb] = '\0'; champ = 0; } break; case 5: /* Lecture du Zip Code */ if ((ISGRAPH (c)) && (nb < 8)) { rbbs[nb++] = c; } else { rbbs[nb] = '\0'; champ = 0; } break; case 6: /* Lecture du home premier numero */ if ((nb == 0) && (c == ':')) break; if ((isdigit (c)) && (nb < 10)) { rbbs[nb++] = c; } else { rbbs[nb] = '\0'; if ((bbs == 0) && (c == '@')) { bbs = 1; champ = 3; nb = 0; } else champ = 0; } break; case 7: /* Lecture du BID/MID */ if ((nb == 0) && (c == ':')) break; if ((ISGRAPH (c)) && (nb < 12)) { rbbs[nb++] = c; } else { rbbs[nb] = '\0'; champ = 0; } break; } ++ptr; } while (ISPRINT (c)); len = sprintf(ligne, "Received: from %s ; %s", home, pop_date(date)); outsln(ligne, len); strcpy(bbsfrom, home); } static char *read_headers(long date) { int nb; FILE *fptr; char chaine[256]; rd_list *ptemp = pvoie->t_read; static char bbs[41]; nb = 0; *bbs = '\0'; if ((fptr = ouvre_mess (O_TEXT, ptemp->nmess, '\0')) != NULL) { while (fgets(chaine, sizeof(chaine), fptr)) { if (strncmp("R:", chaine, 2) != 0) break; trans_header(chaine, bbs, date); } ferme (fptr, 45); } return bbs; } char *xuidl(long numero, char *callsign) { int i; char call[10]; static char str[50]; sprintf(call, "%6s", callsign); for (i = 0 ; i < 6 ; i++) sprintf(str+i*2, "%02x", call[i] & 0xff); sprintf(str+i*2, "%032lx", numero); return str; } int mbl_mess_read (void) { bullist *pbul; rd_list *ptemp; while ((ptemp = pvoie->t_read) != NULL) { /* cprintf("Lit le %ld\r\n", ptemp->nmess) ; */ if ((pbul = ch_record (NULL, ptemp->nmess, 'Y')) != NULL) { if (POP (no_port (voiecur))) { int nb; char chaine[80]; char name[80]; char exped[80]; char *reply; Wps *wps; /* Get the name from WP */ wps = wp_find(pbul->exped, 0); if ((wps) && (*wps->name) && (*wps->name != '?')) { sprintf(name, "%s (%s)", pbul->exped, wps->name); } else { strcpy(name, pbul->exped); } /* Dump headers and get the older BBS for return address */ reply = read_headers(pbul->date); if (*reply == '\0') reply = mypath; /**** SHOULD BE CONFIGURABLE (BEGIN) ****/ if (*pop_host) { /*** address like f6fbb%f6fbb.fmlr.fra.eu@f6fbb.ampr.org */ nb = sprintf(exped, "%s%%%s@%s", pbul->exped, reply, pop_host); } else { nb = sprintf(exped, "%s@%s", pbul->exped, reply); } /**** SHOULD BE CONFIGURABLE (END) ****/ nb = sprintf(chaine, "Date: %s", pop_date(pbul->datesd)); outsln (chaine, nb); nb = sprintf(chaine, "From: %s <%s>", name, exped); outsln (chaine, nb); nb = sprintf(chaine, "To: %s", pbul->desti); outsln (chaine, nb); if (pbul->type == 'B') { /* News */ nb = sprintf(chaine, "Subject: [%s] %s", pbul->desti, pbul->titre); outsln (chaine, nb); nb = sprintf(chaine, "Message-ID: <%ld@%s>", pbul->numero, mycall); outsln (chaine, nb); } else { /* Mail */ nb = sprintf(chaine, "Subject: %s", pbul->titre); outsln (chaine, nb); nb = sprintf(chaine, "Message-ID: <%ld@%s>", pbul->numero, mycall); outsln (chaine, nb); nb = sprintf(chaine, "X-UIDL: %s", xuidl(pbul->numero, mycall)); outsln (chaine, nb); } cr(); } else { entete_mess (pbul); } pvoie->enrcur = 0L; if (read_mess (ptemp->verb)) { ch_niv3 (3); return (1); } } else { pvoie->t_read = ptemp->suite; m_libere (ptemp, sizeof (rd_list)); } } return (0); } void libere_tread (int voie) { rd_list *ptemp = svoie[voie]->t_read; rd_list *pprec; while ((pprec = ptemp) != NULL) { ptemp = pprec->suite; m_libere (pprec, sizeof (rd_list)); } svoie[voie]->t_read = NULL; } void libere_tlist (int voie) { rd_list *ptemp = svoie[voie]->t_list; rd_list *pprec; while ((pprec = ptemp) != NULL) { ptemp = pprec->suite; m_libere (pprec, sizeof (rd_list)); } svoie[voie]->t_list = NULL; } fbb-7.04j/src/mbl_rev.c0100644000175100017510000002450107726646105013002 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* * Module MBL_REV.C */ #include "aff_stat.c" #define REV_HOLD 100 typedef struct rev_list { long hold[REV_HOLD]; struct rev_list *next; } RevList; static RevList *hold_list = NULL; static int off_hlist = REV_HOLD; static int longcmp (const void *a, const void *b) { long la = *((long *) a); long lb = *((long *) b); if (la == lb) return (0); return (la < lb) ? -1 : 1; } static int exist_hold (long numero) { char holdname[130]; struct stat stat; hold_name (numero, holdname); return (stat (holdname, &stat) == 0); } void end_hold (void) { int i; RevList *rptr = hold_list; RevList *prev = NULL; while (rptr) { for (i = 0; i < REV_HOLD; i++) { if (!exist_hold (rptr->hold[i])) rptr->hold[i] = 0L; if (rptr->hold[i] != 0L) break; } if (i == REV_HOLD) { /* Le bloc est vide, on relie les chainons valides et on le libere */ if (prev) { /* Il y a un chainon avant */ prev->next = rptr->next; } else { /* C'etait la tete de liste */ hold_list = rptr->next; } /* Si le dernier bloc est libere, on prepare l'allocation d'un nouveau bloc */ if (rptr->next == NULL) off_hlist = REV_HOLD; m_libere (rptr, sizeof (RevList)); if (prev) rptr = prev->next; else rptr = hold_list; } else { prev = rptr; rptr = rptr->next; } } } int already_held (long numero) { int i; RevList *rptr = hold_list; while (rptr) { for (i = 0; i < REV_HOLD; i++) if (rptr->hold[i] == numero) return 1; rptr = rptr->next; } return 0; } int delete_hold (long numero) { int i; RevList *rptr = hold_list; while (rptr) { for (i = 0; i < REV_HOLD; i++) { if (rptr->hold[i] == numero) { rptr->hold[i] = 0L; return 1; } } rptr = rptr->next; } return 0; } void ajoute_hold (long numero) { RevList *rptr = hold_list; if (already_held (numero)) return; if (rptr) { /* Avance jusqu'au dernier maillon */ while (rptr->next) { rptr = rptr->next; } } if (off_hlist == REV_HOLD) { RevList *ptmp; /* Ajoute un maillon a la liste */ ptmp = m_alloue (sizeof (RevList)); memset (ptmp, 0, sizeof (RevList)); off_hlist = 0; if (rptr) { rptr->next = ptmp; } else hold_list = rptr = ptmp; } rptr->hold[off_hlist++] = numero; } void init_hold (void) { int done; long num; int i; int nb; long *hold_nb; char path[130]; struct ffblk ffblk; /* Cree ou remet la liste a jour. Les entrees non valides sont a 0 */ end_hold (); sprintf (path, "%s*.HLD", MESSDIR); /* Chercher le nombre de messages held */ nb = 0; done = findfirst (path, &ffblk, 0); while (!done) { ++nb; done = findnext (&ffblk); } if (nb) { hold_nb = (long *) malloc (nb * sizeof (long)); i = 0; /* Lire les noms de messages held */ done = findfirst (path, &ffblk, 0); while (!done) { sscanf (ffblk.ff_name, "%lx", &num); hold_nb[i] = num; if (++i > nb) break; done = findnext (&ffblk); } /* Tri de la liste */ qsort (hold_nb, nb, sizeof (long), longcmp); /* Insere les numeros tries dans la liste */ for (i = 0; i < nb; i++) ajoute_hold (hold_nb[i]); free (hold_nb); } nb_hold = nb; } static int next_hold (void) { int fd; int retour = 1; bullist lbul; char holdname[130]; int i; RevList *rptr = hold_list; while (rptr) { for (i = 0; i < REV_HOLD; i++) { if (rptr->hold[i] > pvoie->l_hold) { pvoie->l_hold = rptr->hold[i]; break; } } if (i != REV_HOLD) break; rptr = rptr->next; } if ((rptr == NULL) || (i == REV_HOLD)) { /* Pas de message suivant */ texte (T_MBL + 3); return retour; } hold_name (pvoie->l_hold, holdname); fd = open (holdname, O_RDONLY | O_BINARY); read (fd, &lbul, sizeof (bullist)); close (fd); cr (); *ptmes = lbul; ptmes->numero = ++pvoie->temp1; entete_liste (); aff_status (ptmes); retour = 2; pvoie->messdate = ptmes->datesd; return (retour); } static int read_hold (int verbose) { int nb; FILE *fptr; char chaine[256]; char holdname[130]; nb = 0; hold_name (pvoie->l_hold, holdname); if ((fptr = fopen (holdname, "rt")) != NULL) { fseek (fptr, pvoie->enrcur, 0); if (!verbose) { pvoie->enrcur = supp_header (fptr, 1); fseek (fptr, pvoie->enrcur, 0); } fflush (fptr); while ((nb = read (fileno (fptr), chaine, 250)) > 0) { outs (chaine, nb); if (pvoie->memoc >= MAXMEM) { /* if (!getvoie(CONSOLE]->connect) cprintf("Max atteint\r\n") ; */ pvoie->enrcur = ftell (fptr); break; } } ferme (fptr, 45); } else return (-1); return (nb); } void list_held (void) { char holdname[130]; int fd; bullist lbul; int premier = 1; int i; RevList *rptr; init_hold (); rptr = hold_list; while (rptr) { for (i = 0; i < REV_HOLD; i++) { if (rptr->hold[i]) { hold_name (rptr->hold[i], holdname); fd = open (holdname, O_RDONLY | O_BINARY); read (fd, &lbul, sizeof (bullist)); close (fd); *ptmes = lbul; ptmes->numero = pvoie->temp1 + 1; if (premier) { premier = 0; entete_liste (); } aff_status (ptmes); ++pvoie->temp1; } } rptr = rptr->next; } if (premier) texte (T_MBL + 3); } static void hold_question (void) { texte (T_MBL + 58); } int review (void) { int orig; int dest; int local = 0; int verbose = 0; int error = 0; long numess; char holdname[130]; char messname[130]; switch (pvoie->niv3) { case 0: init_hold (); pvoie->l_hold = 0L; pvoie->temp1 = 0; switch (next_hold ()) { case 0: ch_niv3 (1); break; case 1: retour_mbl (); break; case 2: hold_question (); ch_niv3 (2); break; } break; case 1: switch (next_hold ()) { case 0: break; case 1: retour_mbl (); break; case 2: hold_question (); ch_niv3 (2); break; } break; case 2: while_space (); switch (toupper (*indd)) { case 'V': verbose = 1; case 'R': /* Lire le message held */ pvoie->sr_mem = 0; pvoie->enrcur = 256L; switch (read_hold (verbose)) { case 0: pvoie->sr_mem = 0; hold_question (); ch_niv3 (2); break; case -1: retour_mbl (); break; default: ch_niv3 (3); break; } /* indd = data; sprintf(data, "%ld", ptmes->numero); list_read(verbose); if (mbl_mess_read() == 0) { pvoie->sr_mem = 0; hold_question(); ch_niv3(2); } else ch_niv3(3); */ break; case 'A': case 'K': case 'D': unlink (hold_name (pvoie->l_hold, holdname)); delete_hold (pvoie->l_hold); --nb_hold; aff_msg_cons (); switch (next_hold ()) { case 0: ch_niv3 (1); break; case 1: retour_mbl (); break; case 2: hold_question (); ch_niv3 (2); break; } break; case 'L': local = 1; case 'U': /* Unhold */ *(pvoie->appendf) = '\0'; *(pvoie->mess_bid) = '\0'; ptmes->numero = 0L; ptmes->theme = 0; pvoie->chck = 0; pvoie->m_ack = 0; pvoie->messdate = time (NULL); pvoie->mess_num = -1; if ((ptmes->type == 'B') || ((ptmes->type == 'P') && (strcmp (ptmes->desti, "SYSOP") == 0))) { if (*(ptmes->bbsv)) ptmes->status = '$'; else ptmes->status = 'N'; } else ptmes->status = 'N'; /* Copier le fichier avec un nouveau No de message */ hold_name (pvoie->l_hold, holdname); orig = open (holdname, O_RDONLY | O_BINARY); if (orig < 0) { retour_mbl (); break; } /* Saute le header */ lseek (orig, (long) sizeof (bullist), SEEK_SET); /* Lit le home-bbs */ fbb_read (orig, pvoie->mess_home, sizeof (pvoie->mess_home)); pvoie->mess_home[sizeof (pvoie->mess_home) - 1] = '\0'; /* Debut du texte */ lseek (orig, 256L, SEEK_SET); /* Cree un nouveau message */ numess = ptmes->numero = next_num (); mess_name (MESSDIR, ptmes->numero, messname); dest = open (messname, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IREAD | S_IWRITE); if (dest < 0) { close (orig); retour_mbl (); break; } copy_fic (orig, dest, NULL); close (orig); close (dest); unlink (holdname); delete_hold (pvoie->l_hold); --nb_hold; put_mess_fwd ('H'); if (local) { /* Pas de forwarding ... */ int i; for (i = 0; i < NBMASK; i++) { ptmes->forw[i] = 0xff; ptmes->fbbs[i] = '\0'; } maj_rec (ptmes->numero, ptmes); clear_fwd (ptmes->numero); /* Supprimer le via */ ptmes->bbsv[0] = '\0'; } tst_sysop (ptmes->desti, numess); tst_serveur (ptmes); tst_ack (ptmes); tst_warning (ptmes); aff_msg_cons (); cr (); switch (next_hold ()) { case 0: ch_niv3 (1); break; case 1: retour_mbl (); break; case 2: hold_question (); ch_niv3 (2); break; default: break; } break; case '\0': switch (next_hold ()) { case 0: ch_niv3 (1); break; case 1: retour_mbl (); break; case 2: hold_question (); ch_niv3 (2); break; } break; case 'Q': retour_mbl (); break; default: hold_question (); break; } break; case 3: switch (read_hold (1)) { case 0: pvoie->sr_mem = 0; hold_question (); ch_niv3 (2); break; case -1: retour_mbl (); break; } break; default: fbb_error (ERR_NIVEAU, "REVIEW", pvoie->niv3); } return (error); } fbb-7.04j/src/mbl_stat.c0100644000175100017510000002152507726646105013164 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* * Module status BBS */ extern Desc *desc; static char *intf (int port) { static char interf[10]; switch (p_com[(int)p_port[port].ccom].combios) { case 1: strcpy (interf, "ESS/COM."); break; case 2: strcpy (interf, "BPQ-HOST"); break; case 3: strcpy (interf, "FBBIOS "); break; case 4: strcpy (interf, "DRSI "); break; case 5: strcpy (interf, "TFPCR "); break; case 6: strcpy (interf, "WINDOWS "); break; case 7: strcpy (interf, "ETHERNET"); break; case 8: strcpy (interf, "TFWIN "); break; case 9: strcpy (interf, "LINUX "); break; default: strcpy (interf, "??? "); break; } return (interf); } static char *mode_port (int port) { static char mode[10]; int val; int i; char *ptr = mode; for (i = 0; i < 5; i++) *ptr++ = ' '; *ptr = '\0'; val = p_port[port].moport; ptr = mode; if (val & 0x01) *ptr++ = 'G'; else if (val & 0x02) *ptr++ = 'B'; else *ptr++ = 'U'; if (val & 0x04) *ptr++ = 'Y'; if (val & 0x08) *ptr++ = 'M'; if (val & 0x10) *ptr++ = 'W'; if (val & 0x20) *ptr++ = 'L'; return (mode); } static char *typort (int port) { static char protocole[10]; if (p_com[(int)p_port[port].ccom].combios == 3) { /* Modem */ strcpy (protocole, "FBBIOS"); } else { switch (p_port[port].typort) { case TYP_DED: strcpy (protocole, "WA8DED"); break; case TYP_PK: strcpy (protocole, "PK232 "); break; case TYP_KAM: strcpy (protocole, "KAM "); break; case TYP_BPQ: strcpy (protocole, "BPQ "); break; case TYP_MOD: strcpy (protocole, "MODEM "); break; case TYP_TCP: strcpy (protocole, "TCP-IP"); break; case TYP_SCK: strcpy (protocole, "S_AX25"); break; case TYP_AGW: strcpy (protocole, "AGW-PE"); break; case TYP_ETH: strcpy (protocole, "ETHER "); break; case TYP_HST: strcpy (protocole, "PTC-II"); break; case TYP_FLX: strcpy (protocole, "FLEX "); break; default: strcpy (protocole, "??? "); break; } } return (protocole); } #if 0 #ifndef __WINDOWS__ typedef struct { unsigned size; unsigned nb; } bloc; static int sort_function (const void *a, const void *b) { bloc *ab = (bloc *) a; bloc *bb = (bloc *) b; if (ab->size > bb->size) return (1); if (ab->size < bb->size) return (-1); return (0); } #endif #endif void mbl_stat (void) { int i; int ok; int voie; char call[20]; char freq[20]; char ligne[200]; int occ; long tot; int reste; int machine; long temps = time (NULL); cr (); sprintf (ligne, "Software FBB Version %s (%s) compiled on %s", version (), os (), date ()); outln (ligne, strlen (ligne)); sprintf (ligne, "Mem Us:%ld Mem Ok:%ld Bid:%d Lang:%d Ports:%d Ch:%d FBB %s BIN %s", mem_alloue, tot_mem, maxbbid, maxlang, nbport (), NBVOIES - 2, (fbb_fwd) ? "Ok" : "No", (bin_fwd) ? "Ok" : "No" ); outln (ligne, strlen (ligne)); #ifndef __DPMI16__ if (high_memory_type () == XMS) { sprintf (ligne, "Free XMS memory = %u KB", xms_free ()); outln (ligne, strlen (ligne)); } #endif cr (); occ = 0; tot = 0L; sprintf (ligne, "Available disks : "); out (ligne, strlen (ligne)); for (i = 0; i < 8; i++) { if (*PATH[i]) { sprintf (ligne, "%c: ", i + 'A'); out (ligne, strlen (ligne)); } } cr (); cr (); sprintf (ligne, "%s", typ_exms ()); outln (ligne, strlen (ligne)); cr (); if (*ligne != 'N') { for (i = 0; i < NB_EMS; i++) { if (t_ems[i].flag == 0) continue; ok = 0; if (desc[i].tot_bloc) { sprintf (ligne, " %s : %2d page(s) (%3ld KB)", t_ems[i].ctype, desc[i].tot_bloc, desc[i].size >> 10); occ += desc[i].tot_bloc; tot += desc[i].size; ok = 1; } else { if ((i != HROUTE) || ((i == HROUTE) && (!EMS_WPG_OK ()))) { sprintf (ligne, " %s : Unused", t_ems[i].ctype); ok = 1; } } if (ok) outln (ligne, strlen (ligne)); } sprintf (ligne, " Total :%3d page(s) (%3ld KB)", occ, tot >> 10); outln (ligne, strlen (ligne)); cr (); } sprintf (ligne, "Ch Callsign N1 N2 N3 Cnect Cmput T-Out Used Status Buf Freq" ); outln (ligne, strlen (ligne)); for (voie = 2; voie < NBVOIES; voie++) { occ = reste = machine = 0; if (svoie[voie]->sta.connect) { sprintf (call, "%-6s-%2d", svoie[voie]->sta.indicatif.call, svoie[voie]->sta.indicatif.num); occ = (int) (temps - svoie[voie]->debut); reste = (int) time_att[voie]; machine = (int) svoie[voie]->tmach; } else { continue; } if ((!svoie[voie]->sta.connect) && (DRSI (no_port (voie)))) strcpy (freq, "DRSI"); else if ((!svoie[voie]->sta.connect) && (BPQ (no_port (voie)))) strcpy (freq, "BPQ"); else strcpy (freq, p_port[no_port (voie)].freq); sprintf (ligne, "%02d %s %02d %02d %02d %3d:%02d %2d:%02d %2d:%02d %4d %s %2d %s", voie - 1, call, svoie[voie]->niv1, svoie[voie]->niv2, svoie[voie]->niv3, occ / 60, occ % 60, machine / 60, machine % 60, reste / 60, reste % 60, svoie[voie]->memoc + svoie[voie]->inbuf.nbcar, stat_voie (voie), svoie[voie]->sta.ack, freq ); outln (ligne, strlen (ligne)); } cr (); } void wreq_cfg (FILE * fptr) { int i; int occ; long tot; serlist *lptr; char buffer[256]; fprintf (fptr, "ReqCfg %s BBS\r\n", mycall); fprintf (fptr, "\r\nReqCfg V 1.2 (C) F6FBB 1992 - BBS %s\r\n\r\n", mycall); fprintf (fptr, "\r\nSoftware FBB Version %s (%s) compiled on %s\r\n\r\n", version (), os (), date ()); fprintf (fptr, "\r\nMem Us:%ld Mem Ok:%ld Bid:%d Ports:%d Ch:%d FBB %s BIN %s\r\n\r\n", mem_alloue, tot_mem, maxbbid, nbport (), NBVOIES - 2, (fbb_fwd) ? "Ok" : "No", (bin_fwd) ? "Ok" : "No" ); fprintf (fptr, "Available volumes : "); for (i = 0; i < 8; i++) { if (*PATH[i]) { fprintf (fptr, "%c: ", i + 'A'); } } fprintf (fptr, "\r\n\r\n"); occ = 0; tot = 0L; sprintf (buffer, "%s\r\n\r\n", typ_exms ()); fprintf (fptr, "%s", buffer); if (*buffer != 'N') { for (i = 0; i < NB_EMS; i++) { if (t_ems[i].flag == 0) continue; if (desc[i].tot_bloc) { fprintf (fptr, " %s : %2d page(s) (%3ld KB)\r\n", t_ems[i].ctype, desc[i].tot_bloc, desc[i].size >> 10); occ += desc[i].tot_bloc; tot += desc[i].size; } else if ((i != HROUTE) || ((i == HROUTE) && (!EMS_WPG_OK ()))) { fprintf (fptr, " %s : Unused\r\n", t_ems[i].ctype); } } fprintf (fptr, " Total :%3d page(s) (%3ld KB)\r\n", occ, tot >> 10); } fprintf (fptr, "\r\nLanguages\r\n\r\n"); for (i = 0; i < maxlang; i++) { fprintf (fptr, " %2d : %-10s\n", i + 1, nomlang + i * LG_LANG); } fprintf (fptr, "\r\nServers\r\n\r\n"); lptr = tete_serv; while (lptr) { fprintf (fptr, " %6s : %s\r\n", lptr->nom_serveur, lptr->com_serveur); lptr = lptr->suiv; } fprintf (fptr, "\r\nPort Interface Emulat. Ch Mode Frequency\r\n"); for (port = 1; port < NBPORT; port++) { if (!p_port[port].pvalid) continue; fprintf (fptr, "%d %s %s %-2d %s %s\r\n", port, intf (port), typort (port), p_port[port].nb_voies, mode_port (port), p_port[port].freq); } } int req_cfg (char *filename) { FILE *fptr; char buffer[256]; char sender[80]; char route[80]; fptr = fopen (filename, "rt"); /* Open the received message */ if (fptr == NULL) return (1); fgets (buffer, 80, fptr); /* Read the command line */ sscanf (buffer, "%*s %*s %*s %s\n", sender); *route = '\0'; fgets (buffer, 80, fptr); /* Read the subject */ strupr (buffer); /* Capitalize */ sscanf (buffer, "%*[^@\n]%[^\n]", route); /* Scan route */ fclose (fptr); /* All needed is read */ fptr = fappend (MAILIN, "b"); if (fptr == NULL) return (1); fprintf (fptr, "#\r\n"); /* Tell that this is a message from this BBS */ fprintf (fptr, "SP %s %s < %s\r\n", sender, route, mycall); wreq_cfg (fptr); fprintf (fptr, "\r\n/EX\r\n"); fclose (fptr); return (0); } fbb-7.04j/src/mbl_sys.c0100644000175100017510000001530107726646105013022 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #if defined(__FBBDOS__) || defined(__WINDOWS__) #define random_nb(val) random(val) #endif /* Teste si l'utilisateur a ou aura les droits apres la cmde SYS */ int droits_2 (unsigned int droit) { FILE *fptr; char indic[80]; char buffer[300]; unsigned ds, dss; if (droits (droit)) return (TRUE); if ((SYS (pvoie->finf.flags)) && (droit & ds_droits)) return (TRUE); /* Acces a la cmde SYS ? */ if (SYS (pvoie->finf.flags)) { if ((fptr = fopen (c_disque ("passwd.sys"), "rt")) != NULL) { if (fgets (buffer, 300, fptr)) { while (fgets (buffer, 300, fptr)) { sup_ln (buffer); if (*buffer == '#') continue; *indic = '\0'; ds = dss = 0; sscanf (buffer, "%s %u %u", indic, &ds, &dss); if (strcmp (pvoie->sta.indicatif.call, strupr (indic)) == 0) { fclose (fptr); return ((droit & dss) && (ds & CMDSYS)); } } } fclose (fptr); } return ((droit & dss_droits) && (ds_droits & CMDSYS)); } return (FALSE); } void change_droits (int voie) { FILE *fptr; char indic[80]; char buffer[300]; unsigned ds, dss; if (SYS (svoie[voie]->finf.flags)) { if ((fptr = fopen (c_disque ("passwd.sys"), "rt")) != NULL) { if (fgets (buffer, 300, fptr)) { while (fgets (buffer, 300, fptr)) { sup_ln (buffer); if (*buffer == '#') continue; *indic = '\0'; ds = dss = 0; sscanf (buffer, "%s %u %u", indic, &ds, &dss); if (strcmp (svoie[voie]->sta.indicatif.call, strupr (indic)) == 0) { fclose (fptr); if (*svoie[voie]->passwd) svoie[voie]->droits = dss; else svoie[voie]->droits = ds; return; } } } fclose (fptr); } if (*svoie[voie]->passwd) svoie[voie]->droits = dss_droits; else svoie[voie]->droits = ds_droits; } else svoie[voie]->droits = d_droits; } int comp_passwd (char *call, char *chaine, time_t pass_time) { int ok = 0; unsigned ds, dss; char indic[80]; char buffer[300]; char password[300]; char *ptr = NULL; FILE *fptr; int first = 1; if (*chaine == '!') { ++chaine; while (!ISGRAPH (*chaine)) ++chaine; } if (strlen (chaine) > 256) chaine[256] = '\0'; if ((fptr = fopen (c_disque ("passwd.sys"), "rt")) != NULL) { while (fgets (buffer, 300, fptr)) { sup_ln (buffer); ptr = buffer; if ((!isgraph (*buffer)) || (*buffer == '#')) continue; if (first) { /* Skip the first line */ first = 0; continue; } *indic = '\0'; ds = dss = 0; sscanf (buffer, "%s %u %u %[^\n]", indic, &ds, &dss, password); ptr = password; if (strcmpi (call, indic) == 0) { while (isspace (*ptr)) ++ptr; ok = 1; break; } } if (!ok) { rewind (fptr); while (fgets (buffer, 300, fptr)) { sup_ln (buffer); if ((!isgraph (*buffer)) || (*buffer == '#')) continue; ptr = buffer; /* Get global password */ /* sscanf (buffer, "%[^\n]", ptr); */ break; } } ok = (strcmpi (chaine, ptr) == 0); fclose (fptr); } if (!ok) { /* Checks MD5 */ uchar source[300]; uchar dest[80]; sprintf (source, "%010ld%s", pass_time, ptr); MD5String (dest, source); ok = (stricmp (dest, chaine) == 0); } return (ok); } char *mk_passwd (char *chaine) { static char str[80]; char temp[20]; int lg, i, rd; char *ptr = chaine; randomize (); lg = strlen (chaine); i = 0; sprintf (str, "%s-%d> ", mycall, myssid); while (*ptr) { if (ISGRAPH (*ptr)) ++i; ++ptr; } if (i > 7) { for (i = 0; i < 5; i++) { while (1) { rd = random_nb (lg); if (ISGRAPH (chaine[rd])) break; } pvoie->passwd[i] = toupper (chaine[rd]); chaine[rd] = '\0'; sprintf (temp, " %d", rd + 1); strcat (str, temp); } } else { strcat (str, " 0 0 0 0 0"); } /* MD5 password implementation */ pvoie->pass_time = time (NULL); sprintf (temp, " [%010ld]", pvoie->pass_time); strcat (str, temp); return (str); } char *snd_passwd (char *chaine) { int ok = 0; unsigned ds, dss; char indic[80]; char buffer[300]; char *ptr, *ind; FILE *fptr; int first = 1; sprintf (chaine, "%s-%d> ", mycall, myssid); *pvoie->passwd = 1; if ((fptr = fopen (c_disque ("passwd.sys"), "rt")) != NULL) { while (fgets (buffer, 300, fptr)) { ind = indic; ptr = buffer; if ((!isgraph (*buffer)) || (*buffer == '#')) continue; if (first) { /* Skip the first line */ first = 0; continue; } *indic = '\0'; ds = dss = 0; sscanf (buffer, "%s %u %u %[^\n]", indic, &ds, &dss, ptr); if (strcmp (pvoie->sta.indicatif.call, strupr (indic)) == 0) { while (isspace (*ptr)) ++ptr; ok = 1; break; } } if (!ok) { rewind (fptr); while (fgets (buffer, 300, fptr)) { if ((!isgraph (*buffer)) || (*buffer == '#')) continue; ptr = buffer; /* Get global password */ sscanf (buffer, "%[^\n]", ptr); break; } } strcpy (chaine, mk_passwd (buffer)); fclose (fptr); } return (chaine); } int tst_passwd (char *chaine) { int ok; sup_ln (chaine); /* strupr(chaine) */ ok = ((*chaine != '!') && (!strncmpi (chaine, pvoie->passwd, 5))); if (!ok) { ok = (comp_passwd (pvoie->sta.indicatif.call, chaine, pvoie->pass_time)); } return (ok); } #define PROTOTYPES 1 #include "global.h" #include "md5.h" void MD5String (unsigned char *dest, unsigned char *source) { int i; MD5_CTX context; unsigned char digest[16]; unsigned int len = strlen (source); MD5Init (&context); MD5Update (&context, source, len); MD5Final (digest, &context); *dest = '\0'; for (i = 0; i < 16; i++) { char tmp[5]; sprintf (tmp, "%02X", digest[i]); strcat (dest, tmp); } } fbb-7.04j/src/mbl_user.c0100644000175100017510000002303507726646105013165 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* * Module emulation WA7MBL */ static void aff_aide (FILE *); static int user_dump (unsigned); static int heardcmp (const void *, const void *); /* Commande ? -> Help */ void help (char *cmd) { if (*cmd) out_help (cmd); else { char str[10]; strcpy (str, "?"); out_help (str); } retour_menu (pvoie->niv1); } int out_help (char *cmde) { char buffer[257]; char str_aide[255]; char *ptr; char *cmd; static char qm[2] = "?"; FILE *fptr; int niveau; int position; int aide = FALSE; char command[80]; n_cpy (78, command, cmde); cmd = command; if ((!SYS (pvoie->finf.flags)) && (!LOC (pvoie->finf.flags)) && (P_GUEST (voiecur))) { position = -1; cmd = qm; } else position = pvoie->niv1; sprintf (buffer, "LANG\\%s.HLP", nomlang + nlang * LG_LANG); if ((fptr = fopen (c_disque (buffer), "rt")) != NULL) { strupr (sup_ln (cmd)); if (ISGRAPH (*cmd)) { while (fgets (buffer, 256, fptr)) { if (*buffer == '#') continue; if ((buffer[0] == '@') && (buffer[1] == '@')) { sscanf (buffer, "%*s %d %s", &niveau, str_aide); if (niveau == position) { for (ptr = strtok (str_aide, "|"); ptr; ptr = strtok (NULL, "|")) { if (strncmp (ptr, cmd, 80) == 0) { aff_aide (fptr); aide = TRUE; break; } } if (aide) break; } } } } ferme (fptr, 35); } if ((*cmd) && (!aide)) { var_cpy (0, cmd); texte (T_ERR + 5); } return (aide); } static void aff_aide (FILE * fptr) { char buffer[257]; char *ptr; int nb; while (fgets (buffer, 256, fptr)) { if (*buffer == '#') continue; nb = 0; if ((*buffer == '@') && (*(buffer + 1) == '@')) break; ptr = buffer; while (*ptr) { if (*ptr == '\n') *ptr = '\r'; ++ptr; ++nb; } out (buffer, nb); } } /* Commande D -> DOS ou dump fichiers systeme */ int mbl_dump (void) { int erreur = 0; unsigned masque = 0; switch (pvoie->niv3) { case 0: if (!ISGRAPH (*indd)) { sup_ln (indd); if (*indd) { /* Download */ --indd; pvoie->temp1 = pvoie->niv1; maj_niv (N_DOS, 2, 0); send_file (1); } else { /* DOS */ if (miniserv & 2) { maj_niv (N_DOS, 0, 0); ptmes->date = time (NULL); pvoie->mbl = 0; texte (T_DOS + 8); dos (); } else return (1); } return (0); } if (droits (COSYSOP)) { *indd = toupper (*indd); switch (*indd) { case 'B': masque = F_BBS; break; case 'E': masque = F_EXC; break; case 'F': masque = F_PMS; break; case 'L': masque = F_LOC; break; case 'M': masque = F_MOD; break; case 'P': masque = F_PAG; break; case 'S': masque = F_SYS; break; case 'U': masque = 0xffff; break; case 'X': masque = F_EXP; break; default: erreur = 1; } if (!erreur) { pvoie->temp2 = 0; pvoie->temp3 = masque; pvoie->enrcur = 0L; incindd (); strn_cpy (9, pvoie->appendf, sup_ln (indd)); if (user_dump (masque)) ch_niv3 (1); else retour_mbl (); return (0); } } break; case 1: if (user_dump (pvoie->temp3) == 0) { pvoie->temp3 = 0; retour_mbl (); } return (0); /* varx[0][0] = 'D' ; strn_cpy(79, varx[0] + 1, indd) ; texte(T_ERR + 1) ; retour_mbl() ; */ } return (1); } char *strflags (info * frec) { #define NB_FLAG 11 int i; static char flag[NB_FLAG + 1]; for (i = 0; i < NB_FLAG; i++) flag[i] = '.'; flag[NB_FLAG] = '\0'; if (NEW (frec->flags)) flag[10] = 'I'; if (UNP (frec->flags)) flag[9] = 'U'; if (MOD (frec->flags)) flag[8] = 'M'; if (EXC (frec->flags)) flag[7] = 'E'; if (PMS (frec->flags)) flag[6] = 'F'; if (LOC (frec->flags)) flag[5] = 'L'; if (EXP (frec->flags)) flag[4] = 'X'; if (SYS (frec->flags)) flag[3] = 'S'; if (BBS (frec->flags)) flag[2] = 'B'; if (PAG (frec->flags)) flag[1] = 'P'; if (PRV (frec->flags)) flag[0] = 'R'; return (flag); } void affiche_user (info * frec, int mode) { char s[200]; char *flag = strflags (frec); sprintf (s, "%-6s-%-2d %s/%s %5ld %s %-12s %-12s %-12s", frec->indic.call, frec->indic.num, date_mbl (frec->hcon), heure_mbl (frec->hcon), frec->nbcon, flag, frec->prenom, frec->pass, frec->priv); outln (s, strlen (s)); if (mode) { var_cpy (0, frec->home); var_cpy (1, frec->zip); texte (T_MBL + 55); } } static int user_dump (unsigned masque) { FILE *fptr; info frec; int ind = FALSE; int retour = 0; int match; char w_masque[10]; pvoie->sr_mem = pvoie->seq = FALSE; strcpy (w_masque, pvoie->appendf); match = (int) w_masque[0]; if ((match) && (find (pvoie->appendf))) ind = TRUE; fptr = ouvre_nomenc (); fseek (fptr, pvoie->enrcur, 0); while (fread ((char *) &frec, sizeof (info), 1, fptr)) { if (find (frec.indic.call)) { if ((!ind && !match) || ((match) && (strmatch (frec.indic.call, w_masque)))) { if ((masque == 0xffff) || ((int) frec.flags & masque)) { if (pvoie->temp2 == 0) texte (T_MBL + 11); affiche_user (&frec, ind); pvoie->temp2 = 1; } } } if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 1; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 1; break; } } pvoie->enrcur = ftell (fptr); ferme (fptr, 37); if ((retour == 0) && (pvoie->temp2 == 0)) texte (T_ERR + 19); return (retour); } /* Commande J -> Liste des dernieres connexions */ int mbl_jheard (void) { if (ISGRAPH (*(indd + 1))) return (1); /* erreur */ *indd = toupper (*indd); if (((*indd >= 'A') && (*indd <= 'H')) || ((*indd >= '1') && (*indd <= '8')) || (*indd == 'K')) { j_list (*indd); retour_mbl (); return (0); } return (1); /* erreur */ } int page_connect (char port, FILE * fptr) { #define TBUF 20 long pos, nbc = MAXSTAT; int nblig, nbrec, lg; unsigned char valport; statis buffstat[TBUF]; char valcall[8]; pvoie->lignes = -1; nblig = nbl_page (voiecur); if (nblig > MAXLIGNES) nblig = MAXLIGNES; nblig--; if (nblig < 3) nblig = 3; nbrec = 0; while (--nbc) { if (pvoie->noenr_menu == 0L) return (FALSE); if (nbrec == 0) { pos = pvoie->noenr_menu - (long) (sizeof (statis) * TBUF); if (pos < 0L) pos = 0L; fseek (fptr, pos, 0); nbrec = fread ((char *) buffstat, sizeof (statis), TBUF, fptr); if (nbrec == 0) return (FALSE); } --nbrec; pvoie->noenr_menu -= (long) sizeof (statis); lg = (strlen (pvoie->ch_temp)); if (strmatch (buffstat[nbrec].indcnx, pvoie->ch_temp)) { /* test de la validite du port */ valport = buffstat[nbrec].port + 'A'; if ((!port) || (valport == port)) { n_cpy (6, valcall, buffstat[nbrec].indcnx); sprintf (varx[0], "%c", valport); sprintf (varx[1], "%02d", buffstat[nbrec].voie); sprintf (varx[2], "%4ld", pvoie->noenr_menu / (long) sizeof (statis)); sprintf (varx[3], "%-6s", valcall); sprintf (varx[4], "%2d", buffstat[nbrec].tpscnx / 60); sprintf (varx[5], "%02d", buffstat[nbrec].tpscnx % 60); ptmes->date = buffstat[nbrec].datcnx; texte (T_STA + 23); if (--nblig == 0) break; } } } if (nbc == 0) return (0); return (1); } static int heardcmp (const void *a, const void *b) { long result; result = ((Heard *) a)->last - ((Heard *) b)->last; return ((result > 0L) ? 1 : ((result == 0L) ? 0 : -1)); } void j_list (char type) { FILE *fptr; char buffer[259]; char date[80]; char indic[10]; int i, port; Heard *pheard; if (isdigit (type)) { port = type - '0'; if ((port < 1) || (port >= NBPORT) || (p_port[port].pvalid == 0)) { texte (T_ERR + 14); return; } pheard = p_port[port].heard; qsort (pheard, NBHEARD, sizeof (Heard), heardcmp); for (i = 0; i < NBHEARD; i++) { if (pheard->last) { pheard->indic.call[6] = '\0'; if (pheard->indic.num > 15) pheard->indic.num = 0; sprintf (indic, "%s-%d", pheard->indic.call, pheard->indic.num); strcpy (date, datheure_mbl (pheard->first)); sprintf (buffer, "%-9s %s %s", indic, date, datheure_mbl (pheard->last)); outln (buffer, strlen (buffer)); } ++pheard; } } else { incindd (); tester_masque (); if (type == 'K') port = '\0'; else port = type; if ((port) && ((port < 'A') || (port > 'H') || (p_port[port - 'A' + 1].pvalid == 0))) { texte (T_ERR + 14); return; } fptr = ouvre_stats (); fseek (fptr, 0L, 2); pvoie->noenr_menu = ftell (fptr); page_connect (port, fptr); ferme (fptr, 38); } } fbb-7.04j/src/mblutil.c0100644000175100017510000005457707726646105013044 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MBLUTIL.C * */ #include #include #ifdef TRACE static int fd_trace = -1; open_trace () { fd_trace = open ("TRACE.MON", O_WRONLY | O_APPEND | O_CREAT | O_TEXT, S_IREAD | S_IWRITE); } close_trace () { if (fd_trace != -1) close (fd_trace); } static trace (char *chaine, int lg, int date) { char *ptr = chaine; int i; long temps; struct tm *sdate; char cdate[20]; static char ret = '\n'; if (fd_trace == -1) return; for (i = 0; i < lg; i++) { if (*ptr == '\r') *ptr = '\n'; ++ptr; } write (fd_trace, chaine, lg); if (date) { temps = time (NULL); sdate = localtime (&temps); sprintf (cdate, " (%02d:%02d:%02d)", sdate->tm_hour, sdate->tm_min, sdate->tm_sec); write (fd_trace, cdate, 11); } } #endif void force_deconnexion (int voie, int mode) { df ("force_deconnexion", 2); if ((p_port[no_port (voie)].typort == TYP_HST) && (P_TOR (voie))) { /* WinDebug("Immediate disconnect request\r\n"); */ tnc_commande (voie, "!DD", SNDCMD); dec_voie (voie); } else { deconnexion (voie, mode); deconnexion (voie, mode); } ff (); } void debug_mode (void) { if (debug_on) { if (!debug_fptr) debug_fptr = fopen ("DEBUG.BUG", "at"); } else { if (debug_fptr) fclose (debug_fptr); debug_fptr = NULL; } } int virt_canal (int nocan) { int canal; if (nocan > 1) canal = nocan - 1; else if (nocan == 1) canal = 99; else canal = 0; return (canal); } void aff_chaine (int color, int xpos, int ypos, char *chaine) { #ifdef __FBBDOS__ struct text_info sav_fen; df ("aff_chaine", 5); deb_io (); gettext_info (&sav_fen); fen_haut (color); curoff (); gotoxy (xpos, ypos); cputs (chaine); puttext_info (&sav_fen); fin_io (); ff (); #endif } int nbport (void) { int nbp = 0, port; df ("nbport", 0); for (port = 1; port < NBPORT; port++) if (p_port[port].pvalid) nbp++; ff (); return (nbp); } int read_only (void) { if (pvoie->read_only) { outln ("*** Error : read-only mode", 26); /* texte(T_ERR + 0); */ return (1); } return (0); } char *lf_to_cr (char *texte) { char *ptr = texte; char *optr = texte; while (*ptr) { if ((*ptr == '\r') && (*(ptr + 1) == '\n')) { ++ptr; } else { if (*ptr == '\n') *optr++ = '\r'; else *optr++ = *ptr; ++ptr; } } *optr = '\0'; return (texte); } void while_space (void) { while (isspace (*indd)) ++indd; } int strmatch (char *chaine, char *masque) { while (1) { switch (*masque) { case '\0': return (toupper (*masque) == toupper (*chaine)); case '&': if ((*chaine == '\0') || (*chaine == '.')) return (1); break; case '?': if (!isalnum (*chaine)) return (0); break; case '#': if ((*chaine != '#') && (!isdigit (*chaine))) return (0); break; case '@': if (!isalpha (*chaine)) return (0); break; case '=': if (!ISGRAPH (*chaine)) return (0); break; case '*': while (*++masque == '*') ; if (*masque == '\0') return (1); while (!strmatch (chaine, masque)) if (*++chaine == '\0') return (0); break; default: if ((toupper (*chaine)) != (toupper (*masque))) return (0); break; } ++chaine; ++masque; } } void ch_niv3 (int niveau) { maj_niv (pvoie->niv1, pvoie->niv2, niveau); } void ch_niv2 (int niveau) { maj_niv (pvoie->niv1, niveau, 0); } void ch_niv1 (int niveau) { maj_niv (niveau, 0, 0); } int droits (unsigned int droit) { if (voiecur == CONSOLE) return (1); return (droit & pvoie->droits); } void ch_bit (ind_noeud * noeud, info * frec, unsigned bit, char rep) { FILE *fptr; int c = toupper (rep); if ((c != Oui) && (c != Non) && (c != '\0')) return; if (pvoie->read_only) return; fptr = ouvre_nomenc (); fseek (fptr, (long) noeud->coord * sizeof (info), 0); fread (frec, sizeof (info), 1, fptr); rep = toupper (rep); if (c == Oui) { frec->flags |= bit; } else if (c == Non) { frec->flags &= (~bit); } else if (c == '\0') { if (frec->flags & bit) { frec->flags &= (~bit); } else { frec->flags |= bit; } } if (noeud->coord == 0xffff) dump_core (); fseek (fptr, (long) noeud->coord * sizeof (info), 0); fwrite (frec, sizeof (info), 1, fptr); ferme (fptr, 42); noeud->val = (uchar) (EXC (frec->flags) == 0); } void cmd_err (char *ptri) { int i = 0; char *ptr = varx[0]; while (ISGRAPH (*ptri)) { if (++i == 40) break; else *ptr++ = *ptri++; } *ptr = '\0'; texte (T_ERR + 1); *varx[0] = '\0'; if ((FOR (pvoie->mode)) || (++pvoie->nb_err == MAX_ERR)) pvoie->deconnect = 6; else retour_menu (pvoie->niv1); } void strn_cpy (int longueur, char *dest, char *orig) { while (longueur--) { if (!ISPRINT (*orig)) break; *dest++ = toupper (*orig); ++orig; } *dest = '\0'; } void n_cpy (int longueur, char *dest, char *orig) { while (longueur--) { if (*orig == '\0') break; *dest++ = *orig++; } *dest = '\0'; } void init_recliste (int voie) { tlist *ptlist = &svoie[voie]->recliste; ptlist->l = FALSE; ptlist->type = '\0'; ptlist->status = '\0'; ptlist->route = '\0'; *ptlist->exp = '\0'; *ptlist->dest = '\0'; *ptlist->bbs = '\0'; *ptlist->find = '\0'; ptlist->debut = 0L; ptlist->fin = 0x7fffffffL; ptlist->avant = 0L; ptlist->apres = 0x7fffffffL; ptlist->last = 0x7fffffffL; if (*svoie[voie]->finf.filtre) strn_cpy (6, ptlist->dest, svoie[voie]->finf.filtre); } int droit_ok (bullist * lbul, int mode) { /* * mode 1 : consultation (lecture) * mode 2 : suppression (ecriture) * mode 3 : archivage * mode 4 : idem mode 2 mais autorise tuer le message "Non lu" */ int kill_new = 0; if (mode == 4) { mode = 2; kill_new = 1; } if (mode == 3) { if (lbul->status == 'A') return (0); else return (1); } if (lbul->status == 'K') { if (mode == 2) return (0); } if (droits (SUPMES)) return (1); if ((mode == 1) && (droits (CONSMES) || PRV (pvoie->finf.flags))) if ((strcmp (lbul->desti, "KILL") != 0) && (lbul->status != 'H')) return (1); if (lbul->status == 'H') { if ((SYS (pvoie->finf.flags)) || indcmp (lbul->exped, pvoie->sta.indicatif.call)) return (1); else return (0); } if (strcmp (lbul->desti, "WP") == 0) return (0); switch (lbul->type) { case 'A': case 'P': switch (mode) { case 2: if (indcmp (lbul->desti, pvoie->sta.indicatif.call)) { if ((kill_new) || (lbul->status != 'N')) { return (1); } } if (indcmp (lbul->exped, pvoie->sta.indicatif.call)) return (1); break; case 1: if ((indcmp (lbul->desti, pvoie->sta.indicatif.call)) || (indcmp (lbul->exped, pvoie->sta.indicatif.call))) return (1); break; } break; case ' ': case 'B': if (mode == 2) { if ((indcmp (lbul->exped, pvoie->sta.indicatif.call)) || (indcmp (lbul->desti, pvoie->sta.indicatif.call))) return (1); } else if (lbul->status == 'A') return (0); else if (strcmp (lbul->desti, "KILL") != 0) return (1); break; case 'T': if (lbul->status == 'A') return (0); else return (1); default: return (0); } return (0); } void retour_mbl (void) { libere_tread (voiecur); libere_tlist (voiecur); pvoie->mbl = 1; pvoie->private_dir = 0; set_bs (voiecur, TRUE); retour_menu (N_MBL); } int teste_rep (char *chaine) { if (iscntrl (*chaine)) return (0); if (*chaine == ' ') return (1); else { texte (T_ERR + 2); return (0); } } long lit_chiffre (int ajuste) { long chif; char *ptr; if (*indd == '\0') return (0L); teste_espace (); if (isdigit (*indd)) { ptr = indd; while ((*indd) && (isdigit (*indd))) ++indd; chif = atol (ptr); if ((ajuste) && (chif < ECART)) chif += (1000L * (long) pvoie->finf.on_base); return (chif); } else if (*indd) { if (*indd == '#') { ++indd; return (ptmes->numero); } else texte (T_ERR + 3); } return (0L); } int is_espace (char *ptr) { int espace = (*ptr == ' '); while ((*ptr) && (*ptr == ' ')) ++ptr; if (ISPRINT (*ptr)) return (espace); else return (1); } int teste_espace (void) { int ok = 0; if (*indd) { if (*indd == ' ') ok = 1; while ((*indd) && (!ISGRAPH (*indd))) ++indd; } return (ok); } long supp_header (FILE * fptr, int ok) { int c, first = 1, nb = 0, call = 0; char ligne[90]; char *ptr = ligne; int flag = FALSE; long record = 0L; short int postexte = 0; record = ftell (fptr); while ((c = fgetc (fptr)) != EOF) { if ((flag) && (c == '\n')) { record = ftell (fptr); postexte = 0; call = 0; flag = FALSE; } else { switch (call) { case 0: break; case 1: if (isalnum (c)) { *ptr++ = c; nb++; call = 2; } break; case 2: if (isalnum (c)) { *ptr++ = c; nb++; } else { *ptr++ = '!'; nb++; call = 0; if (nb >= 65) { outln (ligne, nb); nb = 0; ptr = ligne; first = 2; } } break; } if (postexte == 0) { if (c != 'R') /*return(record) */ break; else flag = TRUE; } if ((postexte == 1) && (flag) && (c != ':')) /*return(record) */ break; ++postexte; } if ((ok) && (flag) && (c == '@')) { if (first) { if (first == 1) out ("Path: !", 7); else out (" !", 7); first = 0; } call = 1; } } if (nb) outln (ligne, nb); /* return(ftell(fptr)) ; */ return (record); } bullist *ch_record (bullist * list, long no, char status) { mess_noeud *lptr; static bullist ltemp; bullist *lbul; ind_noeud *noeud; char temp = '\0'; int ok = 0; int kill_new = 0; int no_type = 0; if (status == 'Z') { no_type = 1; status = 'A'; } if (status & 0x80) { kill_new = 1; status &= 0x7f; } if (list) lbul = list; else lbul = <emp; lbul->numero = no; if ((lptr = findmess (no)) != NULL) { ouvre_dir (); read_dir (lptr->noenr, lbul); if (lbul->type) { if (status == 'Y') { ++lbul->nblu; temp = lbul->status; } if ((status) && (status != lbul->status)) { switch (status) { case 'Y': if ((lbul->status == 'N') || (lbul->status == '$')) { if ((lbul->type == 'P') || (lbul->type == 'A')) { if (indcmp (pvoie->sta.indicatif.call, lbul->desti)) { noeud = cher_noeud (lbul->desti); --(pvoie->ncur->nbnew); } else break; } else { if ((lbul->status == '$') || (indcmp (pvoie->sta.indicatif.call, lbul->exped))) break; } temp = lbul->status; lbul->status = status; } break; case 'F': if (lbul->status == 'K') break; if (lbul->status == 'X') break; if (lbul->status == 'A') break; noeud = cher_noeud (lbul->desti); if (lbul->status == 'N') --(noeud->nbnew); if ((lbul->type == 'P') && (lbul->status == '$')) --(noeud->nbnew); chg_mess (0xffff, no); temp = lbul->status; lbul->status = status; break; case 'A': lbul->datech = 0L; case 'K': if ((!kill_new) && (lbul->datech)) { if (!droit_ok (lbul, 2)) break; else if (!droit_ok (lbul, 3)) break; } noeud = cher_noeud (lbul->desti); if ((!kill_new) && (!droits (SUPMES))) { if ((indcmp (pvoie->sta.indicatif.call, lbul->desti))) { if (lbul->status == 'N') break; } } if (lbul->status == 'N') { if (noeud->nbnew > 0) --(noeud->nbnew); } /* if (lbul->status == 'H') { --nb_hold; } */ if ((lbul->status != 'K') && (lbul->status != 'A')) { if (noeud->nbmess > 0) --(noeud->nbmess); chg_mess (0xffff, no); } temp = lbul->status; lbul->status = status; break; case 'H': if (!droit_ok (lbul, 2)) break; noeud = cher_noeud (lbul->desti); if (((lbul->status != 'N') || (lbul->type != 'P')) && ((lbul->status != '$') || (lbul->type != 'B'))) break; if (lbul->status == 'N') { --(noeud->nbnew); } if ((lbul->status != 'K') && (lbul->status != 'A')) { --(noeud->nbmess); /* chg_mess(0xffff, no); */ } temp = lbul->status; lbul->status = status; break; } } if (temp) { if (lbul->datech) lbul->datech = time (NULL); if (no_type) lbul->type = '\0'; write_dir (lptr->noenr, lbul); lbul->status = temp; aff_msg_cons (); } ok = 1; } ferme_dir (); } *ptmes = *lbul; if (ok) return (lbul); else return (NULL); } int entete_liste (void) { return (texte (T_MBL + 36)); } int indcmp (char *ind1, char *ind2) { char *ptr1 = ind1; char *ptr2 = ind2; if (*ptr1 != *ptr2) return (FALSE); ++ptr1; ++ptr2; if ((!isalnum (*ptr1)) && (!isalnum (*ptr2))) return (TRUE); if (*ptr1++ != *ptr2++) return (FALSE); while ((isalnum (*ptr1)) || (isalnum (*ptr2))) { if (*ptr1++ != *ptr2++) return (FALSE); } return (TRUE); } /* * teste si ind2 est compris dans ind1 * en tenant compte des champs de hierarchie * */ int hiecmp (char *ind1, char *ind2) { char str[80]; char *ptr; strcpy (str, ind1); for (;;) { if (strcmpi (str, ind2) == 0) return (TRUE); ptr = strrchr (str, '.'); if (ptr == NULL) break; *ptr = '\0'; } return (FALSE); } char *sup_ln (char *buf) { int nb = strlen (buf); if (nb > 0) { while (nb--) { if (ISGRAPH (buf[nb])) break; if (buf[nb]) buf[nb] = '\0'; } } return (buf); } char *ch_slash (char *chaine) { char *ptr = chaine; while (*ptr) { if (*ptr == '/') *ptr = '\\'; ++ptr; } return (chaine); } char *tot_path (char *nom_fic, char *source) { int lg; char vdisk; static char temp[256]; *temp = '\0'; /* char *ptr; ptr = nom_fic; while (*ptr) { if (islower (*ptr)) *ptr = toupper (*ptr); ++ptr; } */ vdisk = pvoie->vdisk; if (nom_fic[1] == ':') { if (((voiecur == CONSOLE) || (pvoie->kiss == -2)) && (!pvoie->cmd_new)) { vdisk = nom_fic[0] - 'A'; } else { vdisk = nom_fic[0] - 'A'; if (vdisk == 15) vdisk = 8; if (vdisk > 8) vdisk = 0; if ((vdisk < 8) && (*PATH[(int)vdisk] == '\0')) vdisk = 0; } nom_fic += 2; } if ((pvoie->kiss == -2) || ((droits (ACCESDOS)) && (pvoie->temp1 != N_YAPP) && (!pvoie->cmd_new))) { sprintf (temp, "%c:", vdisk + 'A'); if (*nom_fic != '\\') strcat (temp, source); } else { if (pvoie->temp1 == N_YAPP) { strcpy (temp, YAPPDIR); } else { if (vdisk == 8) { if (pvoie->finf.priv[1] != ':') sprintf (temp, "%c:%s", 'A' + getdisk (), pvoie->finf.priv); else strcpy (temp, pvoie->finf.priv); } else strcpy (temp, PATH[(int)vdisk]); } if (((lg = strlen (temp)) > 1) && (temp[lg - 1] == '\\')) temp[lg - 1] = '\0'; if (((lg = strlen (temp)) > 1) && (temp[lg - 1] == '/')) temp[lg - 1] = '\0'; if (*nom_fic != '\\') strcat (temp, source); } strcat (temp, nom_fic); strcpy(temp, long_filename(NULL, temp)); vir_path (temp); return temp; } void tester_masque (void) { char *t = pvoie->ch_temp; int cpt = 0; if (*indd == '\0') *t++ = '*'; else { while (isalnum (*indd)) { if (cpt++ < 7) { *t++ = toupper (*indd); ++indd; } else break; } } *t = '\0'; } char *comp_bid (char *bid) { static char out_bid[BIDCOMP]; char in_bid[BIDLEN]; char *ibid, *obid; int i, fin = 0; for (i = 0; i < BIDLEN; i++) { if ((!fin) && (*bid)) { in_bid[i] = (*bid - 32) & 0x3f; } else { fin = 1; in_bid[i] = '\0'; } ++bid; } ibid = in_bid; obid = out_bid; for (i = 0; i < BIDCOMP; i += 3) { obid[0] = (ibid[0] << 2) + (ibid[1] >> 4); obid[1] = (ibid[1] << 4) + (ibid[2] >> 2); obid[2] = (ibid[2] << 6) + (ibid[3]); ibid += 4; obid += 3; } return (out_bid); } void var_cpy (int novar, char *texte) { if ((novar >= 0) && (novar < 10)) n_cpy (80, varx[novar], texte); } void fbb_log (int voie, char event, char *texte) { if (svoie[voie]->log) port_log (voie, 1, event, texte); } void port_log (int voie, int val, char event, char *texte) { int lvoie; struct tm *sdate; char *ptr; long temps = time (NULL); char com[256], buf[80]; if (comlog) { lvoie = (val) ? voie : 0; sdate = localtime (&temps); n_cpy (66, buf, sup_ln (texte)); ptr = buf; while (*ptr) { /* Supression des caracteres de controle */ if (iscntrl (*ptr)) *ptr = '_'; ++ptr; } sprintf (com, "%02d%02d%02d%02d%02d%02d%c%s\r\n", sdate->tm_mon + 1, sdate->tm_mday, sdate->tm_hour, sdate->tm_min, sdate->tm_sec, lvoie, event, buf); if (log_ptr == NULL) ouvre_log (); if (log_ptr) fputs (com, log_ptr); } } /* Table de conversion engendre mcaniquement par Free recode 3.5 pour squence IBM850..ISO-8859-1 (rversible). */ unsigned char const IBM850_ISO_8859_1[256] = { 0, 1, 2, 3, 4, 5, 6, 7, /* 0 - 7 */ 8, 9, 10, 11, 12, 13, 14, 15, /* 8 - 15 */ 16, 17, 18, 19, 20, 21, 22, 23, /* 16 - 23 */ 24, 25, 26, 27, 28, 29, 30, 31, /* 24 - 31 */ 32, 33, 34, 35, 36, 37, 38, 39, /* 32 - 39 */ 40, 41, 42, 43, 44, 45, 46, 47, /* 40 - 47 */ 48, 49, 50, 51, 52, 53, 54, 55, /* 48 - 55 */ 56, 57, 58, 59, 60, 61, 62, 63, /* 56 - 63 */ 64, 65, 66, 67, 68, 69, 70, 71, /* 64 - 71 */ 72, 73, 74, 75, 76, 77, 78, 79, /* 72 - 79 */ 80, 81, 82, 83, 84, 85, 86, 87, /* 80 - 87 */ 88, 89, 90, 91, 92, 93, 94, 95, /* 88 - 95 */ 96, 97, 98, 99, 100, 101, 102, 103, /* 96 - 103 */ 104, 105, 106, 107, 108, 109, 110, 111, /* 104 - 111 */ 112, 113, 114, 115, 116, 117, 118, 119, /* 112 - 119 */ 120, 121, 122, 123, 124, 125, 126, 127, /* 120 - 127 */ 199, 252, 233, 226, 228, 224, 229, 231, /* 128 - 135 */ 234, 235, 232, 239, 238, 236, 196, 197, /* 136 - 143 */ 201, 230, 198, 244, 246, 242, 251, 249, /* 144 - 151 */ 255, 214, 220, 248, 163, 216, 215, 159, /* 152 - 159 */ 225, 237, 243, 250, 241, 209, 170, 186, /* 160 - 167 */ 191, 174, 172, 189, 188, 161, 171, 187, /* 168 - 175 */ 155, 157, 141, 129, 139, 193, 194, 192, /* 176 - 183 */ 169, 150, 132, 140, 148, 162, 165, 151, /* 184 - 191 */ 156, 145, 147, 128, 142, 143, 227, 195, /* 192 - 199 */ 131, 144, 146, 133, 138, 153, 158, 164, /* 200 - 207 */ 240, 208, 202, 203, 200, 134, 205, 206, /* 208 - 215 */ 207, 137, 130, 136, 154, 166, 204, 152, /* 216 - 223 */ 211, 223, 212, 210, 245, 213, 181, 254, /* 224 - 231 */ 222, 218, 219, 217, 253, 221, 175, 180, /* 232 - 239 */ 173, 177, 149, 190, 182, 167, 247, 184, /* 240 - 247 */ 176, 168, 183, 185, 179, 178, 135, 160, /* 248 - 255 */ }; /* Conversion table generated mechanically by Free `recode' 3.5 for sequence ISO-8859-1..IBM850 (reversible). */ unsigned char const ISO_8859_1_IBM850[256] = { 0, 1, 2, 3, 4, 5, 6, 7, /* 0 - 7 */ 8, 9, 10, 11, 12, 13, 14, 15, /* 8 - 15 */ 16, 17, 18, 19, 20, 21, 22, 23, /* 16 - 23 */ 24, 25, 26, 27, 28, 29, 30, 31, /* 24 - 31 */ 32, 33, 34, 35, 36, 37, 38, 39, /* 32 - 39 */ 40, 41, 42, 43, 44, 45, 46, 47, /* 40 - 47 */ 48, 49, 50, 51, 52, 53, 54, 55, /* 48 - 55 */ 56, 57, 58, 59, 60, 61, 62, 63, /* 56 - 63 */ 64, 65, 66, 67, 68, 69, 70, 71, /* 64 - 71 */ 72, 73, 74, 75, 76, 77, 78, 79, /* 72 - 79 */ 80, 81, 82, 83, 84, 85, 86, 87, /* 80 - 87 */ 88, 89, 90, 91, 92, 93, 94, 95, /* 88 - 95 */ 96, 97, 98, 99, 100, 101, 102, 103, /* 96 - 103 */ 104, 105, 106, 107, 108, 109, 110, 111, /* 104 - 111 */ 112, 113, 114, 115, 116, 117, 118, 119, /* 112 - 119 */ 120, 121, 122, 123, 124, 125, 126, 127, /* 120 - 127 */ 195, 179, 218, 200, 186, 203, 213, 254, /* 128 - 135 */ 219, 217, 204, 180, 187, 178, 196, 197, /* 136 - 143 */ 201, 193, 202, 194, 188, 242, 185, 191, /* 144 - 151 */ 223, 205, 220, 176, 192, 177, 206, 159, /* 152 - 159 */ 255, 173, 189, 156, 207, 190, 221, 245, /* 160 - 167 */ 249, 184, 166, 174, 170, 240, 169, 238, /* 168 - 175 */ 248, 241, 253, 252, 239, 230, 244, 250, /* 176 - 183 */ 247, 251, 167, 175, 172, 171, 243, 168, /* 184 - 191 */ 183, 181, 182, 199, 142, 143, 146, 128, /* 192 - 199 */ 212, 144, 210, 211, 222, 214, 215, 216, /* 200 - 207 */ 209, 165, 227, 224, 226, 229, 153, 158, /* 208 - 215 */ 157, 235, 233, 234, 154, 237, 232, 225, /* 216 - 223 */ 133, 160, 131, 198, 132, 134, 145, 135, /* 224 - 231 */ 138, 130, 136, 137, 141, 161, 140, 139, /* 232 - 239 */ 208, 164, 149, 162, 147, 228, 148, 246, /* 240 - 247 */ 155, 151, 163, 150, 129, 236, 231, 152, /* 248 - 255 */ }; unsigned char *ansi_to_ibm(unsigned char *buffer, int len) { unsigned char *ptr = buffer; while (len--) { *ptr = ISO_8859_1_IBM850[*ptr]; ++ptr; } return buffer; } unsigned char *ibm_to_ansi(unsigned char *buffer, int len) { unsigned char *ptr = buffer; while (len--) { *ptr = IBM850_ISO_8859_1[*ptr]; ++ptr; } return buffer; } #undef fopen #undef fclose #undef fprintf /* void debuglog(char *fmt,...) { time_t temps = time(NULL); va_list argptr; FILE *fptr = fopen("/tmp/debug.log", "a+"); if (!fptr) return; fprintf (fptr, "\n%s", asctime (localtime (&temps))); va_start (argptr, fmt); vfprintf (fptr, fmt, argptr); va_end (argptr); fclose(fptr); } */ fbb-7.04j/src/md5c.c0100644000175100017510000002616507726646105012214 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ #include "global.h" #include "md5.h" /* Constants for MD5Transform routine. */ #define S11 7 #define S12 12 #define S13 17 #define S14 22 #define S21 5 #define S22 9 #define S23 14 #define S24 20 #define S31 4 #define S32 11 #define S33 16 #define S34 23 #define S41 6 #define S42 10 #define S43 15 #define S44 21 static void MD5Transform PROTO_LIST ((UINT4[4], unsigned char[64])); static void Encode PROTO_LIST ((unsigned char *, UINT4 *, unsigned int)); static void Decode PROTO_LIST ((UINT4 *, unsigned char *, unsigned int)); static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int)); static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int)); static unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* F, G, H and I are basic MD5 functions. */ #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) #define H(x, y, z) ((x) ^ (y) ^ (z)) #define I(x, y, z) ((y) ^ ((x) | (~z))) /* ROTATE_LEFT rotates x left n bits. */ #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. Rotation is separate from addition to prevent recomputation. */ #define FF(a, b, c, d, x, s, ac) { \ (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define GG(a, b, c, d, x, s, ac) { \ (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define HH(a, b, c, d, x, s, ac) { \ (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define II(a, b, c, d, x, s, ac) { \ (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } /* MD5 initialization. Begins an MD5 operation, writing a new context. */ void MD5Init (context) MD5_CTX *context; /* context */ { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ context->state[0] = 0x67452301L; context->state[1] = 0xefcdab89L; context->state[2] = 0x98badcfeL; context->state[3] = 0x10325476L; } /* MD5 block update operation. Continues an MD5 message-digest operation, processing another message block, and updating the context. */ void MD5Update (context, input, inputLen) MD5_CTX *context; /* context */ unsigned char *input; /* input block */ unsigned int inputLen; /* length of input block */ { unsigned int i, index, partLen; /* Compute number of bytes mod 64 */ index = (unsigned int) ((context->count[0] >> 3) & 0x3F); /* Update number of bits */ if ((context->count[0] += ((UINT4) inputLen << 3)) < ((UINT4) inputLen << 3)) context->count[1]++; context->count[1] += ((UINT4) inputLen >> 29); partLen = 64 - index; /* Transform as many times as possible. */ if (inputLen >= partLen) { MD5_memcpy ((POINTER) & context->buffer[index], (POINTER) input, partLen); MD5Transform (context->state, context->buffer); for (i = partLen; i + 63 < inputLen; i += 64) MD5Transform (context->state, &input[i]); index = 0; } else i = 0; /* Buffer remaining input */ MD5_memcpy ((POINTER) & context->buffer[index], (POINTER) & input[i], inputLen - i); } /* MD5 finalization. Ends an MD5 message-digest operation, writing the the message digest and zeroizing the context. */ void MD5Final (digest, context) unsigned char digest[16]; /* message digest */ MD5_CTX *context; /* context */ { unsigned char bits[8]; unsigned int index, padLen; /* Save number of bits */ Encode (bits, context->count, 8); /* Pad out to 56 mod 64. */ index = (unsigned int) ((context->count[0] >> 3) & 0x3f); padLen = (index < 56) ? (56 - index) : (120 - index); MD5Update (context, PADDING, padLen); /* Append length (before padding) */ MD5Update (context, bits, 8); /* Store state in digest */ Encode (digest, context->state, 16); /* Zeroize sensitive information. */ MD5_memset ((POINTER) context, 0, sizeof (*context)); } /* MD5 basic transformation. Transforms state based on block. */ static void MD5Transform (state, block) UINT4 state[4]; unsigned char block[64]; { UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode (x, block, 64); /* Round 1 */ FF (a, b, c, d, x[0], S11, 0xd76aa478L); /* 1 */ FF (d, a, b, c, x[1], S12, 0xe8c7b756L); /* 2 */ FF (c, d, a, b, x[2], S13, 0x242070dbL); /* 3 */ FF (b, c, d, a, x[3], S14, 0xc1bdceeeL); /* 4 */ FF (a, b, c, d, x[4], S11, 0xf57c0fafL); /* 5 */ FF (d, a, b, c, x[5], S12, 0x4787c62aL); /* 6 */ FF (c, d, a, b, x[6], S13, 0xa8304613L); /* 7 */ FF (b, c, d, a, x[7], S14, 0xfd469501L); /* 8 */ FF (a, b, c, d, x[8], S11, 0x698098d8L); /* 9 */ FF (d, a, b, c, x[9], S12, 0x8b44f7afL); /* 10 */ FF (c, d, a, b, x[10], S13, 0xffff5bb1L); /* 11 */ FF (b, c, d, a, x[11], S14, 0x895cd7beL); /* 12 */ FF (a, b, c, d, x[12], S11, 0x6b901122L); /* 13 */ FF (d, a, b, c, x[13], S12, 0xfd987193L); /* 14 */ FF (c, d, a, b, x[14], S13, 0xa679438eL); /* 15 */ FF (b, c, d, a, x[15], S14, 0x49b40821L); /* 16 */ /* Round 2 */ GG (a, b, c, d, x[1], S21, 0xf61e2562L); /* 17 */ GG (d, a, b, c, x[6], S22, 0xc040b340L); /* 18 */ GG (c, d, a, b, x[11], S23, 0x265e5a51L); /* 19 */ GG (b, c, d, a, x[0], S24, 0xe9b6c7aaL); /* 20 */ GG (a, b, c, d, x[5], S21, 0xd62f105dL); /* 21 */ GG (d, a, b, c, x[10], S22, 0x2441453L); /* 22 */ GG (c, d, a, b, x[15], S23, 0xd8a1e681L); /* 23 */ GG (b, c, d, a, x[4], S24, 0xe7d3fbc8L); /* 24 */ GG (a, b, c, d, x[9], S21, 0x21e1cde6L); /* 25 */ GG (d, a, b, c, x[14], S22, 0xc33707d6L); /* 26 */ GG (c, d, a, b, x[3], S23, 0xf4d50d87L); /* 27 */ GG (b, c, d, a, x[8], S24, 0x455a14edL); /* 28 */ GG (a, b, c, d, x[13], S21, 0xa9e3e905L); /* 29 */ GG (d, a, b, c, x[2], S22, 0xfcefa3f8L); /* 30 */ GG (c, d, a, b, x[7], S23, 0x676f02d9L); /* 31 */ GG (b, c, d, a, x[12], S24, 0x8d2a4c8aL); /* 32 */ /* Round 3 */ HH (a, b, c, d, x[5], S31, 0xfffa3942L); /* 33 */ HH (d, a, b, c, x[8], S32, 0x8771f681L); /* 34 */ HH (c, d, a, b, x[11], S33, 0x6d9d6122L); /* 35 */ HH (b, c, d, a, x[14], S34, 0xfde5380cL); /* 36 */ HH (a, b, c, d, x[1], S31, 0xa4beea44L); /* 37 */ HH (d, a, b, c, x[4], S32, 0x4bdecfa9L); /* 38 */ HH (c, d, a, b, x[7], S33, 0xf6bb4b60L); /* 39 */ HH (b, c, d, a, x[10], S34, 0xbebfbc70L); /* 40 */ HH (a, b, c, d, x[13], S31, 0x289b7ec6L); /* 41 */ HH (d, a, b, c, x[0], S32, 0xeaa127faL); /* 42 */ HH (c, d, a, b, x[3], S33, 0xd4ef3085L); /* 43 */ HH (b, c, d, a, x[6], S34, 0x4881d05L); /* 44 */ HH (a, b, c, d, x[9], S31, 0xd9d4d039L); /* 45 */ HH (d, a, b, c, x[12], S32, 0xe6db99e5L); /* 46 */ HH (c, d, a, b, x[15], S33, 0x1fa27cf8L); /* 47 */ HH (b, c, d, a, x[2], S34, 0xc4ac5665L); /* 48 */ /* Round 4 */ II (a, b, c, d, x[0], S41, 0xf4292244L); /* 49 */ II (d, a, b, c, x[7], S42, 0x432aff97L); /* 50 */ II (c, d, a, b, x[14], S43, 0xab9423a7L); /* 51 */ II (b, c, d, a, x[5], S44, 0xfc93a039L); /* 52 */ II (a, b, c, d, x[12], S41, 0x655b59c3L); /* 53 */ II (d, a, b, c, x[3], S42, 0x8f0ccc92L); /* 54 */ II (c, d, a, b, x[10], S43, 0xffeff47dL); /* 55 */ II (b, c, d, a, x[1], S44, 0x85845dd1L); /* 56 */ II (a, b, c, d, x[8], S41, 0x6fa87e4fL); /* 57 */ II (d, a, b, c, x[15], S42, 0xfe2ce6e0L); /* 58 */ II (c, d, a, b, x[6], S43, 0xa3014314L); /* 59 */ II (b, c, d, a, x[13], S44, 0x4e0811a1L); /* 60 */ II (a, b, c, d, x[4], S41, 0xf7537e82L); /* 61 */ II (d, a, b, c, x[11], S42, 0xbd3af235L); /* 62 */ II (c, d, a, b, x[2], S43, 0x2ad7d2bbL); /* 63 */ II (b, c, d, a, x[9], S44, 0xeb86d391L); /* 64 */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; /* Zeroize sensitive information. */ MD5_memset ((POINTER) x, 0, sizeof (x)); } /* Encodes input (UINT4) into output (unsigned char). Assumes len is a multiple of 4. */ static void Encode (output, input, len) unsigned char *output; UINT4 *input; unsigned int len; { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) { output[j] = (unsigned char) (input[i] & 0xff); output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff); output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff); output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff); } } /* Decodes input (unsigned char) into output (UINT4). Assumes len is a multiple of 4. */ static void Decode (output, input, len) UINT4 *output; unsigned char *input; unsigned int len; { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) output[i] = ((UINT4) input[j]) | (((UINT4) input[j + 1]) << 8) | (((UINT4) input[j + 2]) << 16) | (((UINT4) input[j + 3]) << 24); } /* Note: Replace "for loop" with standard memcpy if possible. */ static void MD5_memcpy (output, input, len) POINTER output; POINTER input; unsigned int len; { unsigned int i; for (i = 0; i < len; i++) output[i] = input[i]; } /* Note: Replace "for loop" with standard memset if possible. */ static void MD5_memset (output, value, len) POINTER output; int value; unsigned int len; { unsigned int i; for (i = 0; i < len; i++) ((char *) output)[i] = (char) value; } fbb-7.04j/src/modem.c0100644000175100017510000005067407726646105012467 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE MODEM */ #include #include #ifdef __LINUX__ #include #include #include #include #include #endif static int ok_pass_modem (void); static void init_md (void) { buf_md.ptr_r = buf_md.ptr_l = buf_md.ptr_a = 0; buf_md.buf_vide = 1; buf_md.nblig = 0; buf_md.nbcar = 0; buf_md.flush = 0; } int md_send (int port, char *chaine) { int ctrl = 0; char c; df ("md_send", 2); while ((c = *chaine++) != 0) { switch (c) { case '~': deb_io (); #if defined(__WINDOWS__) || defined(__LINUX__) WinMSleep (500); #endif #ifdef __FBBDOS__ tempo = 10; /* #pragma warn -eff */ while (tempo); /* #pragma warn .eff */ #endif fin_io (); break; case '^': ctrl = 1; break; default: if (ctrl) { c -= '@'; ctrl = 0; } #ifdef __FBBDOS__ { RSEGS rsegs; BufReel[0] = c; memset (&rsegs, 0, sizeof (RSEGS)); rsegs.CX = 1; rsegs.DX = (int) p_port[port].ccom - 1; rsegs.DI = 0; rsegs.ES = BufSeg; rsegs.DS = BufSeg; while (rsegs.CX) { rsegs.AX = 0x0a00; int14real (&rsegs); } } #else send_tnc (port, c); #endif break; } ff (); } return (1); } static void md_etoiles (int voie) { int port = no_port (voie); #ifdef __LINUX__ struct termios tty; defcom *ptrcom = &p_com[(int)p_port[port].ccom]; tcgetattr (ptrcom->comfd, &tty); tty.c_lflag &= ~ECHO; tty.c_lflag |= ECHONL; tcsetattr (ptrcom->comfd, TCSANOW, &tty); #endif #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) { defcom *ptrcom = &p_com[p_port[port].ccom]; #ifdef __WIN32__ int val = 2; sta_drv (voie, ECHOCMD, (void *) &val); #else if (EscapeCommFunction (ptrcom->comfd, SETSTAR) < 0) ShowError ("Driver error", "Unknown command :", SETSTAR); #endif } #endif #ifdef __FBBDOS__ { RSEGS rsegs; memset (&rsegs, 0, sizeof (RSEGS)); rsegs.DX = (int) p_port[port].ccom - 1; rsegs.AX = 0x0c01; int14real (&rsegs); } #endif } void md_echo (int voie) { #ifdef __LINUX__ int port = no_port (voie); struct termios tty; defcom *ptrcom = &p_com[(int)p_port[port].ccom]; tcgetattr (ptrcom->comfd, &tty); tty.c_lflag |= ECHO; tcsetattr (ptrcom->comfd, TCSANOW, &tty); #endif } void md_no_echo (int voie) { modem_no_echo (no_port (voie)); } void modem_no_echo (int port) { #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) { defcom *ptrcom = &p_com[p_port[port].ccom]; #ifdef __WIN32__ int val = 0; sta_drv (port, ECHOCMD, (void *) &val); #else if (EscapeCommFunction (ptrcom->comfd, CLRECHO) < 0) ShowError ("Driver error", "Unknown command :", CLRECHO); #endif } #endif #ifdef __FBBDOS__ { RSEGS rsegs; memset (&rsegs, 0, sizeof (RSEGS)); rsegs.DX = (int) p_port[port].ccom - 1; rsegs.AX = 0x0c02; int14real (&rsegs); } #endif } void init_modem (int port) { #ifdef __LINUX__ if (BIOS (port) == P_LINUX) { struct termios tty; int comfd; initcom_linux (p_port[port].ccom); default_tty (p_port[port].ccom); comfd = p_com[(int)p_port[port].ccom].comfd; tcflow (comfd, TCOON); tcgetattr (comfd, &tty); tty.c_iflag = (IGNBRK | IXON | IXOFF | ICRNL); tty.c_oflag = (ONLCR | OPOST); tty.c_lflag = (ICANON | ECHO); tty.c_cflag |= (CREAD | CRTSCTS); tty.c_cc[2] = '\b'; tcsetattr (comfd, TCSANOW, &tty); } #endif #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) { #ifdef __WIN32__ SetModemLine (port, 1); #else defcom *ptrcom = &p_com[p_port[port].ccom]; initcom_windows (p_port[port].ccom, INQUE, OUTQUE, XON | CTS); if (EscapeCommFunction (ptrcom->comfd, SETDTR) < 0) ShowError ("Driver error", "Unknown command :", SETDTR); if (EscapeCommFunction (ptrcom->comfd, SETRTS) < 0) ShowError ("Driver error", "Unknown command :", SETRTS); #endif } #endif #ifdef __FBBDOS__ { RSEGS rsegs; memset (&rsegs, 0, sizeof (RSEGS)); rsegs.DX = (int) p_port[port].ccom - 1; rsegs.AX = 0x0e00; int14real (&rsegs); rsegs.DX = (int) p_port[port].ccom - 1; rsegs.AX = 0x0900 | (p_com[p_port[port].ccom].options & 0xff); int14real (&rsegs); } #endif } void modem_stop (int port) { #ifdef __LINUX__ { int comfd = p_com[(int)p_port[port].ccom].comfd; tcflow (comfd, TCOOFF); } #endif #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) { #ifdef __WIN32__ SetModemLine (port, 0); #else defcom *ptrcom = &p_com[p_port[port].ccom]; if (EscapeCommFunction (ptrcom->comfd, CLRDTR) < 0) ShowError ("Driver error", "Unknown command :", CLRDTR); if (EscapeCommFunction (ptrcom->comfd, CLRRTS) < 0) ShowError ("Driver error", "Unknown command :", CLRRTS); #endif } #endif #ifdef __FBBDOS__ { RSEGS rsegs; memset (&rsegs, 0, sizeof (RSEGS)); rsegs.DX = (int) p_port[port].ccom - 1; rsegs.AX = 0x0500; int14real (&rsegs); } #endif } void modem_start (int port) { char s[80]; FILE *fpinit; #ifdef __FBBDOS__ RSEGS rsegs; fen *fen_ptr; #endif if (save_fic) return; #ifdef ENGLISH sprintf (s, "Modem Port %d Set-up", port); #else sprintf (s, " Init modem port %d ", port); #endif #ifdef __FBBDOS__ fen_ptr = open_win (4, 2, 50, 8, INIT, s); #endif #ifdef __LINUX__ if (BIOS (port) == P_LINUX) { struct termios tty; int comfd; initcom_linux (p_port[port].ccom); default_tty (p_port[port].ccom); comfd = p_com[(int)p_port[port].ccom].comfd; tcgetattr (comfd, &tty); tty.c_iflag = (IGNBRK | IXON | IXOFF | ICRNL); tty.c_oflag = (ONLCR | OPOST); tty.c_lflag = (ICANON | ECHO); tty.c_cflag |= (CREAD | CRTSCTS); tty.c_cc[2] = '\b'; tcsetattr (comfd, TCSANOW, &tty); } #endif #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) { #ifdef __WIN32__ SetModemLine (port, 1); #else /* Initialisation du modem */ initcom_windows (p_port[port].ccom, INQUE, OUTQUE, XON | DSR); #endif } #endif #ifdef __FBBDOS__ { memset (&rsegs, 0, sizeof (RSEGS)); rsegs.DX = (int) p_port[port].ccom - 1; rsegs.AX = 0x0e00; int14real (&rsegs); rsegs.DX = (int) p_port[port].ccom - 1; rsegs.AX = 0x0900 | (p_com[p_port[port].ccom].options & 0xff); int14real (&rsegs); modem_no_echo (port); rsegs.DX = port - 1; rsegs.AX = 0x0600; int14real (&rsegs); /* Initialisation du modem */ initcom_combios (p_port[port].ccom); } #endif sprintf (s, "INITTNC%d.SYS", port); if ((fpinit = fopen (c_disque (s), "rb")) != NULL) { while (fgets (s, 80, fpinit)) { sup_ln (s); if ((*s) && (*s != '#')) { tnc_commande (port, s, PORTCMD); } } ferme (fpinit, 2); } #ifdef __FBBDOS__ close_win (fen_ptr); #endif } void md_reset (int voie) { #ifdef __WINDOWS__ int port = no_port (voie); xmodem_off (voie); if (BIOS (port) == P_WINDOWS) { /* Initialisation du modem */ /* initcom_windows(p_port[port].ccom); */ } #endif #ifdef __FBBDOS__ int port = no_port (voie); xmodem_off (voie); { RSEGS rsegs; memset (&rsegs, 0, sizeof (RSEGS)); rsegs.DX = (int) p_port[port].ccom - 1; rsegs.AX = 0x0900 | (p_com[p_port[port].ccom].options & 0xff); int14real (&rsegs); } #endif } void md_defaut (int voie) { int port = no_port (voie); #ifdef __LINUX__ if (BIOS (port) == P_LINUX) { struct termios tty; defcom *ptrcom = &p_com[(int)p_port[port].ccom]; /* Revalide l'echo ... */ tcgetattr (ptrcom->comfd, &tty); tty.c_lflag = ICANON | ECHO; tcsetattr (ptrcom->comfd, TCSANOW, &tty); } #endif #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) { defcom *ptrcom = &p_com[p_port[port].ccom]; #ifdef __WIN32__ int val = 1; sta_drv (voie, ECHOCMD, (void *) &val); #else if (EscapeCommFunction (ptrcom->comfd, SETECHO) < 0) ShowError ("Driver error", "Unknown command :", SETECHO); #endif } #endif #ifdef __FBBDOS__ { RSEGS rsegs; memset (&rsegs, 0, sizeof (RSEGS)); rsegs.DX = (int) p_port[port].ccom - 1; rsegs.AX = 0x0d03; int14real (&rsegs); } #endif } int modem_vide (int voie) { int nbtot; int port = no_port (voie); #ifdef __LINUX__ if (BIOS (port) == P_LINUX) { defcom *ptrcom = &p_com[(int)p_port[port].ccom]; ioctl (ptrcom->comfd, TIOCOUTQ, &nbtot); } #endif #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) { #ifdef __WIN32__ int total; GetModemStat (no_port (voie), &total, &nbtot); #else COMSTAT cstat; defcom *ptrcom = &p_com[p_port[port].ccom]; GetCommError (ptrcom->comfd, &cstat); nbtot = cstat.cbOutQue; #endif } #endif #ifdef __FBBDOS__ { RSEGS rsegs; memset (&rsegs, 0, sizeof (RSEGS)); rsegs.CX = 0; rsegs.DX = (int) p_port[port].ccom - 1; rsegs.DI = 0; rsegs.ES = BufSeg; rsegs.DS = BufSeg; rsegs.AX = 0x0a00; int14real (&rsegs); nbtot = (int) ((rsegs.BX >> 8) - (rsegs.BX & 0xff)); } #endif return (nbtot == 0); } void md_inbuf (int voie, char *ptr, int nb) /* Entree de caracteres dans le buffer modem */ { in_buf (voie, ptr, nb); #ifdef __LINUX__ { defcom *ptrcom = &p_com[(int)p_port[port].ccom]; struct termios tty; /* Revalide l'echo ... */ tcgetattr (ptrcom->comfd, &tty); if ((tty.c_lflag & ECHO) == 0) { tty.c_lflag = ECHO; tcsetattr (ptrcom->comfd, TCSANOW, &tty); } } #endif } int md_busy (char *ptr, int nb) /* test de lignes recues */ { ptr[nb] = '\0'; while ((*ptr) && (!ISGRAPH (*ptr))) ++ptr; ptr[250] = '\0'; if ((strstr (ptr, "NO CARRIER")) || (strstr (ptr, "BUSY")) || (strstr (ptr, "VOICE")) || (strstr (ptr, "ERROR")) || (strstr (ptr, "NO ANSWER")) || (strstr (ptr, "NO DIALTONE"))) { return (1); } return (0); } void connect_modem (int voie) { df ("connect_modem", 1); init_timout (voie); init_md (); connect_fen (); svoie[voie]->ncur = NULL; svoie[voie]->aut_linked = 1; svoie[voie]->log = 1; svoie[voie]->sta.stat = svoie[voie]->sta.connect = 4; svoie[voie]->deconnect = FALSE; svoie[voie]->private_dir = 0; svoie[voie]->ret = 0; svoie[voie]->sid = 0; svoie[voie]->pack = 0; svoie[voie]->read_only = 0; svoie[voie]->vdisk = 2; svoie[voie]->tstat = svoie[voie]->debut = time (NULL); svoie[voie]->nb_err = svoie[voie]->seq = svoie[voie]->stop = svoie[voie]->sr_mem = 0; svoie[voie]->tmach = 0L; svoie[voie]->l_mess = 0L; svoie[voie]->l_yapp = 0L; svoie[voie]->sta.ack = 0; svoie[voie]->maj_ok = 0; svoie[voie]->ch_mon = svoie[voie]->cross_connect = -1; svoie[voie]->conf = 0; set_binary (voie, 0); svoie[voie]->msg_held = 0; svoie[voie]->mess_recu = svoie[voie]->xferok = 1; svoie[voie]->mbl = 1; svoie[voie]->entmes.numero = 0L; svoie[voie]->entmes.theme = 0; svoie[voie]->finf.lang = langue[0]->numlang; svoie[voie]->r_tete = NULL; svoie[voie]->mode = 0; svoie[voie]->rev_mode = 1; svoie[voie]->mbl_ext = 1; svoie[voie]->nb_egal = 0; svoie[voie]->paclen = p_port[no_port (voie)].pk_t; if (fbb_fwd) svoie[voie]->mode |= F_NFW; curseur (); if (svoie[voie]->niv1 == 0) { strcpy (svoie[voie]->sta.indicatif.call, "MODEM"); svoie[voie]->sta.indicatif.num = '\0'; svoie[voie]->niv1 = N_MOD; svoie[voie]->niv2 = 0; svoie[voie]->niv3 = 0; } else { if (svoie[voie]->curfwd) svoie[voie]->curfwd->no_con = 8; connect_log (voie, " {MODEM}"); if (cher_noeud (svoie[voie]->sta.indicatif.call)) { connexion (voie); new_om = nouveau (voie); /* getvoie(voie)->mode = getvoie(voie)->finf.flags ; */ svoie[voie]->mode = 0; if (fbb_fwd) { svoie[voie]->mode |= F_NFW; } } } aff_nbsta (); #ifdef __WINDOWS__ window_connect (voie); #endif change_droits (voie); strcpy (svoie[voie]->dos_path, "\\"); aff_event (voie, 1); ff (); return; } void deconnect_modem (int voie) { int port; long temps; if (DEBUG) return; port = no_port (voie); /* Attend que le buffer soit vide */ #ifdef __LINUX__ { int tempo = 100; /* attend 10s le vidage du modem */ while (!modem_vide (voie)) { WinMSleep (50); if (tempo > 0) --tempo; if (tempo == 0) break; } } #endif #ifdef __WINDOWS__ { int tempo = 100; /* attend 10s le vidage du modem */ while (!modem_vide (voie)) { WinMSleep (50); if (tempo > 0) --tempo; if (tempo == 0) break; } WinMSleep (500); } #endif #ifdef __FBBDOS__ tempo = 180; /* attend 10s le vidage du modem */ while (!modem_vide (voie)) { if (tempo == 0) break; } sleep_ (1); #endif modem_stop (port); modem_no_echo (port); temps = time (NULL) + 2; #ifdef __LINUX__ if (BIOS (port) == P_LINUX) { defcom *ptrcom = &p_com[(int)p_port[port].ccom]; if (ptrcom->comfd < 0) return; /* Attend la descente du DCD */ for (;;) { int mcs; ioctl (ptrcom->comfd, TIOCMGET, &mcs); if (mcs & TIOCM_CAR) { if (time (NULL) > temps) { md_send (port, "~~~+++~~~ATH0^M"); break; } } else break; } } #endif #ifdef __WINDOWS__ if (BIOS (port) == P_WINDOWS) { defcom *ptrcom = &p_com[p_port[port].ccom]; if (ptrcom->comfd < 0) return; #ifdef __WIN32__ while (GetModemDCD (port)) { if (time (NULL) > temps) { md_send (port, "~~~+++~~~ATH0^M"); break; } } #else while (GetCommStatus (ptrcom->comfd) & 0x80) { if (time (NULL) > temps) { md_send (port, "~~~+++~~~ATH0^M"); break; } } #endif } #endif #ifdef __FBBDOS__ { RSEGS rsegs; memset (&rsegs, 0, sizeof (RSEGS)); do { rsegs.AX = 0x300; rsegs.DX = (int) p_port[port].ccom - 1; int14real (&rsegs); if ((time (NULL) > temps) && (rsegs.AX & 0x80)) { if (!getvoie (CONSOLE)->sta.connect) cprintf ("\r\nModem time-out\r\n"); md_send (port, "~~~+++~~~ATH0^M"); break; } } while (rsegs.AX & 0x80); } #endif svoie[voie]->niv1 = svoie[voie]->niv2 = svoie[voie]->niv3 = 0; svoie[voie]->timout = time_n; ff (); } void re_init_modem (int voie) { int port; if (DEBUG) return; df ("re_init_modem", 1); port = no_port (voie); modem_start (port); ff (); } void accueil_modem (void) { bipper (); md_defaut (voiecur); cr (); pvoie->lignes = -1; p_port[no_port (voiecur)].echo = TRUE; if (!outfich (c_disque ("LANG\\MODEM.ENT"))) out ("$W$O BBS. Phone access$W$W", 25); out ("Callsign :", 10); pvoie->temp1 = pvoie->temp2 = 0; pvoie->maj_ok = 0; pvoie->l_mess = 0L; pvoie->l_yapp = 0L; pvoie->read_only = 0; ch_niv2 (1); } #define READ_ONLY_0 "\rThe callsign \"%s\" is not registered.\rYou have a read-only access.\rYou may leave a message to SYSOP.\r\rGo on anyway (Y/N) " #define READ_ONLY_1 "\rThere is no password for \"%s\".\rYou have a read-only access.\rYou may leave a message to SYSOP.\r\r" static void read_only_alert (int mode, char *callsign) { char chaine[256]; pvoie->read_only = 1; switch (mode) { case 0: sprintf (chaine, READ_ONLY_0, callsign); break; case 1: sprintf (chaine, READ_ONLY_1, callsign); break; } out (chaine, strlen (chaine)); aff_etat ('E'); send_buf (voiecur); } void indic_modem (void) { int i, rejet = 0, dde_call = 0; char chaine[128]; char *st; indd[40] = '\0'; while ((*indd) && (!isgraph (*indd))) ++indd; if (*indd == '.') { pvoie->temp2 = 1; p_port[no_port (voiecur)].echo = FALSE; ++indd; } if (pvoie->read_only) { if (toupper (*indd) == 'Y') { if (cher_noeud (pvoie->sta.indicatif.call)) { *pvoie->passwd = '\0'; pvoie->mode = 0; if (fbb_fwd) { pvoie->mode |= F_NFW; } connexion (voiecur); #ifdef __WINDOWS__ window_connect (voiecur); #endif change_droits (voiecur); new_om = nouveau (voiecur); } else { init_info (&pvoie->finf, &pvoie->sta.indicatif); strn_cpy (6, pvoie->sta.indicatif.call, "MODEM"); pvoie->read_only = 1; *pvoie->passwd = '\0'; connexion (voiecur); strcpy (pvoie->finf.prenom, "..."); pvoie->droits = d_droits; } cr (); init_langue (voiecur); st = idnt_fwd (); outs (st, strlen (st)); texte (T_MES + 2); finentete (); retour_mbl (); } else { pvoie->temp1 = pvoie->temp2 = 0; p_port[no_port (voiecur)].echo = TRUE; pvoie->read_only = 0; md_echo (voiecur); out ("\rCallsign :", 11); } strcpy (pvoie->dos_path, "\\"); return; } if (*indd == '\0') { md_echo (voiecur); out ("Callsign :", 10); return; } if ((strncmp (indd, "CONNECT", 7) == 0) || (strncmp (indd, "CARRIER", 7) == 0) || (strncmp (indd, "PROTOCO", 7) == 0) || (strncmp (indd, "COMPRES", 7) == 0)) { return; } ++pvoie->temp1; sup_ln (indd); if (!find (indd)) { sprintf (chaine, "Invalid callsign \"%s\" !", indd); outln (chaine, strlen (chaine)); md_echo (voiecur); if (pvoie->temp1 == 10) rejet = 1; else dde_call = 1; pvoie->temp2 = 0; p_port[no_port (voiecur)].echo = TRUE; } else { strn_cpy (6, pvoie->sta.indicatif.call, indd); pvoie->sta.indicatif.num = 0; for (i = 0; i < 8; i++) *(pvoie->sta.relais[i].call) = '\0'; connect_log (voiecur, " {MODEM}"); if (cher_noeud (pvoie->sta.indicatif.call)) { *pvoie->passwd = '\0'; /* pvoie->mode = pvoie->finf.flags ; */ pvoie->mode = 0; if (fbb_fwd) { pvoie->mode |= F_NFW; /* if (bin_fwd) pvoie->mode |= F_BIN ; */ } connexion (voiecur); new_om = nouveau (voiecur); #ifdef __WINDOWS__ window_connect (voiecur); #endif change_droits (voiecur); strcpy (pvoie->dos_path, "\\"); if (MOD (pvoie->finf.flags)) { if (*pvoie->finf.pass) { ch_niv2 (2); out ("Password :", 10); pvoie->temp1 = 0; md_etoiles (voiecur); } else { read_only_alert (1, indd); md_echo (voiecur); maj_niv (0, 0, 0); premier_niveau (); } } else if (pvoie->temp1 == 5) rejet = 1; else { if (P_READ (voiecur)) { read_only_alert (0, indd); return; } else { sprintf (chaine, "Invalid callsign \"%s\" !", indd); outln (chaine, strlen (chaine)); md_echo (voiecur); dde_call = 1; } } } else if (pvoie->temp1 == 5) rejet = 1; else { if (P_READ (voiecur)) { if (pvoie->temp1 == 10) rejet = 1; else { read_only_alert (0, indd); return; } } else { sprintf (chaine, "Unregistered callsign \"%s\" !", indd); outln (chaine, strlen (chaine)); md_echo (voiecur); dde_call = 1; } } } if (rejet) { outln ("Sorry, you are not a registered user ! ", 42); outln ("Disconnected", 12); md_echo (voiecur); pvoie->deconnect = 4; pvoie->maj_ok = 0; } if (dde_call) { pvoie->read_only = 0; md_echo (voiecur); out ("Callsign :", 10); } } void passwd_modem (void) { while ((*indd) && (!isgraph (*indd))) ++indd; indd[20] = '\0'; if (++pvoie->temp1 == 3) { outln ("Password error !", 16); outln ("Disconnected", 12); md_echo (voiecur); pvoie->deconnect = 5; pvoie->maj_ok = 0; } else if (ok_pass_modem ()) { if (pvoie->temp2) md_no_echo (voiecur); /* else md_echo(voiecur); */ else md_echo (voiecur); if (!pvoie->read_only) outln ("$WLogon Ok. Type NP to change password.$W", 41); maj_niv (0, 0, 0); premier_niveau (); } else { out ("Password :", 10); md_etoiles (voiecur); } } int ok_pass_modem (void) { if (pvoie->read_only) return (1); return (strncmp (pvoie->finf.pass, strupr (sup_ln (indd)), 12) == 0); } void passwd_change (void) { while_space (); switch (pvoie->niv3) { case 0: if (ok_pass_modem ()) { out ("Enter new password :", 20); ch_niv3 (1); } else { outln ("Password error !", 16); retour_menu (N_MBL); } break; case 1: strn_cpy (12, pvoie->ch_temp, sup_ln (indd)); out ("Once more :", 12); ch_niv3 (2); break; case 2: strupr (sup_ln (indd)); if (strcmp (pvoie->ch_temp, indd) == 0) { strn_cpy (12, pvoie->finf.pass, indd); majinfo (voiecur, 2); md_echo (voiecur); } else outln ("Password error !", 16); md_echo (voiecur); retour_menu (N_MBL); break; } } fbb-7.04j/src/nomenc.c0100644000175100017510000002630507726646105012637 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE NOMENC.C */ #include static int ecrire_indic (tri *, int); static void affich_nom (info *); static void menu_nomenclature (void); static void fin_liste_indic (void); static void parcours_liste (void); static void affich_indic (info * pinfo) { int i = 0; char s[40]; sprintf (varx[0], "%-6s-%d", pinfo->indic.call, pinfo->indic.num); texte (T_NOM + 3); if (*(pinfo->relai[i].call)) { out ("via ", 4); while ((i < 8) && *(pinfo->relai[i].call)) { if (i == 4) out ("$W ", 6); sprintf (s, " %-6s-%d", pinfo->relai[i].call, pinfo->relai[i].num); out (s, strlen (s)); ++i; } out ("$W", 2); } } static void affich_coord (info * pinfo) { affich_indic (pinfo); affich_nom (pinfo); ptmes->date = pinfo->hcon; texte (T_NOM + 4); } static void affich_nom (info * pinfo) { var_cpy (0, pinfo->nom); var_cpy (1, pinfo->prenom); var_cpy (2, pinfo->adres); var_cpy (3, pinfo->ville); var_cpy (4, pinfo->qra); var_cpy (5, pinfo->teld); var_cpy (6, pinfo->telp); var_cpy (7, pinfo->home); var_cpy (8, pinfo->zip); texte (T_NOM + 5); } static void rech_nomenc (void) { unsigned r; FILE *fptr; info buf_info; *varx[0] = '\0'; if (*indd == '\0') { texte (T_NOM + 3); } else { if (find (sup_ln (indd))) { if ((r = chercoord (indd)) == 0xffff) { var_cpy (0, indd); texte (T_NOM + 13); } else { fptr = ouvre_nomenc (); fseek (fptr, (long) r * sizeof (info), 0); fread ((char *) &buf_info, sizeof (info), 1, fptr); ferme (fptr, 11); affich_coord (&buf_info); } maj_niv (5, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else { var_cpy (0, indd); texte (T_NOM + 13); maj_niv (5, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } } } static void lit_coord (unsigned record, info * frec) { FILE *fptr; fptr = ouvre_nomenc (); fseek (fptr, (long) record * sizeof (info), 0); fread (frec, sizeof (info), 1, fptr); ferme (fptr, 39); } static void ecrit_coord (unsigned record, info * frec) { FILE *fptr; if (record == 0xffff) dump_core (); fptr = ouvre_nomenc (); fseek (fptr, (long) record * sizeof (info), 0); fwrite (frec, sizeof (info), 1, fptr); ferme (fptr, 39); } static void modif_nomenc (void) { unsigned num_indic; int err = 0; info frec; char c; char s[80]; char temp[80]; char *ptr; char *scan; if (read_only ()) { prompt (pvoie->finf.flags, pvoie->niv1); maj_niv (5, 0, 0); return; } if (pvoie->niv3 > 1) lit_coord (pvoie->emis->coord, &frec); switch (pvoie->niv3) { case 0: incindd (); if ((*indd) && (droits (COSYSOP))) { if (find (sup_ln (indd))) { pvoie->emis = insnoeud (indd, &num_indic); if (pvoie->emis->coord == 0xffff) err = 1; } else err = 1; if (err) { var_cpy (0, indd); texte (T_NOM + 13); prompt (pvoie->finf.flags, pvoie->niv1); maj_niv (5, 0, 0); return; } } else { pvoie->emis = pvoie->ncur; } lit_coord (pvoie->emis->coord, &frec); affich_nom (&frec); texte (T_QST + 1); ch_niv3 (1); break; case 1: c = toupper (*indd); if (c == Oui) { /* majinfo(voiecur, 1) ; */ texte (T_MBL + 9); ch_niv3 (2); } else if ((c == 'A') || (c == 'F') || (c == Non)) { maj_niv (5, 0, 0); incindd (); menu_nomenclature (); } else { texte (T_ERR + 0); texte (T_QST + 1); } break; case 2: if (ISGRAPH (*indd)) { epure (frec.prenom, 12); scan = frec.prenom; while (*scan) { if (*scan == ' ') *scan = '-'; ++scan; } } texte (T_NOM + 6); ch_niv3 (3); break; case 3: if (ISGRAPH (*indd)) epure (frec.nom, 17); texte (T_NOM + 7); ch_niv3 (4); break; case 4: if (ISGRAPH (*indd)) epure (frec.adres, 60); texte (T_MBL + 54); ch_niv3 (5); break; case 5: if (ISGRAPH (*indd)) { epure (frec.zip, 8); scan = frec.zip; while (*scan) { if (*scan == ' ') *scan = '-'; ++scan; } } texte (T_NOM + 8); ch_niv3 (6); break; case 6: if (ISGRAPH (*indd)) epure (frec.ville, 30); texte (T_NOM + 9); ch_niv3 (7); break; case 7: if (ISGRAPH (*indd)) epure (frec.teld, 12); texte (T_NOM + 10); ch_niv3 (8); break; case 8: if (ISGRAPH (*indd)) epure (frec.telp, 12); texte (T_MBL + 53); ch_niv3 (9); break; case 9: if (ISGRAPH (*indd)) { strupr (epure (s, 40)); ptr = strchr (s, '.'); if (ptr) *ptr = '\0'; ptr = strchr (s, '-'); if (ptr) { *ptr = '\0'; } strcpy (temp, s); if (find (temp)) { strcpy (frec.home, s); texte (T_NOM + 11); ch_niv3 (10); } else { texte (T_ERR + 7); texte (T_MBL + 53); } } else { texte (T_NOM + 11); ch_niv3 (10); } break; case 10: if (ISGRAPH (*indd)) { strupr (epure (s, 6)); if (tstqra (s)) { strcpy (frec.qra, s); ecrit_coord (pvoie->emis->coord, &frec); } else { texte (T_NOM + 11); break; } } user_wp (&frec); texte (T_QST + 2); prompt (pvoie->finf.flags, pvoie->niv1); maj_niv (5, 0, 0); break; default: fbb_error (ERR_NIVEAU, "MODIF-NOMENC", pvoie->niv3); break; } if (pvoie->niv3 > 2) { ecrit_coord (pvoie->emis->coord, &frec); if (pvoie->emis == pvoie->ncur) pvoie->finf = frec; } } /* * LISTE DES INDICATIFS */ static void fin_liste_indic (void) { itoa (pvoie->temp1, varx[0], 10); texte (T_NOM + 12); } int ecrire_indic (tri * inf_ptr, int nb) /* * en sortie : vrai si l'indicatif a ete ecrit * faux sinon */ { char s[81]; bloc_indic *temp; int ind, val; int i, j, pos = 0; for (i = 0; i < nb; i++) { ind = 0; val = inf_ptr->pos; if (val == 0) break; temp = racine; while ((ind + T_BLOC_INFO) <= val) { ind += T_BLOC_INFO; temp = temp->suiv; } j = val - ind; sprintf (s, "%-6s ", temp->st_ind[j].indic); out (s, strlen (s)); if (++pos == 11) { pos = 0; out ("\n", 1); } ++inf_ptr; } return (TRUE); } static void parcours_liste (void) { bloc_indic *bptr; tri *inf_ptr = NULL, *pos_ptr = NULL; unsigned offset; unsigned num_indic; int pass; int nb = 0; tri t_ptr; pvoie->temp1 = 0; for (pass = 0; pass <= 1; ++pass) { bptr = racine; offset = num_indic = 0; if (pass == 0) pos_ptr = &t_ptr; while (bptr) { if (*(bptr->st_ind[offset].indic) == '\0') break; if (bptr->st_ind[offset].coord != 0xffff) { if (bptr->st_ind[offset].val) { if (strmatch (bptr->st_ind[offset].indic, indd)) { if (pass) { pos_ptr->pos = num_indic; n_cpy (6, pos_ptr->ind, bptr->st_ind[offset].indic); ++pos_ptr; } ++nb; } } } if (++offset == T_BLOC_INFO) { offset = 0; bptr = bptr->suiv; } ++num_indic; } if (nb == 0) break; if (pass == 0) { pvoie->temp1 = nb; pos_ptr = inf_ptr = (tri *) m_alloue (nb * sizeof (tri)); nb = 0; } } if (nb) qsort ((void *) inf_ptr, (size_t) nb, (size_t) sizeof (tri), (int (*)(const void *, const void *)) strcmp); ecrire_indic (inf_ptr, nb); if (nb) m_libere (inf_ptr, nb * sizeof (tri)); } void liste_indic (void) { pvoie->temp2 = pvoie->temp1 = 0; strupr (sup_ln (indd)); if (*indd == '\0') { *indd = '*'; *(indd + 1) = '\0'; } parcours_liste (); fin_liste_indic (); retour_menu (pvoie->niv1); } void saisie_infos (void) { int change = 0; char s[80]; char temp[80]; char *ptr; char *scan; switch (pvoie->niv3) { case 0: break; case 1: if (ISGRAPH (*indd)) { epure (pvoie->finf.prenom, 12); scan = pvoie->finf.prenom; while (*scan) { if (*scan == ' ') *scan = '-'; ++scan; } change = 1; } break; case 2: if (ISGRAPH (*indd)) { epure (pvoie->finf.ville, 30); change = 1; } break; case 3: if (ISGRAPH (*indd)) { strupr (epure (s, 40)); /* Seul l'indicatif est enregistre */ ptr = strchr (s, '.'); if (ptr) *ptr = '\0'; ptr = strchr (s, '-'); if (ptr) { *ptr = '\0'; } strcpy (temp, s); if (find (temp)) { strcpy (pvoie->finf.home, extend_bbs (s)); } else { texte (T_ERR + 7); } change = 1; } break; case 4: if (ISGRAPH (*indd)) { epure (pvoie->finf.zip, 8); scan = pvoie->finf.zip; while (*scan) { if (*scan == ' ') *scan = '-'; ++scan; } change = 1; } break; default: fbb_error (ERR_NIVEAU, "SAISIE-INFO", pvoie->niv3); break; } if (*pvoie->finf.prenom == '\0') { texte (T_MBL + 9); ch_niv3 (1); } else if (*pvoie->finf.ville == '\0') { texte (T_NOM + 8); ch_niv3 (2); } else if (*pvoie->finf.home == '\0') { texte (T_MBL + 53); ch_niv3 (3); } else if (*pvoie->finf.zip == '\0') { texte (T_MBL + 54); ch_niv3 (4); } else { if (change) { if (pvoie->ncur) { ecrit_coord (pvoie->ncur->coord, &pvoie->finf); user_wp (&pvoie->finf); } texte (T_QST + 2); } finentete (); ptr = pvoie->sta.indicatif.call; if (pvoie->sniv1 == N_CONF) { pvoie->niv1 = pvoie->sniv1; pvoie->niv2 = pvoie->sniv2; pvoie->niv3 = pvoie->sniv3; pvoie->conf = 1; } else { maj_niv (N_MBL, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } } } /* * MENUS - PREMIER NIVEAU NOMENCLATURE */ static void menu_nomenclature (void) { int error = 0; char com[80]; limite_commande (); sup_ln (indd); while (*indd && (!ISGRAPH (*indd))) indd++; strn_cpy (70, com, indd); switch (toupper (*indd)) { case 'N': maj_niv (5, 1, 0); modif_nomenc (); break; case 'R': maj_niv (5, 3, 0); incindd (); rech_nomenc (); break; case 'I': maj_niv (5, 4, 0); incindd (); liste_indic (); break; case 'B': maj_niv (N_MENU, 0, 0); sortie (); break; case 'F': maj_niv (0, 1, 0); incindd (); choix (); break; case '\0': prompt (pvoie->finf.flags, pvoie->niv1); break; default: if (!defaut ()) error = 1; break; } if (error) { cmd_err (indd); } } void nomenclature (void) { switch (pvoie->niv2) { case 0: menu_nomenclature (); break; case 1: modif_nomenc (); break; case 3: rech_nomenc (); break; case 4: liste_indic (); break; case 5: saisie_infos (); break; default: fbb_error (ERR_NIVEAU, "NOMENC", pvoie->niv2); break; } } fbb-7.04j/src/nouvfwd.c0100644000175100017510000010501507726646105013044 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE NOUVFWD.C */ #include #include #define FDEBUG 0 static char checksum (char *); static void bin_hdr (char *, long); static void env_proposition (void); static void mode_binaire (int); static void mode_ascii (int); static void pas_de_message (void); static void recoit_titre (void); static void r_n_fwd (void); static void teste_suite (void); static int bloc_message (int); static int get_nouv_fwd (void); static int rcv_fb (int); static int rcv_fs (int); static int s_n_fwd (void); static int snd_fb (int); static int snd_fs (int); /* pvoie->temp2 = TRUE si je suis appelant */ #if defined(__WINDOWS__) || defined(__LINUX__) char *ffwd_str (int voie, char *s) { #define XMODLEN 44 static char stdesc[10][11] = { "Snd Prop ", "Wait FS/FF", "Wait Prop ", "Wait Msg ", "Rcv Msg ", "Snd Title ", "Snd Msg " }; char taille[40]; char nummes[40]; char offset[40]; int niv2 = svoie[voie]->niv2; int niv3 = svoie[voie]->niv3; *s = '\0'; if (niv2 == 5 && niv3 >= 0 && niv3 < 7) { if (svoie[voie]->tailm) sprintf (taille, "/%ld", svoie[voie]->tailm); else *taille = '\0'; if ((niv3 == 3) || (niv3 == 4)) sprintf (nummes, "#%d ", svoie[voie]->ind_mess + 1); else *nummes = '\0'; if ((niv3 == 4) || (niv3 == 6)) sprintf (offset, "%ld", svoie[voie]->enrcur); else *offset = '\0'; sprintf (s, "FbbFwd:%s %s%s%s", stdesc[niv3], nummes, offset, taille); } return (s); } #endif void new_fwd (void) { df ("new_fwd", 0); switch (pvoie->niv3) { case 0: env_proposition (); break; case 1: if (s_n_fwd ()) pvoie->ind_mess = -1; break; case 2: r_n_fwd (); break; case 3: while (pvoie->fb_mess[pvoie->ind_mess].type == '\0') { if (++pvoie->ind_mess >= 5) { teste_suite (); return; } } recoit_titre (); ch_niv3 (4); break; case 4: if (get_nouv_fwd ()) teste_suite (); break; case 5: env_message (); break; case 6: if (bin_message (pvoie->t_read) == 0) { ch_niv3 (5); tst_warning (ptmes); env_message (); } break; } ff (); } static void pactor_ident (void) { char buf[80]; char *noflag = "*N*"; if (!P_TOR (voiecur)) return; sprintf (buf, "; %d:%s de %s", actif (1), pvoie->sta.indicatif.call, mycall); if (noflag[1] != 'N') outln (buf, strlen (buf)); } static void env_proposition (void) { int nb; df ("env_proposition", 0); pvoie->enrcur = 0L; pvoie->tailm = 0L; if ((nb = snd_fb (voiecur)) != 0) { pvoie->ind_mess = nb; ch_niv3 (1); } else { if (pvoie->ind_mess == -2) { outln ("FQ", 2); pvoie->deconnect = 6; } else { pas_de_message (); } } ff (); } static void mess_cancel (char *texte) { int nb = strlen (texte); unsigned char buf[257]; buf[0] = CAN; buf[1] = nb; strcpy (buf + 2, texte); outs (buf, nb + 2); } void env_message (void) { char temp[128]; /* long mess_size; */ long nmess; int ratio; struct stat st; pvoie->seq = 0; for (;;) { if (pvoie->t_read) { nmess = pvoie->t_read->nmess; if (pvoie->binary) { /* Binaire */ if (pvoie->t_read->verb) { if (compress_mess (ch_record (NULL, nmess, '\0'))) { deb_io (); aff_header (voiecur); stat (mess_name (MBINDIR, nmess, temp), &st); ratio = 100 - (int) (((st.st_size - 6) * 100) / (ptmes->taille + 75)); if (ratio < 0) ratio = 0; #ifdef ENGLISH sprintf (temp, "Send compressed #%ld (%d%%) \r\n", nmess, ratio); #else sprintf (temp, "Envoie #%ld compress (%d%%)\r\n", nmess, ratio); #endif winputs (voiecur, W_SNDT, temp); fin_io (); pvoie->enrcur = 0L; pvoie->tailm = st.st_size - 6; if (bin_message (pvoie->t_read)) { ch_niv3 (6); return; } else { /* Le message a ete envoye ... On attend */ pvoie->seq = 1; return; } } else { ch_niv3 (6); return; } } else { /* erreur ! */ sprintf (temp, "Msg #%ld does not exist !\r", nmess); mess_cancel (temp); pvoie->t_read = pvoie->t_read->suite; } } else { /* Ascii */ if (pvoie->t_read->verb) { if (bin_message (pvoie->t_read)) { ch_niv3 (6); return; } } else { sprintf (temp, "Msg #%ld does not exist !\r", nmess); outln (temp, strlen (temp)); pvoie->t_read = pvoie->t_read->suite; } } } else { pvoie->sr_mem = 0; mode_ascii (voiecur); ch_niv3 (2); return; } } } void mode_binaire (int voie) { df ("mode_binaire", 1); if (svoie[voie]->binary == 0) { time_yapp[voie] = -1; set_binary (voie, 1); /* Les BS ne sont pas autorises en binaire ... */ set_bs (voiecur, FALSE); } ff (); } void mode_ascii (int voie) { df ("mode_ascii", 1); if (svoie[voie]->binary) { set_binary (voie, 0); } ff (); } void recoit_titre (void) { df ("recoit_titre", 0); #if FDEBUG if (!svoie[CONSOLE]->connect) cprintf ("Temp1 : %d\n", pvoie->ind_mess); #endif *(ptmes) = pvoie->fb_mess[pvoie->ind_mess]; *(pvoie->appendf) = '\0'; *(pvoie->mess_bid) = '\0'; ptmes->theme = 0; ptmes->numero = 0L; ptmes->bin = 0; pvoie->chck = 0; pvoie->m_ack = 0; pvoie->messdate = time (NULL); pvoie->mess_num = -1; pvoie->enrcur = 0L; pvoie->tailm = 0L; swapp_bbs (ptmes); if ((*ptmes->bbsv == '\0') && (ptmes->type == 'P')) pvoie->m_ack = 1; if ((*ptmes->bbsv == '\0') && (ptmes->type == 'A')) ptmes->type = 'P'; ptmes->status = 'N'; if (*ptmes->bbsv) { if (((ptmes->type != 'P') && (ptmes->type != 'T') && (ptmes->type != 'A')) || (strcmp (ptmes->desti, "SYSOP") == 0)) { ptmes->status = '$'; } } reacheminement (); if (pvoie->binary) { char *ptr; if (ptype != HD) { err_new_fwd (0, 0); ff (); return; } indd = data + 2; ptr = indd; while (*ptr++); sscanf (ptr, "%ld", &pvoie->noenr_menu); if (pvoie->noenr_menu) old_part (pvoie->sta.indicatif.call, ptmes->bid); else part_file (pvoie->sta.indicatif.call, ptmes->bid); } else pvoie->noenr_menu = 0L; rcv_titre (); ptmes->taille = pvoie->noenr_menu; ff (); } int write_temp_bin (int voie, int all) { int fd; obuf *msgtemp; bullist *pbul = &svoie[voie]->entmes; df ("write_temp_bin", 1); if (svoie[voie]->msgtete == NULL) { ff (); return (1); } fd = open (svoie[voie]->sr_fic, O_WRONLY | O_APPEND | O_BINARY); if (fd != -1) { while ((msgtemp = svoie[voie]->msgtete) != NULL) { if ((!all) && (msgtemp->suiv == NULL)) break; if (write (fd, msgtemp->buffer, msgtemp->nb_car) != msgtemp->nb_car) { char buffer[128]; sprintf (buffer, "write_temp_bin : write %s", svoie[voie]->sr_fic); write_error (buffer); } svoie[voie]->memoc -= msgtemp->nb_car; svoie[voie]->msgtete = msgtemp->suiv; m_libere ((char *) msgtemp, sizeof (*msgtemp)); } close (fd); } else { char buffer[128]; sprintf (buffer, "write_temp_bin : open %s", svoie[voie]->sr_fic); write_error (buffer); } mod_part (svoie[voie]->sta.indicatif.call, pbul->taille, pbul->bid); ff (); return (1); } static int get_mess_bin (char clog, char *ptr, int nbcar) { int ncars, nb; obuf *msgtemp; char *ptcur; df ("get_mess_bin", 5); for (nb = 0; nb < nbcar; nb++) pvoie->chck += ptr[nb]; pvoie->enrcur += nbcar; nb = 0; if ((msgtemp = pvoie->msgtete) != NULL) { while (msgtemp->suiv) msgtemp = msgtemp->suiv; } else { msgtemp = (obuf *) m_alloue (sizeof (obuf)); pvoie->msgtete = msgtemp; msgtemp->nb_car = msgtemp->no_car = 0; msgtemp->suiv = NULL; } ncars = msgtemp->nb_car; ptcur = msgtemp->buffer + ncars; while (nbcar--) { ++pvoie->memoc; ++(ptmes->taille); *ptcur++ = *ptr++; if (++ncars == 250) { msgtemp->nb_car = ncars; msgtemp->suiv = (obuf *) m_alloue (sizeof (obuf)); msgtemp = msgtemp->suiv; msgtemp->nb_car = msgtemp->no_car = ncars = 0; msgtemp->suiv = NULL; ptcur = msgtemp->buffer; } } msgtemp->nb_car = ncars; if (pvoie->memoc >= MAXMEM) { write_temp_bin (voiecur, FALSE); } nb = clog; /* Bidon ! */ ff (); return (0); } static int check_phase (ushort crc, long lg) { FILE *fptr; ushort tcrc; long tlg; if ((fptr = fopen (pvoie->sr_fic, "rb")) != NULL) { fseek (fptr, 20L, 0); if ((fread (&tcrc, sizeof (tcrc), 1, fptr)) && (fread (&tlg, sizeof (lg), 1, fptr))) { if (moto) { tcrc = xendien (tcrc); tlg = xendienl (tlg); } if ((tlg == lg) && (tcrc == crc)) { fclose (fptr); return (1); } } fclose (fptr); } return (0); } int get_nouv_fwd (void) { int nb; int nbcar; ushort crc; long lg; long numess; if (pvoie->deconnect) return (0); if (pvoie->binary) { switch (ptype) { case DT: nbcar = (data[1]) ? data[1] & 0xff : 256; if ((pvoie->noenr_menu) && (nbcar >= 6)) { for (nb = 2; nb < 8; nb++) pvoie->chck += data[nb]; memcpy (&crc, data + 2, sizeof (crc)); memcpy (&lg, data + 4, sizeof (lg)); if (moto) { crc = xendien (crc); lg = xendienl (lg); } if (!check_phase (crc, lg)) { del_part (voiecur, ptmes->bid); libere (voiecur); err_new_fwd (1, 14); return (0); } else { df ("DT_1", 0); get_mess_bin ('W', data + 8, nbcar - 6); ff (); } pvoie->noenr_menu = 0L; } else { df ("DT_2", 0); get_mess_bin ('W', data + 2, nbcar); ff (); } return (0); case ET: /* Fin du message */ df ("ET", 0); if (!write_temp_bin (voiecur, TRUE)) { ff (); return (0); } ff (); pvoie->chck += data[1]; if (pvoie->chck) { del_part (voiecur, ptmes->bid); libere (voiecur); err_new_fwd (1, 1); return (0); } else { /* On prevoie le numero !! */ numess = nomess + 1; if ((numess % 0x10000L) == 0) numess = nomess + 2; ptmes->numero = numess; /* pdebug(" (%d) decompress %ld", voiecur, numess); */ dde_huf (voiecur, ptmes, DECODE); #ifdef HUFF_TASK while (pvoie->ask == 0L) { deb_io (); zero_tic (); fin_io (); } #endif del_part (voiecur, ptmes->bid); ptmes->taille = pvoie->ask; pvoie->ask = 0L; pvoie->enrcur = 0L; if (ptmes->taille == -1L) { /* Erreur dans le decodage */ return (err_new_fwd (0, 2)); } else { char asc_file[130]; int test; if (pvoie->header) strn_cpy (6, ptmes->bbsf, pvoie->sta.indicatif.call); else *(ptmes->bbsf) = '\0'; ptmes->datesd = pvoie->messdate; ptmes->date = ptmes->datech = time (NULL); if (deja_recu (ptmes, 1, &test) == 1) { char temp[256]; /* Already received on another channel */ sprintf (temp, "Bid %s already received. Message discarded\r\n", ptmes->bid); winputs (voiecur, W_RCVT, temp); } else { if (!is_held (mess_name (MESSDIR, ptmes->numero, asc_file))) { /* On affecte le numero officiellement ! */ ptmes->numero = 0L; numess = ptmes->numero = next_num (); /* On valide le message */ put_mess_fwd ('W'); tst_sysop (ptmes->desti, numess); tst_serveur (ptmes); tst_ack (ptmes); tst_warning (ptmes); } } return (1); } } default: err_new_fwd (0, 3); return (0); } } return (get_mess_fwd ('W', indd, nb_trait, 2)); } void teste_suite (void) { df ("teste_suite", 0); #if FDEBUG if (!svoie[CONSOLE]->connect) cprintf ("Dans teste suite : ind_mess %d temp2 %d\n", pvoie->ind_mess, pvoie->temp2); #endif if (save_fic) { ++pvoie->sta.ack; pvoie->deconnect = 6; ff (); return; } while (++pvoie->ind_mess < 5) { if (pvoie->fb_mess[pvoie->ind_mess].type) { ch_niv3 (3); ff (); return; } } mode_ascii (voiecur); if (!pvoie->temp2) { #if FDEBUG if (!svoie[CONSOLE]->connect) cprintf ("Appel_rev 1\n"); #endif if (appel_rev_fwd (0)) { ch_niv3 (0); env_proposition (); } else { pas_de_message (); } } else { if ((pvoie->ind_mess = snd_fb (voiecur)) != 0) { ch_niv3 (1); } else { pas_de_message (); } } ff (); } void pas_de_message (void) { pvoie->ind_mess = -2; init_rec_fwd (voiecur); outln ("FF", 2); ch_niv3 (2); #if FDEBUG if (!svoie[CONSOLE]->connect) cprintf ("Pas de message voie %d\n", voiecur); #endif } /* reception forward */ void r_n_fwd (void) { int c, nb; long noprec = 0L; int chck; char *ligne = indd; char s[256]; if (*indd == ';') return; if (*indd != 'F') { if ((*indd != '\r') && (*indd != '*')) { err_new_fwd (0, 13); } else { mode_ascii (voiecur); pvoie->deconnect = 3; } return; } ++indd; c = *indd; incindd (); if (pvoie->ind_mess < 0) { if (pvoie->ind_mess == -1) { /* Marque les messages envoyes */ /* Eviter la proposition de messages "=" a chaque bloc */ noprec = pvoie->fb_mess[0].numero; for (nb = 0; nb < MAX_FB; nb++) { if (pvoie->fb_mess[nb].type == '\0') continue; *(ptmes) = pvoie->fb_mess[nb]; sprintf (s, "F %ld V:%s [%ld]", ptmes->numero, pvoie->sta.indicatif.call, ptmes->taille); fbb_log (voiecur, 'M', s); mark_fwd (voiecur, 0); noprec = 0L; } } init_rec_fwd (voiecur); pvoie->ind_mess = 0; } switch (c) { case 'A': case 'B': /* Recoit FB */ pvoie->chck += checksum (ligne); rcv_fb (voiecur); break; case '>': /* Recoit F> */ if (!is_room ()) { err_new_fwd (1, 15); break; } if (isxdigit (*indd)) { sscanf (indd, "%x", &chck); pvoie->chck += chck; if (pvoie->chck) { err_new_fwd (1, 4); break; } } nb = snd_fs (voiecur); ch_niv3 (3); pvoie->ind_mess = 0; #if FDEBUG if (!svoie[CONSOLE]->connect) cprintf ("Accepte %d messages\n", nb); #endif if (nb == 0) new_fwd (); break; case 'F': /* Recoit FF */ if (pvoie->temp2 == TRUE) { pvoie->ind_mess = -2; if (noprec == mess_suiv (voiecur)) { outln ("FQ", 2); pvoie->deconnect = 6; } else { ch_niv3 (0); env_proposition (); } } else { #if FDEBUG if (!svoie[CONSOLE]->connect) cprintf ("Appel_rev 2\n"); #endif if ((appel_rev_fwd (0)) && (noprec != mess_suiv (voiecur))) { ch_niv3 (0); env_proposition (); } else { outln ("FQ", 2); pvoie->deconnect = 6; } } break; case 'Q': /* recoit FQ Demande deconnection ... */ /* pvoie->deconnect = 6; Wait for remote disconnection (Winlink2000) */ break; default: err_new_fwd (0, 12); break; } } /* envoi forward */ int s_n_fwd (void) { int c; if (*indd == ';') return (0); if ((*indd == '\r') || (*indd == '*')) { mode_ascii (voiecur); pvoie->deconnect = 3; return (0); } if (*indd++ != 'F') { err_new_fwd (0, 5); return (0); } sup_ln (indd); c = *indd; incindd (); switch (c) { case 'F': ch_niv3 (0); env_proposition (); break; case 'S': if (rcv_fs (voiecur)) { ch_niv3 (5); env_message (); } else { ch_niv3 (2); } break; default: err_new_fwd (0, 6); break; } return (1); } /* Proposition de messages FB */ int not_in_fb_mess (long numero, int voie) { int nb = 0; while ((nb < MAX_FB) && (svoie[voie]->fb_mess[nb].type)) { if (svoie[voie]->fb_mess[nb].numero == numero) return (FALSE); nb++; } return (TRUE); } void init_fb_mess (int voie) { int nb; for (nb = 0; nb < MAX_FB; nb++) svoie[voie]->fb_mess[nb].type = '\0'; } static char checksum (char *s) { char chck = 0; while (*s) { chck += *s; ++s; } return (chck); } int check_dupes (int voie, int nb, char *exped, int tst_priv) { int i; for (i = 0; i < nb; i++) { if (strcmp (svoie[voie]->fb_mess[i].exped, exped) == 0) { if ((tst_priv) || (!PRIVATE (svoie[voie]->fb_mess[i].type))) return 1; } } return (0); } int snd_fb (int voie) { int ok = 0, nb; int nb_dupes = 0; int chk_dupes; int no_more = 0; int tst_priv = 1; long max_tfwd = 1024L * (long) p_port[no_port (voie)].maxbloc; char chck = 0; long tail_tmess = 0L; char mode; char s[80]; char *bbs_v; nb = 0; chk_dupes = ((svoie[voie]->typfwd & FWD_DUPES) == 0); init_fb_mess (voie); pactor_ident (); while (nb < MAX_FB) { if (tail_tmess > max_tfwd) break; for (;;) { if (!mess_suiv (voie)) { if ((nb_dupes) && (chk_dupes)) { svoie[voie]->nb_egal -= nb_dupes; nb_dupes = 0; chk_dupes = 0; continue; } else { no_more = 1; break; } } if (chk_dupes) { if ((tst_priv) && (!PRIVATE (svoie[voie]->entmes.type))) { svoie[voie]->nb_egal -= nb_dupes; nb_dupes = 0; tst_priv = 0; continue; } if (svoie[voie]->nb_egal == (NB_DEL - 1)) { svoie[voie]->nb_egal -= nb_dupes; nb_dupes = 0; chk_dupes = 0; continue; } if (!check_dupes (voie, nb, svoie[voie]->entmes.exped, tst_priv)) break; svoie[voie]->mess_egal[svoie[voie]->nb_egal] = svoie[voie]->entmes.numero; ++(svoie[voie]->nb_egal); ++nb_dupes; } else break; } if (no_more) break; if (std_header & 16) { if (*svoie[voie]->entmes.bbsv == '\0') { strcpy (svoie[voie]->entmes.bbsv, mypath); } } if (*(svoie[voie]->entmes.bbsv) == '\0') { strcpy (svoie[voie]->entmes.bbsv, svoie[voie]->sta.indicatif.call); } if ((*(svoie[voie]->entmes.exped)) && (*(svoie[voie]->entmes.bbsv)) && (*(svoie[voie]->entmes.desti)) && (*(svoie[voie]->entmes.bid)) && (ISGRAPH (svoie[voie]->entmes.type))) { svoie[voie]->fb_mess[nb] = svoie[voie]->entmes; if (HIE (svoie[voie]->mode)) bbs_v = svoie[voie]->entmes.bbsv; else bbs_v = bbs_via (svoie[voie]->entmes.bbsv); if (svoie[voie]->prot_fwd & FWD_BIN) mode = 'A'; else mode = 'B'; if ((svoie[voie]->entmes.type == 'A') && (!ACQ (svoie[voie]->mode))) svoie[voie]->entmes.type = 'P'; sprintf (s, "F%c %c %s %s %s %s %ld\r", mode, svoie[voie]->entmes.type, svoie[voie]->entmes.exped, bbs_v, svoie[voie]->entmes.desti, svoie[voie]->entmes.bid, svoie[voie]->entmes.taille); outs (s, strlen (s)); chck += checksum (s); tail_tmess += svoie[voie]->entmes.taille; ++ok; ++nb; } else mark_fwd (voie, 0); } if (ok) { sprintf (s, "F> %02X\r", (-chck) & 0xff); outs (s, strlen (s)); } svoie[voie]->nb_egal -= nb_dupes; return (ok); } /* message a envoyer ou a marquer FS */ int rcv_fs (int voie) { long pos; int c, no = 0, nb = 0; rd_list *ptemp = NULL; char wtexte[256]; sup_ln (indd); libere_tread (voie); while ((c = *indd++) != 0) { if (no >= 5) return (err_new_fwd (0, 7)); svoie[voie]->fb_mess[no].taille = 0L; svoie[voie]->entmes = svoie[voie]->fb_mess[no]; switch (c) { case 'E': #ifdef ENGLISH sprintf (wtexte, "Msg #%ld from %s to %s@%s Bid:%s\rSubject: %s\rFormat error \r", svoie[voie]->entmes.numero, svoie[voie]->entmes.exped, svoie[voie]->entmes.desti, svoie[voie]->entmes.bbsv, svoie[voie]->entmes.bid, svoie[voie]->entmes.titre); if (w_mask & W_ERROR) mess_warning (admin, "*** FORMAT ERROR *** ", wtexte); #else sprintf (wtexte, "Msg #%ld de %s pour %s@%s Bid:%s\rSujet: %s\rErreur de format\r", svoie[voie]->entmes.numero, svoie[voie]->entmes.exped, svoie[voie]->entmes.desti, svoie[voie]->entmes.bbsv, svoie[voie]->entmes.bid, svoie[voie]->entmes.titre); if (w_mask & W_ERROR) mess_warning (admin, "*** ERREUR FORMAT ***", wtexte); #endif mark_fwd (voie, 0); svoie[voie]->fb_mess[no].type = '\0'; break; case 'R': #ifdef ENGLISH sprintf (wtexte, "Msg #%ld from %s to %s@%s Bid:%s\rSubject: %s\rRejected by %s\r", svoie[voie]->entmes.numero, svoie[voie]->entmes.exped, svoie[voie]->entmes.desti, svoie[voie]->entmes.bbsv, svoie[voie]->entmes.bid, svoie[voie]->entmes.titre, svoie[voie]->sta.indicatif.call); if (w_mask & W_REJECT) mess_warning (admin, "*** REJECTED MAIL *** ", wtexte); #else sprintf (wtexte, "Msg #%ld de %s pour %s@%s Bid:%s\rSujet: %s\rRejete par %s \r", svoie[voie]->entmes.numero, svoie[voie]->entmes.exped, svoie[voie]->entmes.desti, svoie[voie]->entmes.bbsv, svoie[voie]->entmes.bid, svoie[voie]->entmes.titre, svoie[voie]->sta.indicatif.call); if (w_mask & W_REJECT) mess_warning (admin, "*** COURRIER REJETE ***", wtexte); #endif mark_fwd (voie, 'R'); svoie[voie]->fb_mess[no].type = '\0'; break; case 'H': #ifdef ENGLISH sprintf (wtexte, "Msg #%ld from %s to %s@%s Bid:%s\rSubject: %s\rHeld by %s \r", svoie[voie]->entmes.numero, svoie[voie]->entmes.exped, svoie[voie]->entmes.desti, svoie[voie]->entmes.bbsv, svoie[voie]->entmes.bid, svoie[voie]->entmes.titre, svoie[voie]->sta.indicatif.call); if (w_mask & W_HOLD) mess_warning (admin, "*** HELD MAIL *** ", wtexte); #else sprintf (wtexte, "Msg #%ld de %s pour %s@%s Bid:%s\rSujet: %s\rRetenu par %s\r", svoie[voie]->entmes.numero, svoie[voie]->entmes.exped, svoie[voie]->entmes.desti, svoie[voie]->entmes.bbsv, svoie[voie]->entmes.bid, svoie[voie]->entmes.titre, svoie[voie]->sta.indicatif.call); if (w_mask & W_HOLD) mess_warning (admin, "*** COURRIER RETENU ***", wtexte); #endif if (ptemp) { ptemp->suite = (rd_list *) m_alloue (sizeof (rd_list)); ptemp = ptemp->suite; } else { ptemp = (rd_list *) m_alloue (sizeof (rd_list)); svoie[voie]->t_read = ptemp; } ptemp->suite = NULL; ptemp->nmess = svoie[voie]->fb_mess[no].numero; ptemp->pmess = &(svoie[voie]->fb_mess[no]); ptemp->verb = 1; ++nb; break; case 'N': case '-': mark_fwd (voie, 0); svoie[voie]->fb_mess[no].type = '\0'; break; case 'L': case '=': svoie[voie]->fb_mess[no].type = '\0'; svoie[voie]->mess_egal[svoie[voie]->nb_egal] = svoie[voie]->fb_mess[no].numero; ++(svoie[voie]->nb_egal); break; case 'A': case '!': pos = 0; while (isdigit (*indd)) { pos *= 10; pos += *indd - '0'; ++indd; } svoie[voie]->fb_mess[no].taille = pos; case 'Y': case '+': if (ptemp) { ptemp->suite = (rd_list *) m_alloue (sizeof (rd_list)); ptemp = ptemp->suite; } else { ptemp = (rd_list *) m_alloue (sizeof (rd_list)); svoie[voie]->t_read = ptemp; } ptemp->suite = NULL; ptemp->nmess = svoie[voie]->fb_mess[no].numero; ptemp->pmess = &(svoie[voie]->fb_mess[no]); ptemp->verb = 1; ++nb; break; default: return (err_new_fwd (0, 8)); } ++no; } if (no != pvoie->ind_mess) { return (err_new_fwd (0, 9)); } if (nb) { svoie[voie]->enrcur = 0L; if (svoie[voie]->prot_fwd & FWD_BIN) mode_binaire (voie); return (1); /* return(snd_mess(voie, 1)) ; */ } return (0); } /* marquage d'un message par son id */ void mark_fwd (int voie, char mode) { /**************** ESSAI ******************/ switch (mode) { case 'R': sup_fwd (svoie[voie]->entmes.numero, FALSE, svoie[voie]->bbsfwd); break; case '\0': if ((svoie[voie]->entmes.status == '$') || (multi_prive)) sup_fwd (svoie[voie]->entmes.numero, TRUE, svoie[voie]->bbsfwd); else sup_fwd (svoie[voie]->entmes.numero, TRUE, 0); break; } svoie[voie]->entmes.type = '\0'; } int addr_check (char *s) { char *str = s; int nb = 0; while (*s) { if (*s == '.') { if (std_header & 2) nb = -10; else nb = 0; } else { if (nb == 6) { if (!(FOR (pvoie->mode))) { n_cpy (40, varx[0], str); texte (T_ERR + 17); } return (0); } ++nb; } ++s; } return (1); } int is_bid (char *bid) { char *ptr = bid; strupr (bid); if ((strlen (bid)) > 12) return (0); if (*bid == ' ') return (1); while (*bid) { if (ISGRAPH (*bid)) { *ptr++ = *bid; } ++bid; } *ptr = '\0'; return (1); } /* Marque un BID propose comme forwarde en retour */ void mark_reverse_bid (bullist * fb_mess, int nb, int *t_res) { int i; int pos; FILE *fptr; int nobbs = 0; bidfwd fwbid; bullist bul; mess_noeud *lptr; nobbs = svoie[voiecur]->bbsfwd; for (i = 0; i < nb; i++) { if (t_res[i] != 1) continue; pos = search_bid (fb_mess[i].bid); /* TESTER SI LE MESSAGE EST A FORWARDER POUR LA DIRECTION !! */ if (pos) { fptr = fopen (d_disque ("WFBID.SYS"), "r+b"); if (fptr == NULL) return; fseek (fptr, (long) pos * sizeof (bidfwd), 0); fread (&fwbid, sizeof (fwbid), 1, fptr); fclose (fptr); if ((lptr = findmess (fwbid.numero)) != NULL) { ouvre_dir (); read_dir (lptr->noenr, &bul); /* Marque le message F s'il etait a forwarder vers nobbs */ if (already_forw (bul.fbbs, nobbs)) sup_fwd (fwbid.numero, 1, nobbs); ferme_dir (); } } } } static int is_invalid (char *champ, int nb, int mode) { int error = 0; char *str = champ; char last = '\0'; while (*champ) { last = *champ; if (--nb >= 0) { if (!ISGRAPH (*champ)) { error = 1; break; } switch (mode) { case 1: if ((*champ == '@') || (*champ == '.')) error = 1; break; case 2: if (*champ == '@') error = 1; break; } if (error) break; } champ++; } if ((mode == 2) && ((std_header & 2) == 0) && (last == '.')) error = 1; if (nb < 0) error = 2; if (error) { char s[80]; sprintf (s, "Error in field (%s)\r", str); aff_bas (voiecur, W_CNST, s, strlen (s)); } return (error); } int rcv_fb (int voie) { int nb, i; char exped[80]; char desti[80]; char bbsv[80]; char bid[80]; bullist *mptr = &(svoie[voie]->fb_mess[svoie[voie]->ind_mess]); if (svoie[voie]->ind_mess >= 5) err_new_fwd (0, 10); for (i = 0; i < NBMASK; i++) mptr->fbbs[i] = mptr->forw[i] = '\0'; indd[80] = '\0'; nb = sscanf (indd, "%c %79s %79s %79s %79s %ld", &(mptr->type), exped, bbsv, desti, bid, &(mptr->taille)); if ((is_invalid (exped, 6, 1)) || (is_invalid (bbsv, 31, 2)) || (is_invalid (desti, 6, 1)) || (is_invalid (bid, 12, 0)) || (!is_bid (bid)) || (nb < 6)) { mptr->type = '\0'; } else { strcpy (mptr->exped, exped); strcpy (mptr->desti, desti); strcpy (mptr->bbsv, bbsv); strcpy (mptr->bid, bid); } ++svoie[voie]->ind_mess; if (!addr_check (mptr->bbsv)) { mptr->type = '\0'; return (0); } return (1); } int snd_fs (int voie) { int nb, total = 0; char chaine[80]; char s[80]; int t_res[MAX_FB]; char *ptr = chaine; char *tptr; pvoie->tailm = 0L; *ptr++ = 'F'; *ptr++ = 'S'; *ptr++ = ' '; for (nb = 0; nb < MAX_FB; nb++) t_res[nb] = 0; deja_recu (svoie[voie]->fb_mess, svoie[voie]->ind_mess, t_res); if (pvoie->fbb == 2) part_recu (svoie[voie]->fb_mess, svoie[voie]->ind_mess, t_res); for (nb = 0; nb < svoie[voie]->ind_mess; nb++) { niveau = nb; svoie[voie]->entmes = svoie[voie]->fb_mess[nb]; if (svoie[voie]->entmes.type == '\0') { if (pvoie->fbb == 2) t_res[nb] = 6; else t_res[nb] = 2; } if ((svoie[voie]->rev_mode == 0) && (t_res[nb] == 0)) t_res[nb] = 2; switch (t_res[nb]) { case 0: if (svoie[voie]->fbb >= 2) *ptr++ = 'Y'; /* Pas encore recu */ else *ptr++ = '+'; /* Pas encore recu */ ++total; break; case 1: if (svoie[voie]->fbb >= 2) *ptr++ = 'N'; /* Pas encore recu */ else *ptr++ = '-'; /* Deja recu */ sprintf (s, "N B:%s V:%s", svoie[voie]->entmes.bid, svoie[voie]->sta.indicatif.call); fbb_log (voie, 'M', s); svoie[voie]->fb_mess[nb].type = '\0'; break; case 2: if (svoie[voie]->fbb >= 2) *ptr++ = 'L'; /* Pas encore recu */ else *ptr++ = '='; /* En cours de reception -> differe */ svoie[voie]->fb_mess[nb].type = '\0'; break; case 3: if (svoie[voie]->fbb >= 2) *ptr++ = 'A'; /* Pas encore recu */ else *ptr++ = '!'; /* En partie recu. Demande la fin */ sprintf (s, "%ld", svoie[voie]->fb_mess[nb].taille); tptr = s; while (*tptr) *ptr++ = *tptr++; ++total; break; case 4: *ptr++ = 'R'; /* Rejete */ sprintf (s, "J B:%s V:%s", svoie[voie]->entmes.bid, svoie[voie]->sta.indicatif.call); fbb_log (voie, 'M', s); svoie[voie]->fb_mess[nb].type = '\0'; break; case 5: *ptr++ = 'H'; /* Retenu */ sprintf (s, "H B:%s V:%s", svoie[voie]->entmes.bid, svoie[voie]->sta.indicatif.call); fbb_log (voie, 'M', s); ++total; break; case 6: *ptr++ = 'E'; /* Erreur */ svoie[voie]->fb_mess[nb].type = '\0'; break; } } for (nb = svoie[voie]->ind_mess; nb < MAX_FB; nb++) svoie[voie]->fb_mess[nb].type = '\0'; *ptr = '\0'; outln (chaine, strlen (chaine)); send_buf (voie); mark_reverse_bid (svoie[voie]->fb_mess, svoie[voie]->ind_mess, t_res); if ((total) && (svoie[voie]->prot_fwd & FWD_BIN)) mode_binaire (voie); return (total); } int err_new_fwd (int no, int code) { static char cause[][80] = { "Binary packet is not of header (HD) type in title.", "Checsum of message is wrong.", "Message could not be uncompressed (CRC Error).", "Received binary frame is not DATA (DT), not EOT (ET).", "Checsum of proposals is wrong.", "Answer to proposals must start with \"F\" or \"**\".", "Answer to proposals must be either \"FF\" not \"FS\".", "More than 5 answers (with \"+\", \"-\" or \"=\") to proposals.", "Answer to proposal is not \"+\", \"-\" or \"=\".", "The number of answers does not match the number of proposals.", "More than 5 proposals have been received.", "The number of fields in a proposal is wrong (6 fields).", "Command must be \"FA\", \"FB\", \"F>\", \"FF\" or \"FQ\".", "Line starting with a letter which is not \"F\" or \"*\".", "Binary file has been changed.", "Disk full.", "Unknown protocol error." }; static char chaine[2][24] = { "*** Protocol error: %s", "*** Checksum error (%s)" }; char temp[250]; df ("err_new_fwd", 2); mode_ascii (voiecur); if (code > 16) code = 16; sprintf (temp, chaine[no], cause[code]); outln (temp, strlen (temp)); aff_etat ('E'); send_buf (voiecur); pvoie->deconnect = 3; ff (); return (0); } void init_rec_fwd (int voie) { int nb; pvoie->chck = 0; for (nb = 0; nb < MAX_FB; nb++) svoie[voie]->fb_mess[nb].type = '\0'; } static int bloc_message (int voie) { int i, nb = 0; FILE *fptr; char chaine[258]; unsigned mode; char *ptr; rd_list *ptemp = svoie[voie]->t_read; mode = (svoie[voie]->binary) ? O_BINARY : O_TEXT; if ((fptr = ouvre_mess (mode, ptemp->nmess, '\0')) != NULL) { fseek (fptr, svoie[voie]->enrcur, 0); fflush (fptr); while ((nb = read (fileno (fptr), chaine + 2, 250)) > 0) // while ((nb = read (fileno (fptr), chaine + 2, 256)) > 0) { if (nb) { if (svoie[voie]->binary) { chaine[0] = STX; chaine[1] = (nb == 256) ? 0 : nb; ptr = chaine + 2; for (i = 0; i < nb; i++) svoie[voie]->chck += *ptr++; outs (chaine, nb + 2); ptemp->pmess->taille += (long) (nb + 2); } else { outs (chaine + 2, nb); } } if (pvoie->memoc >= MAXMEM) { svoie[voie]->enrcur = ftell (fptr); break; } } ferme (fptr, 45); } else { /* Incident : Le message a ete supprime sur un autre voie. deconnection !! */ pvoie->deconnect = 6; return (1); } if (nb == 0) { if (svoie[voie]->binary) sendeot (-svoie[voie]->chck); else ctrl_z (); svoie[voie]->t_read = ptemp->suite; m_libere (ptemp, sizeof (rd_list)); svoie[voie]->enrcur = 0L; svoie[voie]->tailm = 0L; } return (nb); } static void bin_hdr (char *header, long pos) { int nb = 2; unsigned char buf[257]; unsigned char *ptr = buf; *ptr++ = SOH; ++ptr; strcpy (ptr, header); while (*ptr++) ++nb; sprintf (ptr, "%6ld", pos); while (*ptr++) ++nb; buf[1] = nb; outs (buf, nb + 2); pvoie->chck = 0; } int bin_message (rd_list * ptemp) /* Envoie un message */ { int i, nb = 0; char chaine[258]; FILE *fptr; char *ptr; pvoie->seq = 0; pvoie->sr_mem = 1; if (pvoie->enrcur == 0L) { pvoie->entmes = *(ptemp->pmess); if (pvoie->binary) { if (pvoie->fbb == 2) { if (pvoie->entmes.taille) { bin_hdr (pvoie->entmes.titre, pvoie->entmes.taille); if ((fptr = ouvre_mess (O_BINARY, pvoie->entmes.numero, '\0')) != NULL) { fflush (fptr); nb = read (fileno (fptr), chaine + 2, 6); ferme (fptr, 45); pvoie->enrcur = pvoie->entmes.taille; if (nb) { if (pvoie->binary) { chaine[0] = STX; chaine[1] = nb; ptr = chaine + 2; for (i = 0; i < nb; i++) pvoie->chck += *ptr++; outs (chaine, nb + 2); } /* Remet le compteur d'octets envoyes a 0 */ pvoie->entmes.taille = 0L; } else return (err_new_fwd (0, 14)); } else return (err_new_fwd (0, 14)); } else { pvoie->enrcur = 0L; bin_hdr (pvoie->entmes.titre, pvoie->entmes.taille); } } else { pvoie->enrcur = 2L; bin_hdr (pvoie->entmes.titre, pvoie->entmes.taille); } } else { entete_fwd (voiecur); } } if (bloc_message (voiecur)) return (1); pvoie->sr_mem = 0; return (0); } /* Envoie les messages ASCII de la liste */ int snd_mess (int voie, int type) { char header[160]; rd_list *ptemp; svoie[voie]->seq = 0; svoie[voie]->sr_mem = 1; while ((ptemp = svoie[voie]->t_read) != NULL) { if (trait_time > MAXTACHE) { svoie[voie]->seq = 1; return (1); } if (svoie[voie]->enrcur == 0L) { svoie[voie]->entmes = *(ptemp->pmess); if (svoie[voie]->binary) { bin_hdr (svoie[voie]->entmes.titre, 0L); make_header (&(svoie[voie]->entmes), header); entete_mess_fwd (&(svoie[voie]->entmes), header); } else { if (type == 2) entete_envoi_fwd (voie); entete_fwd (voie); } } if (bloc_message (voie)) return (1); tst_warning (ptmes); } svoie[voie]->sr_mem = 0; return (0); } fbb-7.04j/src/pac_crc.c0100644000175100017510000000710607726646105012750 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * File transfer protocol "TransIt" * Version 2.00 * Copyright (C) 1987-1989 by ASCII Corporation. * * * crc.c - CRC-16 calculate routine (table look-up) * * cumtomized for mabTerm with LSIC Ver.2.10 * by Jun Mabuchi (pcs24862, msx01508 mab) */ /* CRC table */ static short crc_table[] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 }; unsigned short calc_crc(unsigned char c, unsigned short crc) { unsigned short hi1, hi2; hi1 = ((crc >> 8) & 0xff); hi2 = ((crc & 0xff) << 8); return ((crc_table[hi1 ^ c] ^ hi2)); } fbb-7.04j/src/pacsat.c0100644000175100017510000006672007726646105012640 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* pbdir.c 1993.8.6 */ #ifdef __LINUX__ #define __a1__ __attribute__ ((packed, aligned(1))) #else #define __a1__ #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef OLD_AX25 #include #else #include #endif #define PFH_MSG 1 #define PFH_FILE 2 static BOOL f_beacon = OFF; static struct stqueue actuser; static struct stqueue freeuser; static struct stqueue freehole; static char rkss[FRMSIZE]; static ushort chck; static ushort crc; static struct stuser user[MAXUSER]; static struct sthole hole[MAXHOLE]; static long tim_0; static long tim_1; static long tim_2; static long tim_3; static int baud; typedef struct full_sockaddr_ax25 fs_ax25; static BOOL f_rkss; /* pbsv.c */ static int lnrkss; static struct stpfhdir pfhdir[MAXPFHDIR]; static char pac_call[12]; static char pac_port[12]; static int npfhdir; static int msock = -1; /* Rx monitoring socket */ static int pacsat; static long to_empty; static long to_user; #ifdef PACDBG static void dispdir (void); #endif static int add_buf (char *buf, void *data, int nb); static uchar send_pfh (int dirent, int block_size); static int req_dir (char *callsign); static int pfhstat ( char *name, struct stpfh *pfh); static void initq (struct stqueue *q); static void putq (struct stqueue *q, struct stqcell *d); static struct stqcell *getq (struct stqueue *q); static void delq (struct stqueue *q, struct stqcell *d); static void timer (void); static void pblist (int ctl); static void qst (void); static void qst_dir (struct stuser *user); static void qst_bul (struct stuser *user); static void rcvreq (void); static void res_msg (char *callsign, int errorcode); static int findfile (int id); static int compare (struct stpfhdir *d1, struct stpfhdir *d2); static int req_bul (char *callsign); static void set_user (struct stuser *user, char *callsign, long file_id, ushort block_size); static void add_hole (struct stuser *user, long offset, ushort length); static struct stuser *sch_user (char *callsign); static void del_user (struct stuser *user); static int add_struct (char *buf, int id, void *data, int lg_data); static int pfh_msg (FILE * fpth, long numero); static int mk_pfh (char *buf, bullist * pbul, long numero); static int mk_pfh_file (long numero, int type); static char *dlname (long numero); static void rm_pfh_file (long numero); static int add_crc (char *buf, int nb); static void snd_pac (char *desti, char *buf, int len, int pid); static int rcvkss (void); #ifdef OLD_AX25 static char *ax2ascii (char *call); #else static char *ax25_ntoaii (char *call); #endif void pbsv (void) { if (pacsat == 0) return; timer (); while (rcvkss ()) rcvreq (); qst (); pblist (0); } #define TIME(x) ((((long)(x)) << 16) / 3600L) void init_pac (void) { FILE *fptr; char buf[256]; char *av1, *av2; printf ("Reading configuration file init.pac\n"); if ((fptr = fopen ("init.pac", "r")) == NULL) { pacsat = 0; return; } /* Default values */ strcpy (pac_call, mycall); if (myssid) { sprintf (pac_call + strlen (pac_call), "-%d", myssid); } n_cpy (10, pac_port, p_port[1].name); to_empty = TIME (2); to_user = TIME (10); baud = 1200; while (fgets (buf, 128, fptr) != NULL) { av1 = strtok (buf, " \t\r\n"); strupr (av1); if (av1 == NULL) continue; av2 = strtok (NULL, " \t\r\n"); if (av2 == NULL) continue; if (strcmp (av1, "CALLSIGN") == 0) { strupr (av2); n_cpy (10, pac_call, av2); } else if (strcmp (av1, "PORT") == 0) { n_cpy (10, pac_port, av2); } else if (strcmp (av1, "USER") == 0) { to_user = TIME (atoi (av2)); printf ("User time-out = %s sec\n", av2); } else if (strcmp (av1, "EMPTY") == 0) { to_empty = TIME (atoi (av2)); printf ("PB empty time-out = %s sec\n", av2); } else if (strcmp (av1, "BAUD") == 0) { baud = atoi (av2); printf ("Baud rate = %d\n", baud); } } fclose (fptr); printf ("Broadcast callsign [%s]\n", pac_call); printf ("Broadcast port [%s]\n", pac_port); pacsat = 1; } /* * < initdir > initialize directory entry * Opens dirmes.sys and initialises the PFH list */ int init_pfh (void) { bloc_mess *bptr = tete_dir; mess_noeud *mptr; int offset; bullist bul; int i; FILE *fptr; init_pac (); if (pacsat == 0) return 0; initq (&actuser); initq (&freeuser); for (i = 0; i < MAXUSER; i++) putq (&freeuser, (struct stqcell *)&user[i]); initq (&freehole); for (i = 0; i < MAXHOLE; i++) putq (&freehole, (struct stqcell *)&hole[i]); npfhdir = 0; ouvre_dir (); offset = 0; while (bptr) { mptr = &(bptr->st_mess[offset]); if (mptr->noenr) { read_dir (mptr->noenr, &bul); if ((bul.status != 'K') && (bul.status != 'A') && (npfhdir < MAXPFHDIR)) { pfhdir[npfhdir].t_new = bul.date; pfhdir[npfhdir].file_id = bul.numero; pfhdir[npfhdir].pfh_type = PFH_MSG; npfhdir++; } } if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } } ferme_dir (); /* Idem for YAPPLBL.DAT */ fptr = fopen (d_disque ("YAPPLBL.DAT"), "rb"); if (fptr) { Rlabel rlabel; while (fread (&rlabel, sizeof (Rlabel), 1, fptr)) { if ((*rlabel.nomfic) && (npfhdir < MAXPFHDIR)) { pfhdir[npfhdir].t_new = rlabel.date_creation; pfhdir[npfhdir].file_id = rlabel.index; pfhdir[npfhdir].pfh_type = PFH_FILE; npfhdir++; } } fclose (fptr); } qsort (&pfhdir[0], npfhdir, sizeof (struct stpfhdir), (int (*)(const void *, const void *))compare); pfhdir[0].t_old = 0; for (i = 1; i < npfhdir; i++) { pfhdir[i].t_old = pfhdir[i - 1].t_new + 1; } #ifdef PACDBG dispdir (); #endif if (fbb_ax25_config_load_ports () == 0) fprintf (stderr, "no AX.25 port data configured\n"); /* Creates RX monitoring socket */ if ((msock = socket (AF_INET, SOCK_PACKET, htons (ETH_P_AX25))) == -1) { perror ("pacsat socket_monitoring"); } else { /* Non blocking socket */ int ioc = 1; ioctl (msock, FIONBIO, &ioc); } return (npfhdir); } void add_pfh (bullist * pbul) { if (pacsat == 0) return; if ((pbul->status != 'K') && (pbul->status != 'A') && (npfhdir < MAXPFHDIR)) { if (npfhdir) pfhdir[npfhdir].t_old = pfhdir[npfhdir - 1].t_new + 1; else pfhdir[npfhdir].t_old = 0; pfhdir[npfhdir].t_new = pbul->date; pfhdir[npfhdir].file_id = pbul->numero; send_pfh (npfhdir, MAXBLKSIZE); npfhdir++; } } static int compare (struct stpfhdir *d1, struct stpfhdir *d2) { if (d1->t_new == d2->t_new) { return (0); } else if ((u_long) d1->t_new > (u_long) d2->t_new) { return (1); } else { return (-1); } } #ifdef PACDBG /* * < dispdir > display directory */ static void dispdir (void) { int i; for (i = 0; i < npfhdir; i++) { printf (" %4d %lu,%lu %lX %d\n", i, pfhdir[i].t_old, pfhdir[i].t_new, pfhdir[i].file_id, pfhdir[i].pfh_size); } } #endif static int add_buf (char *buf, void *data, int nb) { memcpy (buf, data, nb); return (nb); } /* * < send_pfh > send PFH */ static uchar send_pfh (int dirent, int block_size) { char buf[256]; char out[256]; char *pbuf; uchar flags; int psize, size, nb; long file_id, offset; file_id = pfhdir[dirent].file_id; psize = mk_pfh (buf, NULL, file_id); flags = 0x00; if ((dirent + 1) == npfhdir) flags |= 0x40; offset = 0; for (;;) { size = psize - offset; if (size <= block_size) { flags |= 0x20; } else { size = block_size; } pbuf = buf + offset; nb = 0; nb += add_buf (&out[nb], &flags, 1); nb += add_buf (&out[nb], &file_id, 4); nb += add_buf (&out[nb], &offset, 4); nb += add_buf (&out[nb], &pfhdir[dirent].t_old, 4); nb += add_buf (&out[nb], &pfhdir[dirent].t_new, 4); nb += add_buf (&out[nb], pbuf, size); nb = add_crc (out, nb); snd_pac ("QST-1", out, nb, 0xbd); if (flags & 0x20) { break; } offset += size; } return (flags); } /* * < req_dir > request directory */ static int req_dir (char *callsign) { u_char flags; ushort block_size; struct stuser *user; struct sthole *hole; time_t start, end; int i; i = HDRSIZE; flags = rkss[i]; i += 1; memcpy (&block_size, &rkss[i], 2); i += 2; user = (struct stuser *) getq (&freeuser); if (user == NULL) { return (-1); /* queue full */ } user->entry_t = time (NULL); user->flags = F_DIR; strcpy (user->call, callsign); user->block_size = block_size; initq (&user->hole); putq (&actuser, (struct stqcell *)user); for (; i < lnrkss; i += (4 + 4)) { memcpy (&start, &rkss[i], 4); memcpy (&end, &rkss[i + 4], 4); hole = (struct sthole *) getq (&freehole); if (hole == NULL) break; hole->start = start; hole->end = end; putq (&user->hole, (struct stqcell *)hole); } return (0); /* OK */ } /* * < pfhstat > PFH stat */ static int pfhstat ( char *name, struct stpfh *pfh) { FILE *fp; int c, i, s, length; char data[256]; ushort id; s = 0; if ((fp = fopen (name, "rb")) == NULL) { return (-1); } c = fgetc (fp); s++; id = (c << 8); c = fgetc (fp); s++; id |= c; if (id != 0xaa55) { /* PFH check ? */ fclose (fp); return (-1); } for (;;) { c = fgetc (fp); if (c == EOF) break; id = c; c = fgetc (fp); id |= (c << 8); c = fgetc (fp); length = c; s += 3; if (id == 0 && length == 0) /* termination ? */ break; for (i = 0; i < length; i++) { data[i] = fgetc (fp); s++; } switch (id) { case 0x04: memcpy (&pfh->file_size, data, 4); break; case 0x08: pfh->file_type = data[0]; break; case 0x0b: memcpy (&pfh->body_offset, data, 2); break; default: break; } } fclose (fp); pfh->pfh_size = s; return (0); } /* * < initq > initialize queue */ static void initq (struct stqueue *q) { q->head = q->tail = NULL; } /* * < putq > put queue */ static void putq (struct stqueue *q, struct stqcell *d) { if (q == NULL || d == NULL) { assert (0); } d->next = NULL; if (q->head == NULL) { q->head = q->tail = d; } else { q->tail->next = d; q->tail = d; } } /* * < getq > get queue */ static struct stqcell *getq (struct stqueue *q) { struct stqcell *r; if (q == NULL) { assert (0); } r = q->head; if (r != NULL) { q->head = r->next; } if (q->head == NULL) { q->tail = NULL; } return (r); } /* * < delq > delete queue */ static void delq (struct stqueue *q, struct stqcell *d) { struct stqcell *d2; struct stqueue temp; initq (&temp); while ((d2 = getq (q)) != NULL) { if (d2 != d) { putq (&temp, d2); } } *q = temp; } /* * < timer > timer */ static void timer (void) { static long t1; long clk, t; clk = btime (); t = clk - t1; t1 = clk; if ((u_long) tim_0 > (u_long) t) { tim_0 -= t; } else tim_0 = 0; if ((u_long) tim_1 > (u_long) t) { tim_1 -= t; } else tim_1 = 0; if ((u_long) tim_2 > (u_long) t) { tim_2 -= t; } else tim_2 = 0; t *= 100; if ((u_long) tim_3 > (u_long) t) { tim_3 -= t; } else tim_3 = 0; } /* * < pblist > PB list */ static void pblist (int ctl) { VOID add_kss (char *, int); char buf[256]; int n; struct stuser *user; if (f_beacon) { f_beacon = OFF; tim_0 = 0; } if (ctl == 1) tim_0 = 0; else { if (tim_0 != 0 || actuser.head != NULL) return; } if (tim_0 != 0) return; tim_0 = to_empty; strcpy (buf, "PB:"); user = (struct stuser *) actuser.head; n = 0; if (user == NULL) { strcat (buf, " Empty."); } else { while (user != NULL) { strcat (buf, " "); strcat (buf, user->call); if (user->flags & F_DIR) strcat (buf, "\\D"); user = user->next; n++; } } strcat (buf, "\r"); snd_pac ("PBLIST", buf, strlen (buf), 0xf0); } /* * < qst > */ static void qst (void) { struct stuser *user; if (actuser.head == NULL) return; if (tim_3) { return; } pblist (1); user = (struct stuser *) getq (&actuser); /* check time over ? */ if ((time (NULL) - user->entry_t) > to_user) { del_user (user); return; } if (user->flags & F_DIR) { qst_dir (user); } else { qst_bul (user); } if (user->hole.head == NULL) { putq (&freeuser, (struct stqcell *)user); /* Termine... Supprime le fichier si pas utilise */ rm_pfh_file (user->file_id); } else { putq (&actuser, (struct stqcell *)user); } if (actuser.head == NULL) { pblist (1); } } /* * < qst_dir > directory */ static void qst_dir (struct stuser *user) { struct sthole *hole; u_char flags; int i, j, dirent; int nb_blk = (baud / 600); if (nb_blk > 10) nb_blk = 10; for (i = 0; i < nb_blk; i++) { hole = (struct sthole *) user->hole.head; if (hole == NULL) break; dirent = npfhdir - 1; for (j = 0; j < npfhdir; j++) { if ((u_long) hole->start >= (u_long) pfhdir[j].t_old && (u_long) hole->start <= (u_long) pfhdir[j].t_new) { dirent = j; break; } } flags = send_pfh (dirent, user->block_size); hole->start = pfhdir[dirent].t_new + 1; if ((u_long) hole->start > (u_long) hole->end || (flags & 0x40)) { /* hole delete ? */ hole = (struct sthole *) getq (&user->hole); putq (&freehole, (struct stqcell *)hole); } } } /* * < qst_bul > */ static void qst_bul (struct stuser *user) { struct sthole *hole; char name[128]; char buf[256]; char out[256]; FILE *fp; char flags, file_type; long file_id, offset; int i; int nb; int size; int nb_blk = (baud / 600); if (nb_blk > 10) nb_blk = 10; file_id = user->file_id; file_type = user->file_type; strcpy (name, dlname (file_id)); if ((fp = fopen (name, "rb")) == NULL) { printf ("QST-1 file[%s] open error\n", name); exit (1); } flags = 0x02; for (i = 0; i < nb_blk; i++) { hole = (struct sthole *) user->hole.head; if (hole == NULL) { break; } offset = hole->offset; if (user->block_size > hole->length) { size = hole->length; } else { size = user->block_size; } hole->offset += (long) size; hole->length -= size; if (hole->length == 0) { hole = (struct sthole *) getq (&user->hole); putq (&freehole, (struct stqcell *)hole); } fseek (fp, offset, SEEK_SET); fread (buf, size, 1, fp); nb = 0; nb += add_buf (&out[nb], &flags, 1); nb += add_buf (&out[nb], &file_id, 4); nb += add_buf (&out[nb], &file_type, 1); nb += add_buf (&out[nb], &offset, 3); nb += add_buf (&out[nb], buf, size); nb = add_crc (out, nb); snd_pac ("QST-1", out, nb, 0xbb); } fclose (fp); } /* * < rcvreq > receive request */ static void rcvreq (void) { char callsign[12]; int r; u_char pid; if (!f_rkss) return; f_rkss = OFF; if (lnrkss <= HDRSIZE) return; pid = rkss[HDRSIZE - 1] & 0xff; #ifdef OLD_AX25 /* Verify if the request is for me */ if (strcmp (pac_call, ax2ascii (rkss + 1)) != 0) #else if (strcmp (pac_call, ax25_ntoaii (rkss + 1)) != 0) #endif { return; } #ifdef OLD_AX25 strcpy (callsign, ax2ascii (rkss + 1 + ADRSIZE)); #else strcpy (callsign, ax25_ntoaii (rkss + 1 + ADRSIZE)); #endif del_user (sch_user (callsign)); switch (pid) { case 0xbb: /* pid = bb */ r = req_bul (callsign); break; case 0xbd: /* pid = bd */ r = req_dir (callsign); break; default: return; } res_msg (callsign, r); } /* * < res_msg > response messages */ static void res_msg (char *callsign, int errorcode) { char buf[64]; if (errorcode == 0) { sprintf (buf, "OK %s\r", callsign); } else { sprintf (buf, "NO %d %s\r", errorcode, callsign); } snd_pac (callsign, buf, strlen (buf), 0xf0); } static int findfile (int id) { FILE *fptr; Rlabel rlabel; int ret = -1; int record = 0; /* Seach file in the existing labels */ if ((fptr = fopen (d_disque ("YAPPLBL.DAT"), "rb")) == NULL) return (ret); while (fread (&rlabel, sizeof (Rlabel), 1, fptr)) { if ((*rlabel.nomfic) && (rlabel.index == id)) { ret = record; break; } ++record; } fclose (fptr); return (ret); } /* * < req_bul > request */ static int req_bul (char *callsign) { uchar flags; long file_id, offset; ushort block_size, length; int i; int file_type; struct stuser *user; i = HDRSIZE; flags = rkss[i]; i += 1; memcpy (&file_id, &rkss[i], 4); i += 4; memcpy (&block_size, &rkss[i], 2); i += 2; if (findmess (file_id) == NULL) { /* Not a msg... Is it a file ? */ if (findfile (file_id) != -1) { file_type = PFH_FILE; } else { /* None exist */ return (-2); } } else { file_type = PFH_MSG; } user = (struct stuser *) getq (&freeuser); if (user == NULL) { return (-1); /* queue full */ } /* Create the DL file */ if (mk_pfh_file (file_id, file_type) == 0) return (-2); if (access (dlname (file_id), 00) != 0) { /* DL file exist ? */ return (-2); /* file does not exist */ } switch (flags & 0x03) { case 0x00: /* start */ set_user (user, callsign, file_id, block_size); offset = 0; length = block_size * 10; for (i = 0; i < 10; i++) { add_hole (user, offset, length); offset += length; } break; case 0x01: /* stop */ break; case 0x02: /* hole list */ set_user (user, callsign, file_id, block_size); for (; i < lnrkss; i += (3 + 2)) { offset = 0; memcpy (&offset, &rkss[i], 3); memcpy (&length, &rkss[i + 3], 2); add_hole (user, offset, length); } break; default: return (-4); /* debug */ break; } return (0); /* OK */ } /* * < set_user > set user list */ static void set_user (struct stuser *user, char *callsign, long file_id, ushort block_size) { struct stat sbuf; struct stpfh pfh; char pathname[128]; strcpy (pathname, dlname (file_id)); stat (pathname, &sbuf); pfhstat (pathname, &pfh); user->entry_t = time (NULL); user->flags = 0x0000; strcpy (user->call, callsign); user->file_id = file_id; user->file_type = pfh.file_type; user->file_size = sbuf.st_size; if (block_size > MAXBLKSIZE) { /* block size adjust */ user->block_size = MAXBLKSIZE; } else { user->block_size = block_size; } initq (&user->hole); putq (&actuser, (struct stqcell *)user); } /* * < add_hole > */ static void add_hole (struct stuser *user, long offset, ushort length) { struct sthole *hole; if (offset >= user->file_size) return; if (offset + length > user->file_size) /* adjust */ length = user->file_size - offset; hole = (struct sthole *) getq (&freehole); if (hole == NULL) { assert (0); } hole->offset = offset; hole->length = length; putq (&user->hole, (struct stqcell *)hole); } /* * < sch_user > search user */ static struct stuser *sch_user (char *callsign) { struct stuser *user; user = (struct stuser *) actuser.head; while (user) { if (strcmp (user->call, callsign) == 0) { break; } user = (struct stuser *) user->next; } return (user); } /* * < del_user > delete user */ static void del_user (struct stuser *user) { struct sthole *hole; if (user == NULL) return; while ((hole = (struct sthole *) getq (&user->hole)) != NULL) { putq (&freehole, (struct stqcell *)hole); } delq (&actuser, (struct stqcell *)user); putq (&freeuser, (struct stqcell *)user); } static int add_struct (char *buf, int id, void *data, int lg_data) { *buf++ = id & 0xff; *buf++ = id >> 8; *buf++ = lg_data; memcpy (buf, data, lg_data); lg_data += 3; return (lg_data); } static int pfh_msg (FILE * fpth, long numero) { /* int verbose = 1; */ FILE *fptm; int fd_msg; int fd_pfh; int i, nb, wr, tot, lgbuf; uchar buf[4096]; if (fpth) { fflush (fpth); fd_pfh = fileno (fpth); } else fd_pfh = 0; if ((fptm = ouvre_mess (O_TEXT, numero, '\0')) != NULL) { fd_msg = fileno (fptm); } else return 0; crc = 0; tot = 0; wr = 0; lgbuf = sizeof (buf); for (;;) { nb = read (fd_msg, buf, lgbuf); if (nb <= 0) break; if (fd_pfh) wr = write (fd_pfh, buf, nb); for (i = 0; i < nb; i++) { crc += buf[i]; } tot += nb; } fclose (fptm); return tot; } struct pfh1 { unsigned short id __a1__; unsigned char len __a1__; unsigned char val __a1__; }; struct pfh2 { unsigned short id __a1__; unsigned char len __a1__; unsigned short val __a1__; }; struct pfh3 { unsigned short id __a1__; unsigned char len __a1__; unsigned char val[3] __a1__; }; struct pfh4 { unsigned short id __a1__; unsigned char len __a1__; unsigned long val __a1__; }; struct pfh8 { unsigned short id __a1__; unsigned char len __a1__; unsigned char val[8] __a1__; }; struct pfh { unsigned short magic_number __a1__; struct pfh4 file_number __a1__; struct pfh8 file_name __a1__; struct pfh3 file_ext __a1__; struct pfh4 file_size __a1__; struct pfh4 create_time __a1__; struct pfh4 last_modif_time __a1__; struct pfh1 seu_flag __a1__; struct pfh1 file_type __a1__; struct pfh2 body_checksum __a1__; struct pfh2 header_checksum __a1__; struct pfh2 body_offset __a1__; }; static int mk_pfh (char *buf, bullist * pbul, long numero) { bullist bul; mess_noeud *lptr; int lg; int i; int nb; int zero = 0; struct pfh *pfh = (struct pfh *) buf; unsigned char *ptr; char lbuf[80]; if (pbul == NULL) { lptr = findmess (numero); if (lptr == NULL) return (0); ouvre_dir (); read_dir (lptr->noenr, &bul); ferme_dir (); pbul = &bul; } lg = pfh_msg (NULL, pbul->numero); pfh->magic_number = 0x55aa; pfh->file_number.id = 1; pfh->file_number.len = 4; pfh->file_number.val = pbul->numero; pfh->file_name.id = 2; pfh->file_name.len = 8; sprintf (pfh->file_name.val, " "); pfh->file_ext.id = 3; pfh->file_ext.len = 3; sprintf (pfh->file_ext.val, " "); pfh->create_time.id = 5; pfh->create_time.len = 4; pfh->create_time.val = pbul->date; pfh->last_modif_time.id = 6; pfh->last_modif_time.len = 4; pfh->last_modif_time.val = 0; pfh->seu_flag.id = 7; pfh->seu_flag.len = 1; pfh->seu_flag.val = 0; pfh->file_type.id = 8; pfh->file_type.len = 1; pfh->file_type.val = 0; pfh->body_checksum.id = 9; pfh->body_checksum.len = 2; pfh->body_checksum.val = crc; pfh->header_checksum.id = 0xa; pfh->header_checksum.len = 2; pfh->header_checksum.val = 0; nb = sizeof (struct pfh); nb += add_struct (&buf[nb], 0x10, pbul->exped, strlen (pbul->exped)); sprintf (lbuf, "%-6s", pbul->exped); nb += add_struct (&buf[nb], 0x11, lbuf, 6); nb += add_struct (&buf[nb], 0x12, &pbul->date, 4); nb += add_struct (&buf[nb], 0x13, &pbul->nblu, 1); if (*pbul->bbsv) sprintf (lbuf, "%s@%s", pbul->desti, pbul->bbsv); else sprintf (lbuf, "%s", pbul->desti); nb += add_struct (&buf[nb], 0x14, lbuf, strlen (lbuf)); nb += add_struct (&buf[nb], 0x15, " ", 6); nb += add_struct (&buf[nb], 0x16, &zero, 4); nb += add_struct (&buf[nb], 0x17, &zero, 4); nb += add_struct (&buf[nb], 0x18, &zero, 1); nb += add_struct (&buf[nb], 0x19, &zero, 1); nb += add_struct (&buf[nb], 0x20, &pbul->type, 1); nb += add_struct (&buf[nb], 0x21, pbul->bid, strlen (pbul->bid)); nb += add_struct (&buf[nb], 0x22, pbul->titre, strlen (pbul->titre)); buf[nb++] = '\0'; buf[nb++] = '\0'; buf[nb++] = '\0'; pfh->file_size.id = 4; pfh->file_size.len = 4; pfh->file_size.val = lg + nb; pfh->body_offset.id = 0xb; pfh->body_offset.len = 2; pfh->body_offset.val = (unsigned short) nb; /* Computing header checksum */ ptr = (char *) pfh; for (chck = 0, i = 0; i < nb; ptr++, i++) { chck += 0xff & (unsigned short) *ptr; } pfh->header_checksum.val = chck; return (nb); } static int mk_pfh_file (long numero, int type) { int nb = 0; FILE *fptr; char header[256]; if (type == PFH_MSG) { nb = mk_pfh (header, NULL, numero); if (nb == 0) return (0); if (access (dlname (numero), 00) == 0) return (1); fptr = fopen (dlname (numero), "wb"); if (fptr == NULL) return (0); fwrite (header, nb, 1, fptr); nb = pfh_msg (fptr, numero); fclose (fptr); } if (type == PFH_FILE) { nb = 0; } return nb; } /* * < dlname > pathname DL file */ static char *dlname (long numero) { static char pathname[128]; sprintf (pathname, "%s%lx.dl", MBINDIR, numero); return (pathname); } static void rm_pfh_file (long numero) { struct stuser *user; user = (struct stuser *) actuser.head; while (user) { if (((user->flags & F_DIR) == 0) && (user->file_id == numero)) { /* used by another user */ return; } user = user->next; } /* unlink the DL file */ unlink (dlname (numero)); } static int add_crc (char *buf, int nb) { int j; short crc; for (j = 0, crc = 0; j < nb; j++) { crc = calc_crc (buf[j], crc); } buf[j++] = (crc >> 8) & 0xff; buf[j++] = crc & 0xff; return (j); } static void snd_pac (char *desti, char *buf, int len, int pid) { static int s_f0 = -1; static int s_bb = -1; static int s_bd = -1; int slen; int dlen; fs_ax25 dst; fs_ax25 src; char *call = NULL; int s = -1; long temps; switch (pid) { case 0xbb: s = s_bb; break; case 0xbd: s = s_bd; break; case 0xf0: s = s_f0; break; } if (s == -1) { #ifdef OLD_AX25 slen = convert_call (pac_call, &src); #else slen = ax25_aton (pac_call, &src); #endif call = ax25_config_get_addr (pac_port); if (call == NULL) { printf ("Cannot find a callsign for port %s\n", pac_port); return; } #ifdef OLD_AX25 convert_call_entry (call, src.fsa_digipeater[0].ax25_call); #else ax25_aton_entry (call, src.fsa_digipeater[0].ax25_call); #endif src.fsa_ax25.sax25_ndigis = 1; if ((s = socket (AF_AX25, SOCK_DGRAM, pid)) == -1) { perror ("beacon:socket"); return; } if (bind (s, (struct sockaddr *) &src, slen) == -1) { perror ("beacon:bind"); return; } switch (pid) { case 0xbb: s_bb = s; break; case 0xbd: s_bd = s; break; case 0xf0: s_f0 = s; break; } } #ifdef OLD_AX25 if ((dlen = convert_call (desti, &dst)) == -1) #else if ((dlen = ax25_aton (desti, &dst)) == -1) #endif { fprintf (stderr, "beacon: unable to convert '%s'\n", call); return; } if (sendto (s, buf, len, 0, (struct sockaddr *) &dst, dlen) == -1) { perror ("beacon: sendto"); return; } temps = (TIME ((len + HDRSIZE))) * 1000 / baud; tim_3 += temps; } static int rcvkss (void) { struct sockaddr sa; int asize = sizeof (sa); int lg; char *ptr; lnrkss = 0; if (msock == -1) return (0); lg = recvfrom (msock, rkss, FRMSIZE, 0, &sa, &asize); if (lg <= 0) return (0); if ((ptr = ax25_config_get_name (sa.sa_data)) != NULL) { /* printf("Received UI on port %s, lg=%d\n", ptr, lg); */ } lnrkss = lg; f_rkss = ON; return (lg); } #ifdef OLD_AX25 static char *ax2ascii (char *call) #else static char *ax25_ntoaii (char *call) #endif { char *scan; #ifdef OLD_AX25 char *ptr = ax2asc ((ax25_address *)call); #else char *ptr = ax25_ntoa ((ax25_address *)call); #endif scan = strrchr (ptr, '-'); if ((scan) && (*(scan + 1) == '0')) *scan = '\0'; return (ptr); } fbb-7.04j/src/qraloc.c0100644000175100017510000002630307726646105012637 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include static char qral[7]; #define MILES 1.609 static int tstll (double x) { return ((x > -180) && (x < 180)); } static int end (char *s) { strupr (s); return ((strcmp (s, "Q") == 0) || (strcmp (s, "F") == 0)); } void lonlat (char *qra, double *w, double *l) { *w = 180.0 - ((double) (qra[0] - 'A')) * 20.0 - ((double) (qra[2] - '0')) * 2.0 - ((double) qra[4] - 64.5) / 12.0; *l = -90.0 + ((double) (qra[1] - 'A')) * 10.0 + ((double) (qra[3] - '0')) + ((double) qra[5] - 64.5) / 24.0; } static char *qra_loc (double w, double l) { qral[0] = 'A' + (int) (w = (180 - w) / 20); qral[1] = 'A' + (int) (l = (90 + l) / 10); qral[2] = '0' + (int) (w = (w - floor (w)) * 10); qral[3] = '0' + (int) (l = (l - floor (l)) * 10); qral[4] = 'A' + (int) ((w - floor (w)) * 24); qral[5] = 'A' + (int) ((l - floor (l)) * 24); qral[6] = '\0'; return (qral); } static double dist (double w, double l, double wa, double la) { double x1, y1; y1 = cos (l / DEGRAD) * cos (la / DEGRAD) * cos ((w - wa) / DEGRAD) + sin (l / DEGRAD) * sin (la / DEGRAD); if (y1 > 1) y1 = 1; if (y1 < -1) y1 = -1; x1 = atan (sqrt (1 - y1 * y1) / y1); if (y1 < 0) x1 = 180 / DEGRAD + x1; return (6371.3 * x1); } static double azimut (double w, double l, double wa, double la) { double x1, y1, z1; x1 = dist (w, l, wa, la) / 6371.3; if (x1) { y1 = (sin (la / DEGRAD) - sin (l / DEGRAD) * cos (x1)) / (cos (l / DEGRAD) * sin (x1)); if (y1 > 1) y1 = 1; if (y1 < -1) y1 = -1; z1 = fabs (DEGRAD * atan (sqrt (1 - y1 * y1) / y1)); if (y1 < 0) z1 = 180 - z1; if (sin ((w - wa) / DEGRAD) < 0) z1 = 360 - z1; return (z1); } else return (0); } #if 0 double litllat (chaine) char *chaine; { char ligne[81]; char *scan = chaine, *ptr = ligne; char Sud, Est; double temp; Sud = *(langue[vlang]->plang[T_DEB + 7 - 1]); Est = *(langue[vlang]->plang[T_DEB + 8 - 1]); /* Nord = *(langue[vlang]->plang[T_DEB+6-1]) ; Ouest = *(langue[vlang]->plang[T_DEB+9-1]) ; */ while (isdigit (*scan) || (*scan == '.') || (*scan == ',')) { if (*scan == ',') *scan = '.'; *ptr++ = *scan++; } *ptr = '\0'; temp = atof (ligne); while (*scan && !ISGRAPH (*scan)) scan++; if (toupper (*scan) == 'G') { temp *= 0.9; while (ISGRAPH (*scan)) ++scan; } else { if (toupper (*scan) == 'D') { while (ISGRAPH (*scan)) ++scan; while (*scan && !ISGRAPH (*scan)) ++scan; ptr = ligne; if (isdigit (*scan)) { while (isdigit (*scan) || (*scan == '.') || (*scan == ',')) { if (*scan == ',') *scan = '.'; *ptr++ = *scan++; } *ptr = '\0'; temp += (atof (ligne) / 60.0); while (*scan && !ISGRAPH (*scan)) scan++; if (*scan == '\'') ++scan; } } else return (1000.0); } if (!tstll (temp)) return (1000.0); while (*scan && !ISGRAPH (*scan)) ++scan; if ((toupper (*scan) == Est) || (toupper (*scan) == Sud)) temp = -temp; else if ((toupper (*scan) != Oui) && (toupper (*scan) != Non)) return (1000.0); return (temp); } #endif static double litllat (char *chaine, int mode) { int deg, min, sec, grade = 1; char ctemp; char *scan = chaine; char Nord = 'N', Sud = 'S', Est = 'E', Ouest = 'W'; double temp; if (mode) { /* longitude */ Nord = *(langue[vlang]->plang[T_DEB + 6 - 1]); Sud = *(langue[vlang]->plang[T_DEB + 7 - 1]); } else { /* Lattitude */ Est = *(langue[vlang]->plang[T_DEB + 8 - 1]); Ouest = *(langue[vlang]->plang[T_DEB + 9 - 1]); } while (*scan) { if (*scan == ',') *scan = '.'; if (*scan == ':') grade = 0; scan++; } if (grade) { if (sscanf (chaine, "%lg %c", &temp, &ctemp) != 2) return (1000.0); temp *= 0.9; } else { if (sscanf (chaine, "%d:%d:%d %c", °, &min, &sec, &ctemp) != 4) return (1000.0); if ((deg > 180) || (min >= 60) || (sec >= 60)) return (1000.0); temp = (double) deg + (double) min / 60.0 + (double) sec / 3600.0; } if (!tstll (temp)) return (1000.0); ctemp = toupper (ctemp); if (mode) { if (ctemp == Sud) temp = -temp; else if (ctemp != Nord) temp = (1000.0); } else { if (ctemp == Est) temp = -temp; else if (ctemp != Ouest) temp = (1000.0); } return (temp); } static void longla (void) { double w, l, wdeg, wmn, ldeg, lmn; char s[81], longi[6], latit[6]; switch (pvoie->niv3) { case 0: texte (T_QRA + 3); maj_niv (2, 1, 1); break; case 1: epure (s, 7); if (tstqra (strupr (s))) { lonlat (s, &w, &l); if (w >= 0) n_cpy (5, longi, langue[vlang]->plang[T_DEB + 9 - 1]); else { w = fabs (w); n_cpy (5, longi, langue[vlang]->plang[T_DEB + 8 - 1]); } if (l >= 0) n_cpy (5, latit, langue[vlang]->plang[T_DEB + 6 - 1]); else { l = fabs (l); n_cpy (5, latit, langue[vlang]->plang[T_DEB + 7 - 1]); } wmn = modf (w, &wdeg) * 60.0; if (wmn >= 59.5) { wmn = 0; wdeg++; } w /= 0.9; lmn = modf (l, &ldeg) * 60.0; if (lmn >= 59.5) { lmn = 0; ldeg++; } l /= 0.9; texte (T_QRA + 4); sprintf (varx[0], "%3.0f", wdeg); sprintf (varx[1], "%02.0f", wmn); var_cpy (2, longi); sprintf (varx[3], "%5.1f", w); texte (T_QRA + 5); sprintf (varx[0], "%3.0f", ldeg); sprintf (varx[1], "%02.0f", lmn); var_cpy (2, latit); sprintf (varx[3], "%5.1f", l); texte (T_QRA + 6); maj_niv (2, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else if (end (s)) { maj_niv (2, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else { texte (T_ERR + 0); texte (T_QRA + 3); } break; default: fbb_error (ERR_NIVEAU, "LONG-LATT", pvoie->niv3); break; } } static void calcul_qra (void) { double l; char s[81]; switch (pvoie->niv3) { case 0: texte (T_QRA + 7); texte (T_QRA + 8); maj_niv (2, 2, 1); break; case 1: epure (s, 80); if ((pvoie->w = litllat (s, 0)) != 1000.0) { texte (T_QRA + 9); maj_niv (2, 2, 2); } else if (end (s)) { maj_niv (2, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else { texte (T_ERR + 0); texte (T_QRA + 7); texte (T_QRA + 8); } break; case 2: epure (s, 80); if ((l = litllat (s, 1)) != 1000.0) { var_cpy (0, qra_loc (pvoie->w, l)); texte (T_QRA + 10); maj_niv (2, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else if (end (s)) { maj_niv (2, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else { texte (T_ERR + 0); texte (T_QRA + 9); } break; default: fbb_error (ERR_NIVEAU, "COMPUT-QRA", pvoie->niv3); break; } } static void disazi (void) { char s[81]; double d, wa, la, azim, deg, mn; switch (pvoie->niv3) { case 0: texte (T_QRA + 11); maj_niv (2, 3, 1); break; case 1: epure (s, 7); if (tstqra (strupr (s))) { lonlat (s, &(pvoie->w), &(pvoie->l)); texte (T_QRA + 12); maj_niv (2, 3, 2); } else if (end (s)) { maj_niv (2, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else { texte (T_ERR + 0); texte (T_QRA + 11); } break; case 2: epure (s, 7); if (tstqra (strupr (s))) { lonlat (s, &wa, &la); azim = azimut (pvoie->w, pvoie->l, wa, la); mn = modf (azim, °) * 60.0; if (mn >= 59.5) { mn = 0; deg++; } azim /= 0.9; d = dist (pvoie->w, pvoie->l, wa, la); sprintf (varx[0], "%1.1f", d); sprintf (varx[1], "%1.1f", d / MILES); texte (T_QRA + 14); sprintf (varx[0], "%1.0f", deg); sprintf (varx[1], "%1.0f", mn); sprintf (varx[2], "%1.1f", azim); texte (T_QRA + 13); maj_niv (2, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else if (end (s)) { maj_niv (2, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else { texte (T_ERR + 0); texte (T_QRA + 12); } break; default: fbb_error (ERR_NIVEAU, "DIST-AZIM", pvoie->niv3); break; } } static void cumul_disazi (void) { char s[81]; double wa, la, azim, deg, mn, d; switch (pvoie->niv3) { case 0: texte (T_QRA + 15); maj_niv (2, 4, 1); break; case 1: epure (s, 7); if (tstqra (strupr (s))) { lonlat (s, &(pvoie->w), &(pvoie->l)); texte (T_QRA + 16); maj_niv (2, 4, 2); } else if (end (s)) { maj_niv (2, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else { texte (T_ERR + 0); texte (T_QRA + 15); } break; case 2: epure (s, 7); if (tstqra (strupr (s))) { lonlat (s, &wa, &la); azim = azimut (pvoie->w, pvoie->l, wa, la); mn = modf (azim, °) * 60.0; if (mn >= 59.5) { mn = 0; deg++; } azim /= 0.9; d = dist (pvoie->w, pvoie->l, wa, la); if (d == 0.) d = 1.; sprintf (varx[0], "%1.1f", d); sprintf (varx[1], "%1.1f", d / MILES); texte (T_QRA + 14); pvoie->noenr_menu++; pvoie->cumul_dist += d; ltoa (pvoie->noenr_menu, varx[0], 10); sprintf (varx[1], "%1.0f", pvoie->cumul_dist); sprintf (varx[2], "%1.0f", pvoie->cumul_dist / MILES); texte (T_QRA + 17); texte (T_QRA + 16); } else { if (end (s)) { texte (T_QRA + 18); maj_niv (2, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else { texte (T_ERR + 0); texte (T_QRA + 17); texte (T_QRA + 16); } } break; default: fbb_error (ERR_NIVEAU, "CUMUL-DISAZI", pvoie->niv3); break; } } static void menu_qraloc (void) { int error = 0; char com[80]; limite_commande (); while (*indd && (!ISGRAPH (*indd))) indd++; strn_cpy (70, com, indd); switch (toupper (*indd)) { case 'Q': maj_niv (2, 1, 0); longla (); break; case 'L': maj_niv (2, 2, 0); calcul_qra (); break; case 'D': maj_niv (2, 3, 0); disazi (); break; case 'C': pvoie->noenr_menu = 0; pvoie->cumul_dist = 0.0; maj_niv (2, 4, 0); cumul_disazi (); break; case 'F': maj_niv (0, 1, 0); incindd (); choix (); break; case 'B': maj_niv (N_MENU, 0, 0); sortie (); break; case '\0': prompt (pvoie->finf.flags, pvoie->niv1); break; default: if (!defaut ()) error = 1; break; } if (error) { cmd_err (indd); } } void qraloc (void) { switch (pvoie->niv2) { case 0: menu_qraloc (); break; case 1: longla (); break; case 2: calcul_qra (); break; case 3: disazi (); break; case 4: cumul_disazi (); break; default: fbb_error (ERR_NIVEAU, "QRA-LOC", pvoie->niv2); break; } } fbb-7.04j/src/redist.c0100644000175100017510000002736307726646105012657 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE REDIST.C Server from G7FCI * * * REDIST.C - Allows SP messages sent to the server to be redistributed * as bulletins to the relevant local bulletin grouping. * * The intention of this server is to allow users to send local, regional or * national bulletins in areas, regions or countries that are remote from * them. For example, someone could send a bulletin to all BBSs in an * area local to a BBS in Los Angeles, even though they don't know the * relevant bulletin grouping for that area. Messages are also sent as * SP, so they don't leave a trail of useless bulletins at all the BBSs on * the way. * * The server also has the side effect that allows TNC PMS users to send * personal messages which will be translated into bulletins. This can also * be used by users who can't remember the relevant groupings for the bulletin * groupings. * * Three bulletin groupings are allowed, ie LOCAL, REGION and * NATION. The translation for each grouping is held in the * file SYSTEM\REDIST.SYS. This file contains one line for each * translation. For example, the file at GB7FCI would contain * the following three lines : * * #NW * #ZONEA * GBR * * With the above file, the server will translate a message in the following * format : * * SP LOCAL @ GB7FCI < G3UVQ * Subject line * R:.............. * R:.............. * * Lines of message text * /EX * * ...into a bulletin with the format : * * SB ALL @ #NW < G3UVQ * Subject line * R:............. * * Lines of message text * /EX * * The subject line and full text are copied. * * The copied message is appended onto the MAIL.IN BBS file. * * Next 2 lines remove exception handling */ #include #define BBS_CALL 1 /* Offset of BBS Call in INIT.SRV */ #define BBS_QRA 3 /* Offset of QRA line in INIT.SRV */ #define BBS_QTH 4 /* Offset of QTH line in INIT.SRV */ #define HOST_SYS 12 /* Offset of SYSOP callsign in INIT.SRV */ #define MAIL_IN 14 /* Offset of MAIL.IN path in INIT.SRV */ #define LINE 128 /* line 'buffer' length */ #define AT_FLD 32 /* Length of fields to hold addresses */ #define DESC_FLD 32 /* Length of a description field */ #define TO_FLD 7 /* Length of TO field */ /* Global variables */ char locbbs_addr[LINE] = ""; char locbbs_desc[DESC_FLD] = ""; char local_addr[LINE] = ""; char local_desc[DESC_FLD] = ""; char region_addr[LINE] = ""; char region_desc[DESC_FLD] = ""; char nation_addr[LINE] = ""; char nation_desc[DESC_FLD] = ""; char default_to[TO_FLD] = ""; int mail_sysop = 1; /* Does the sysop need to be mailed? */ int redist_update = 0; /* Infos got from config file */ FILE *mail_file; /* * Copy string 2 into string 1 removing spaces * Copy until NULL in str2 or length reached. */ void tidy_string (char *str1, char *str2, int length) { char *ptr1, *ptr2; int cntr = 0; ptr1 = str1; ptr2 = str2; while (*ptr2 != '\0' && cntr < length) { if (*ptr2 == ' ' || *ptr2 == '=') { ptr2++; } else { *ptr1 = *ptr2; ptr1++; ptr2++; cntr++; } } } /* * Read values from config file into global variables. */ int read_config (void) { char buffer[LINE]; char *string_id; char *ptr; char str_val[LINE]; char tmp_str[2]; FILE *config; if (redist_update) return (1); config = fopen (c_disque ("REDIST.SYS"), "rt"); if (config == NULL) return (0); while (!feof (config) && !ferror (config)) { fgets (buffer, LINE, config); string_id = strtok (buffer, " =\n"); if (*string_id == '#') continue; ptr = strtok (NULL, "\n"); if (ptr) strcpy (str_val, ptr); if (strcmpi (string_id, "LOCBBS") == 0) { tidy_string (locbbs_addr, str_val, LINE); locbbs_addr[LINE - 1] = '\0'; } if (strcmpi (string_id, "LOCBBS_DESC") == 0) { strncpy (locbbs_desc, str_val, DESC_FLD); locbbs_desc[DESC_FLD - 1] = '\0'; } if (strcmpi (string_id, "LOCAL") == 0) { tidy_string (local_addr, str_val, LINE); local_addr[LINE - 1] = '\0'; } if (strcmpi (string_id, "LOCAL_DESC") == 0) { strncpy (local_desc, str_val, DESC_FLD); local_desc[DESC_FLD - 1] = '\0'; } if (strcmpi (string_id, "REGION") == 0) { tidy_string (region_addr, str_val, LINE); region_addr[LINE - 1] = '\0'; } if (strcmpi (string_id, "REGION_DESC") == 0) { strncpy (region_desc, str_val, DESC_FLD); region_desc[DESC_FLD - 1] = '\0'; } if (strcmpi (string_id, "NATION") == 0) { tidy_string (nation_addr, str_val, LINE); nation_addr[LINE - 1] = '\0'; } if (strcmpi (string_id, "NATION_DESC") == 0) { strncpy (nation_desc, str_val, DESC_FLD); nation_desc[DESC_FLD - 1] = '\0'; } if (strcmpi (string_id, "DEFAULT_TO") == 0) { strncpy (default_to, str_val, TO_FLD); default_to[TO_FLD - 1] = '\0'; } /* if (strcmpi(string_id,"MAIL_IN") == 0) { strncpy(mail_in,str_val,LINE); mail_in[LINE-1] = '\0'; } */ if (strcmpi (string_id, "MAIL_SYSOP") == 0) { tidy_string (tmp_str, str_val, 1); tmp_str[1] = '\0'; strupr (tmp_str); if (tmp_str[0] == 'N') mail_sysop = 0; } } fclose (config); if (strlen (locbbs_addr) < 1) { strcpy (locbbs_addr, my_call); } redist_update = 1; /* Has an update been sent yet? 0 = no */ return (1); } int redist (char *filename) { FILE *fptr1; FILE *temp_file; char buffer[LINE] = ""; char who_from[TO_FLD] = ""; char what_area[TO_FLD] = ""; char to_field[TO_FLD] = ""; char new_area[LINE] = ""; char area_desc[DESC_FLD] = ""; char at_field[LINE] = ""; char from_bbs[LINE] = ""; char subject_line[LINE] = ""; char *buffptr; char *buffptr2; char *ptr; int in_header; int cntr; fptr1 = fopen (filename, "rt"); /* Open the received message */ if (fptr1 == NULL) return (1); if (!read_config ()) return (1); /* Get the REDIST config values */ mail_file = fappend (MAILIN, "b"); if (mail_file == NULL) { return (1); } fgets (buffer, LINE, fptr1); /* Read the command line */ sscanf (buffer, "%*s %s %*s %s\n", /* Extract details of area */ what_area, /* and who sent the message */ who_from); if (strcmp (what_area, "LOCBBS") == 0) { strcpy (new_area, locbbs_addr); strcpy (area_desc, locbbs_desc); } else if (strcmp (what_area, "LOCAL") == 0) { strcpy (new_area, local_addr); strcpy (area_desc, local_desc); } else if (strcmp (what_area, "REGION") == 0) { strcpy (new_area, region_addr); strcpy (area_desc, region_desc); } else if (strcmp (what_area, "NATION") == 0) { strcpy (new_area, nation_addr); strcpy (area_desc, nation_desc); } else { strcpy (new_area, locbbs_addr); strcpy (area_desc, locbbs_desc); } if (strlen (area_desc) < 1) /* If descriptions not set up */ { strcpy (area_desc, new_area); } temp_file = fopen ("REDIST.$$$", "wb"); if (temp_file == NULL) return (1); /* Append the copies to mail in file */ fgets (buffer, LINE, fptr1); /* Get subject line */ buffer[strlen (buffer) - 1] = '\0'; /* Strip LF at end of line */ buffptr = buffer; if (*buffer == '#') /* User requested TO field? */ { buffptr++; /* Skip past # */ while ((*buffptr) && (isspace (*buffptr))) buffptr++; cntr = 0; buffptr2 = to_field; while (isalnum (*buffptr)) { if (cntr < 6) { *buffptr2 = toupper (*buffptr); buffptr2++; cntr++; } buffptr++; } *buffptr2 = '\0'; while ((*buffptr) && (isspace (*buffptr))) buffptr++; } buffptr2 = subject_line; cntr = 0; while (*buffptr != '\0') { if (cntr == 78) break; *buffptr2 = *buffptr; buffptr++; buffptr2++; cntr++; } *buffptr2 = '\0'; if (strlen (to_field) < 1) { if (strlen (default_to) > 0) { strcpy (to_field, default_to); } else { strcpy (to_field, "REDIST"); } } fprintf (temp_file, "%s\r\n", subject_line); /* Output subject line */ in_header = 1; fgets (buffer, LINE, fptr1); buffer[strlen (buffer) - 1] = '\0'; /* Strip LF at end of line */ while (!feof (fptr1) && !ferror (fptr1)) { if (in_header == 1) { if (strncmp (buffer, "R:", 2) == 0) { strupr (buffer); /* Capitalize */ /* Get FROM_BBS */ buffptr = buffer; /* Point at buffer */ buffptr = strchr (buffptr, '@'); /* Find the '@' */ if (buffptr != NULL) { buffptr++; if (!isalnum (*buffptr)) buffptr++; /* Skip past the ':' */ buffptr = strtok (buffptr, " "); if (buffptr) { ptr = strtok (buffptr, " "); if (ptr) { strcpy (from_bbs, ptr); } } } fgets (buffer, LINE, fptr1); buffer[strlen (buffer) - 1] = '\0'; /* Strip LF at EOL */ continue; } else in_header = 0; if (strlen (from_bbs) > 0) { /* Work out the date and time for the new BBS header */ long temps; struct tm *sdate; temps = time (NULL); sdate = gmtime (&temps); fprintf (temp_file, "R:%02d%02d%02d/%02d%02dZ @:%s {REDIST}\r\n", sdate->tm_year % 100, sdate->tm_mon + 1, sdate->tm_mday, sdate->tm_hour, sdate->tm_min, from_bbs); } } fprintf (temp_file, "%s\r\n", buffer); fgets (buffer, LINE, fptr1); sup_ln (buffer); } fclose (temp_file); fclose (fptr1); /* * Make copies of the temp file for each destination in the * new_area variable. */ ptr = strtok (new_area, ",\r\n"); while (ptr) { n_cpy (AT_FLD - 1, at_field, ptr); fprintf (mail_file, "#\nSB %s @ %s < %s\r\n", to_field, at_field, who_from); fptr1 = fopen ("REDIST.$$$", "rb"); if (fptr1 == NULL) return (1); fgets (buffer, LINE, fptr1); sup_ln (buffer); while (!feof (fptr1) && !ferror (fptr1)) { if (strcmpi (buffer, "/EX") == 0) { fprintf (mail_file, "\r\n** This bulletin was distributed in your area using a local REDIST server.\r\n"); } fprintf (mail_file, "%s\r\n", buffer); fgets (buffer, LINE, fptr1); buffer[strlen (buffer) - 1] = '\0'; /* Strip LF at end of line */ } fclose (fptr1); ptr = strtok (NULL, ",\r\n"); } /* Report successful distribution to sender */ if (strlen (from_bbs) > 0) { fprintf (mail_file, "SP %s @ %s < %s\r\n", who_from, from_bbs, mycall); } else { fprintf (mail_file, "SP %s < %s\r\n", who_from, mycall); } fprintf (mail_file, "Re: %s\r\n\r\n", subject_line); fprintf (mail_file, "The %s server at %s has redistributed your message as\r\n", what_area, mycall); fprintf (mail_file, "a bulletin covering %s.\r\n", area_desc); fprintf (mail_file, "/EX\r\n"); /* Mail sysop if required */ if (mail_sysop == 1) { fprintf (mail_file, "SP %s < REDIST\r\n", admin); fprintf (mail_file, "Report\r\n\r\n"); fprintf (mail_file, "The %s REDIST server has distributed a bulletin from %s.\r\n", what_area, who_from); fprintf (mail_file, "/EX\r\n"); } fclose (mail_file); remove ("redist.$$$"); return (0); /* Tell BBS all is correct */ } fbb-7.04j/src/reqdir.c0100644000175100017510000001723107726646105012644 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * REQDIR.C Server example. * * Version 1.1 01/01/92 * Version 1.2 05/05/92 * Version 1.3 05/23/92 * * * This server answers to a message like this : * * SP REQDIR < FC1EBN * *.ZIP @ F6ABJ * Text is not necessary * /EX * * by a message like this * * SP FC1EBN @ F6ABJ < F6FBB * Req Dir : *.ZIP * FBB.ZIP etc..... * /EX * * ============================================ * The server must APPEND its answer to MAIL.IN * file to avoid destroying existing mail. * ============================================ * * The server receives from FBB software 1 argument : * * argv[1] = Name of the file including the message received from FBB software. * * As this server opens the INIT.SRV file, it must be in the same directory. * */ #include #include #include #include #include #include #include #include #define MAX_DISK 8 void send_dir (FILE * fptr, char *base_dir, char *dir, int disk, int avail_disk[]); char *back2slash (char *str) { static char buf[256]; char *ptr = buf; int nb = 0; if ((strlen (str) > 2) && (str[1] == ':')) str += 2; while (*str) { if (*str == '\\') *ptr = '/'; else if (isupper (*str)) *ptr = tolower (*str); else *ptr = *str; ++ptr; ++str; if (++nb == 255) break; } *ptr = '\0'; return (buf); } int main (int argc, char **argv) { int i; int disk = 2; int avail_disk[MAX_DISK]; FILE *fptr; char *ptr; char *dir; char buffer[128]; char sender[80]; char route[80]; char path[80]; char bbs_call[80]; char base_dir[80]; char mail_in[80]; if (argc != 2) exit (1); /* Check the arguments */ dir = path; fptr = fopen (back2slash (argv[1]), "r"); /* Open the received message */ if (fptr == NULL) exit (1); fgets (buffer, 80, fptr); /* Read the command line */ sscanf (buffer, "%*s %*s %*s %s\n", sender); *dir = *route = '\0'; fgets (buffer, 80, fptr); /* Read the subject */ i = 0; ptr = buffer; while (*ptr) { /* No spaces */ if (!isspace (*ptr)) { if (isupper (*ptr)) buffer[i] = tolower (*ptr); /* Capitalise */ ++i; } ++ptr; } buffer[i] = '\0'; sscanf (buffer, "%[^@]%s", dir, route); /* Scan dir and route */ fclose (fptr); /* All needed is read */ unlink (back2slash(argv[1])); if (dir[1] == ':') { /* Checks asked disk */ disk = toupper (dir[0]) - 'A'; dir += 2; } if ((*dir == '\\') || (*dir == '/')) ++dir; if (*dir == '\0') strcpy (dir, "*.*"); /* All files ? */ *base_dir = '\0'; if (read_fbb_conf(NULL) > 0) exit (1); ptr = find_fbb_conf("call", 0); if (ptr == NULL) exit (1); /* and users base directory */ sscanf (ptr, "%[0-9A-Za-z]", bbs_call); /* Callsign */ ptr = find_fbb_conf("fbbd", 0); if (ptr == NULL) ptr = def_fbb_conf("fbbd"); if (ptr == NULL) exit (1); /* and users base directory */ ptr = strtok (ptr, ", \n"); /* Users directory */ for (i = 0; i < MAX_DISK; i++) { /* selects asked disk path */ if ((i == disk) && (ptr) && (*ptr != '*')) strcpy (base_dir, ptr); avail_disk[i] = ((ptr) && (*ptr != '*')); ptr = strtok (NULL, ", \n"); } ptr = find_fbb_conf("impo", 0); if (ptr == NULL) ptr = def_fbb_conf("impo"); if (ptr == NULL) exit (1); /* and users base directory */ sscanf (ptr, "%s", mail_in); /* Mail in file */ /* Append the answer to mail in file */ if ((fptr = fopen (back2slash (mail_in), "a")) != NULL) { fprintf (fptr, "#\r\n"); /* Tell that this is a message from this BBS */ fprintf (fptr, "SP %s %s < %s\r\n", sender, route, bbs_call); /* Command line */ send_dir (fptr, base_dir, dir, disk, avail_disk); fprintf (fptr, "\r\n/EX\r\n"); fclose (fptr); } exit (0); } int points (char *ptr) /* Looks for a ".." sequence in the path */ { while (*ptr) { if ((*ptr == '.') && (*(ptr + 1) == '.')) return (1); ++ptr; } return (0); /* ".." not fond ! */ } char *strupr (char *str) { char *tmp = str; while (*tmp) { if (islower (*tmp)) *tmp = toupper (*tmp); ++tmp; } return str; } int is_dir (char *path) { struct stat st; if (stat (path, &st) != -1) return ((st.st_mode & S_IFDIR) != 0); return 0; } int strmatch (char *chaine, char *masque) { while (1) { switch (*masque) { case '\0': return (toupper (*masque) == toupper (*chaine)); case '&': if ((*chaine == '\0') || (*chaine == '.')) return (1); break; case '?': if (!isalnum (*chaine)) return (0); break; case '#': if ((*chaine != '#') && (!isdigit (*chaine))) return (0); break; case '@': if (!isalpha (*chaine)) return (0); break; case '=': if (!isgraph (*chaine)) return (0); break; case '*': while (*++masque == '*') ; if (*masque == '\0') return (1); while (!strmatch (chaine, masque)) if (*++chaine == '\0') return (0); break; default: if ((toupper (*chaine)) != (toupper (*masque))) return (0); break; } ++chaine; ++masque; } } void send_dir (FILE * fptr, char *base_dir, char *dir, int disk, int avail_disk[]) { int i; int found = 0; char *ptr; char path[256]; char filename[256]; char mask[10]; sprintf (path, "%s/%s", base_dir, dir); /* Complete path */ ptr = path; while (*ptr) { if (*ptr == '\\') *ptr = '/'; else if (isupper (*ptr)) *ptr = tolower (*ptr); ++ptr; } if (is_dir (path)) { strcpy (mask, "*"); strcat (dir, "\\*.*"); } else { ptr = strrchr (path, '/'); if (ptr) { *ptr++ = '\0'; strcpy (mask, ptr); if (*path == '\0') strcpy (path, "/"); } } if (strcmp (mask, "*.*") == 0) strcpy (mask, "*"); fprintf (fptr, "ReqDir %c:\\%s\r\n", disk + 'A', dir); /* Subject */ fprintf (fptr, "\r\nReqDir V 1.5 for LINUX (C) F6FBB 1996-2000\r\nVolume %c: - Path \\%s\r\n\r\n", disk + 'A', dir); /* Subject */ fprintf (fptr, "Available volumes: "); for (i = 0; i < MAX_DISK; i++) if (avail_disk[i]) fprintf (fptr, "%c: ", i + 'A'); fprintf (fptr, "\r\n\r\n"); if (*base_dir) { struct dirent *dirent; DIR *dir; struct stat st; dir = opendir (path); if (dir) { while ((dirent = readdir (dir)) != NULL) { if (*dirent->d_name != '.') { found = 1; sprintf (filename, "%s/%s", path, dirent->d_name); if (stat (filename, &st) == -1) continue; if (st.st_mode & S_IFDIR) fprintf (fptr, " %s\n", strupr (dirent->d_name)); else if (strmatch(dirent->d_name, mask)) fprintf (fptr, "%12ld %s\n", st.st_size, strupr (dirent->d_name)); } } } if (!found) fprintf (fptr, "No file !\r\n"); } else fprintf (fptr, "Volume %c: does not exist !\r\n", disk + 'A'); } fbb-7.04j/src/rx25.c0100644000175100017510000002452507726646105012162 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * RX25.C : Decodage de trames au format ROSE X25 * * D'apres KD.BAS de F1EBN * * FC1OAT@F6ABJ - 920820 */ #include /****************************************************************************** * Dump ASCII avec Filtrage des caracteres non affichables ******************************************************************************/ static int decode_x25 (unsigned char *, int, char *); static void decode_X121 (uchar *, int, char *); static void decode_digi (uchar *, int, char *); static void dump_hexa (uchar *, int, char *); void put_rose (uchar * texte, int attr, int nbcar) { unsigned char chaine[400]; unsigned char *ptr = chaine; int decode = 1; /* A patcher, au cas ou ... */ if (decode) { if (nbcar > 256) nbcar = 256; strcpy (ptr, "X25 : "); ptr += 6; nbcar = 6 + decode_x25 (texte, nbcar, ptr); } else memcpy (chaine, texte, nbcar); put_ui (chaine, attr, nbcar); } /****************************************************************************** * Les Causes *****************************************************************************/ static char *ResetCause (int cause) { static char hex_cause[3]; /* From ISO 8208 page 48 */ switch (cause) { case 0: return "DTE Originated"; case 0xC1: return "Gateway-detected Procedure Error"; case 0xC3: return "Gateway Congestion"; case 0xC7: return "Gateway Operational"; default: switch (cause & 0x7F) { case 0x01: return "Out Of Order"; case 0x03: return "Remote Procedure Error"; case 0x05: return "Local Procedure Error"; case 0x07: return "Network Congestion"; case 0x09: return "Remote DTE Operational"; case 0x0F: return "Network Operational"; case 0x11: return "Incompatible Destination"; case 0x1D: return "Network Out Of Order"; default: sprintf (hex_cause, "%2.2X", cause); return hex_cause; } } } static char *ClearCause (int cause) { static char hex_cause[3]; /* From ISO 8208 page 43 */ switch (cause) { case 0: return "DTE Originated"; case 0xC1: return "Gateway-detected Procedure Error"; case 0xC3: return "Gateway Congestion"; case 0xC7: return "Gateway Operational"; default: switch (cause & 0x7F) { case 0x01: return "Number Busy"; case 0x09: return "Out Of Order"; case 0x11: return "Remote Procedure Error"; case 0x19: return "Reverse Charging Acceptance Not Subscribed"; case 0x21: return "Incompatible Destination"; case 0x29: return "Fast Select Acceptance Not Subscribed"; case 0x39: return "Ship Absent"; case 0x03: return "Invalid Facility Requested"; case 0x0B: return "Access Barred"; case 0x13: return "Local Procedure Error"; case 0x05: return "Network Congestion"; case 0x0D: return "Not Obtainable"; case 0x15: return "RPOA Out Of Order"; default: sprintf (hex_cause, "%2.2X", cause); return hex_cause; } } } static char *RestartCause (int cause) { static char hex_cause[3]; /* From ISO 8208 page 50 */ switch (cause) { case 0: return "DTE Originated"; case 1: return "Local Procedure Error"; case 3: return "Network Congestion"; case 7: return "Network Operational"; case 0x7F: return "Registration/Cancellation Confirmed"; default: sprintf (hex_cause, "%2.2X", cause); return hex_cause; } } /****************************************************************************** * Decodage de trames X25 *****************************************************************************/ /* Decodage d'une adresse X.121 */ static void decode_X121 (uchar * data, int lgaddr, char *result) { char bcd; int pfo, pfa; while (lgaddr > 0) { pfo = (*data & 0xF0) >> 4; pfa = *data & 0x0F; bcd = pfo + '0'; *result++ = bcd; if (--lgaddr == 0) break; bcd = pfa + '0'; *result++ = bcd; lgaddr--; data++; } *result = '\0'; } /* Dump Hexa */ static void dump_hexa (uchar * data, int l_data, char *result) { int i; i = 0; while (l_data-- > 0) { sprintf (result, "%2.2X ", *data++); result += 3; if (++i == 16) { *result++ = '\r'; i = 0; } } *result = '\0'; } static char *rs_addr(char *addr) { static char str[20]; strncpy(str, addr, 4); str[4] = ','; strncpy(str+5, addr+4, 6); str[11] = '\0'; return str; } /* Decodage d'un champ digi */ static void decode_digi (uchar * data, int l_data, char *result) { while (l_data-- > 1) { *result++ = *data++ >> 1; } *result++ = '-'; *result++ = (*data & 0x7F) >> 1; *result = 0; } /* Decodage d'une suite de champs facilite */ static void decodage_facilite (uchar * data, char *result) { int lgfac, lg, fct, lgdigi, lgaddcall; int lgad, lgaddr, lgadind; static char digis[10], digid[10], icd[10]; static char indorig[10], inddest[10]; static char addstorig[20], addstdest[20]; lgfac = *data++; lg = lgfac; digid[0] = digis[0] = '\0'; while (lg > 0) { fct = *data++; lg--; switch (fct) { case 0: /* Marker=0 National Fac ou Marker=15 CCITT */ data++; lg--; break; case 0x3F: /* Utilise si appel par call digi au lieu du call N3 */ sprintf (result, "\rFacility 3F%2.2X", *data++); lg--; break; case 0x7F: /* Nombre aleatoire pour eviter les rebouclages */ sprintf (result, " NbAlea: %2.2X%2.2X", *data, *(data + 1)); data += 2; lg -= 2; break; case 0xE9: /* Digi destination */ lgdigi = *data++; decode_digi (data, lgdigi, digid); data += lgdigi; lg -= 1 + lgdigi; break; case 0xEB: /* Digi origine */ lgdigi = *data++; decode_digi (data, lgdigi, digis); data += lgdigi; lg -= 1 + lgdigi; break; case 0xC9: /* Adresse et indicatif du nodal destination */ case 0xCB: /* Adresse et indicatif du nodal origine */ lgaddcall = *data++; data++; dump_hexa (data, 3, icd); data += 3; lgad = *data++; lg -= 6; lgaddr = lgad; if (fct == 0xCB) decode_X121 (data, lgaddr, addstorig); else decode_X121 (data, lgaddr, addstdest); data += (lgad + 1) / 2; lg -= (lgad + 1) / 2; lgadind = lgaddcall - (lgad + 1) / 2 - 5; if (fct == 0xCB) strncpy (indorig, data, lgadind); else strncpy (inddest, data, lgadind); data += lgadind; lg -= lgadind; break; default: sprintf (result, "\rUnknown Facility Type %2.2X", fct); lg = 0; break; } result += strlen (result); } sprintf (result, "\r%s@%s", indorig, rs_addr(addstorig)); result += strlen (result); if (*digis) sprintf (result, " via %s", digis); strcat (result, " -> "); result += strlen (result); sprintf (result, "%s@%s", inddest, rs_addr(addstdest)); result += strlen (result); if (*digid) sprintf (result, " via %s", digid); } /* Decodage des donnees accompagnant un CALL REQUEST */ static void decode_call_req (uchar * data, int l_data, char *result) { int lgdest, lgorig, lgaddr; /* Decodage du champ adresse */ lgdest = *(data + 3) & 0x0F; lgorig = (*(data + 3) & 0xF0) >> 4; lgaddr = lgorig + lgdest; /* decode_X121 (data + 4 + (lgdest / 2), lgorig, result); strcat (result, " -> "); decode_X121 (data + 4, lgdest, result + strlen (result)); */ data += 4 + (lgaddr / 2); l_data -= 4 + (lgaddr / 2); /* result += strlen (result); */ /* Decodage des champs facilite */ decodage_facilite (data, result); } /* Point d'entree du decodage des trames X25 */ static int decode_x25 (uchar * data, int l_data, char *result) { int tpaq, id_format, r, s, lci, lg; char *ptemp = result; lci = ((*data & 0x0f) << 4) | *(data + 1); id_format = *data; tpaq = *(data + 2); r = (tpaq & 0xE0) >> 5; s = (tpaq & 0x0E) >> 1; sprintf (result, "LCI %03d : ", lci); result += strlen (result); if (id_format & 0x80) strcat (result, "Q "); if (id_format & 0x40) strcat (result, "D "); if (tpaq & 1) { switch (tpaq) { case 0x0B: sprintf (result, "CALL REQUEST "); result += strlen (result); decode_call_req (data, l_data, result); break; case 0x0F: sprintf (result, "CALL ACCEPTED"); break; case 0x13: sprintf (result, "CLEAR REQUEST - Cause %s - Diag %d", ClearCause (*(data + 3)), *(data + 4)); break; case 0x17: sprintf (result, "CLEAR CONFIRMATION"); break; case 0x23: sprintf (result, "INTERRUPT"); break; case 0x27: sprintf (result, "INTERRUPT CONFIRMATION"); break; case 0x1B: sprintf (result, "RESET REQUEST - Cause %s - Diag %d", ResetCause (*(data + 3)), *(data + 4)); break; case 0x1F: sprintf (result, "RESET CONFIRMATION"); break; case 0xF3: sprintf (result, "REGISTRATION REQUEST"); break; case 0xF7: sprintf (result, "REGISTRATION CONFIRMATION"); break; case 0xFB: sprintf (result, "RESTART REQUEST - Cause %s - Diag %d", RestartCause (*(data + 3)), *(data + 4)); break; case 0xFF: sprintf (result, "RESTART CONFIRMATION"); break; default: switch (tpaq & 0x0F) { case 0x01: sprintf (result, "RR R%d", r); break; case 0x05: sprintf (result, "RNR R%d", r); break; case 0x09: sprintf (result, "REJ R%d", r); break; } break; } l_data = 0; lg = strlen (ptemp); } else { l_data -= 3; if (tpaq & 0x10) strcat (result, "M "); sprintf (result, "DATA R%d S%d L=%d", r, s, l_data); strcat (result, "\r"); lg = strlen (ptemp); result += strlen (result); if (l_data < 0) l_data = 0; memcpy (result, data + 3, l_data); } return (lg + l_data); } fbb-7.04j/src/serveur.c0100644000175100017510000002437407726646105013057 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Gestion des serveurs de donnees. SERVEUR.H */ #include static int is_redist (char *); void tst_serveur (bullist * pbul) { serlist *lptr; bullist psauve; if ((strcmp (pbul->desti, "WP") == 0) && (strcmp (pbul->exped, mycall) != 0) && (is_wpupdate (pbul->titre))) { /* WP Update ? */ wp_read_mess (pbul); /* Lit le message pour MAJ WP */ return; } if ((*pbul->bbsv) || (pbul->type != 'P')) return; psauve = *pbul; if (is_redist (pbul->desti)) { lptr = tete_serv; while (lptr) { if (strcmp (lptr->nom_serveur, "REDIST") == 0) { appel_serveur (lptr, pbul); break; } lptr = lptr->suiv; } } else { lptr = tete_serv; while (lptr) { if (strcmp (lptr->nom_serveur, pbul->desti) == 0) { appel_serveur (lptr, pbul); break; } lptr = lptr->suiv; } } *pbul = psauve; } int p_cmd (void) { serlist *lptr; char s[200]; int ok = 1; int c = toupper (*indd); switch (c) { case 'G': incindd (); maj_niv (N_MBL, 17, 0); exec_pg (); ok = 2; break; case 'R': ok = mbl_print (); break; case 'S': lptr = tete_serv; while (lptr) { sprintf (s, "%6s: %s", lptr->nom_serveur, lptr->com_serveur); outln (s, strlen (s)); lptr = lptr->suiv; } break; default: ok = 0; break; } if (ok == 1) retour_mbl (); return (ok); } void libere_serveurs (void) { serlist *lptr; while (tete_serv) { lptr = tete_serv; tete_serv = tete_serv->suiv; m_libere (lptr, sizeof (serlist)); } } void init_serveur (char *ligne, int nolig) { char nom[80], pg[80], com[80]; serlist *lptr; *com = '\0'; if (sscanf (ligne, "%s %s %[^\n\r]", nom, pg, com) < 2) err_init (nolig); strupr (nom); /* Cherche si le service existe deja */ lptr = tete_serv; while (lptr) { if (strcmp (lptr->nom_serveur, nom) == 0) return; lptr = lptr->suiv; } lptr = tete_serv; if (lptr) { while (lptr->suiv) { lptr = lptr->suiv; } lptr->suiv = (serlist *) m_alloue (sizeof (serlist)); lptr = lptr->suiv; } else { tete_serv = lptr = (serlist *) m_alloue (sizeof (serlist)); } lptr->suiv = NULL; strn_cpy (6, lptr->nom_serveur, nom); strcpy (lptr->nom_pg, pg); strcpy (lptr->com_serveur, com); } #ifdef __WINDOWS__ #pragma argsused #endif void affich_serveurs (int tp) { #ifdef __LINUX__ int tot = 0; char text[80]; serlist *lptr = tete_serv; while (lptr) { ++tot; sprintf (text, "%d: %s", tot, lptr->nom_serveur); InitText (text); lptr = lptr->suiv; } #endif #ifdef __WINDOWS__ int tot = 0; char text[80]; serlist *lptr = tete_serv; while (lptr) { ++tot; wsprintf (text, "%d: %s %s", tot, lptr->nom_serveur, lptr->com_serveur); InitText (text); lptr = lptr->suiv; } #endif #ifdef __FBBDOS__ fen *fen_ptr; serlist *lptr; int size, nb_serv = 0; lptr = tete_serv; while (lptr) { ++nb_serv; lptr = lptr->suiv; } if (nb_serv == 0) return; size = (nb_serv > 19) ? 19 : nb_serv; lptr = tete_serv; deb_io (); #ifdef ENGLISH fen_ptr = open_win (10, 2, 75, 4 + size, INIT, "Servers "); while (lptr) { cprintf ("Server %s: %s \r\n", lptr->nom_serveur, lptr->com_serveur); lptr = lptr->suiv; } attend_caractere (tp); close_win (fen_ptr); #else fen_ptr = open_win (10, 2, 75, 4 + size, INIT, "Services"); while (lptr) { cprintf ("Service %s: %s\r\n", lptr->nom_serveur, lptr->com_serveur); lptr = lptr->suiv; } attend_caractere (tp); close_win (fen_ptr); #endif fin_io (); #endif /* __WINDOWS__ */ } static int is_redist (char *server_name) { if ( (strcmp (server_name, "REDIST") == 0) || (strcmp (server_name, "LOCBBS") == 0) || (strcmp (server_name, "LOCAL") == 0) || (strcmp (server_name, "REGION") == 0) || (strcmp (server_name, "NATION") == 0) ) { return (1); } return (0); } int appel_serveur (serlist * lptr, bullist * pbul) { static int num_file = 1; ind_noeud *noeud; mess_noeud *mptr; FILE *fptr; FILE *fptm; char nom_fichier[80]; char texte[80]; #ifdef __FBBDOS__ int disk; int duplic; char cur_dir[MAXPATH]; char localdir[61]; #endif #ifdef __WINDOWS__ char localdir[61]; #endif int retour = 0; int supprime = 1; /* Affiche le nom du service dans le bandeau */ sprintf (texte, "%-7s", lptr->nom_serveur); aff_chaine (W_STAT, 2, 4, texte); /* Cree le fichier copie */ #ifdef __LINUX__ sprintf (nom_fichier, "%sl_serv%02d.in", DATADIR, num_file); if ((fptr = fopen (nom_fichier, "w")) != NULL) #endif #ifdef __WINDOWS__ sprintf (nom_fichier, "%s\\w_serv%02d.IN", getcwd (localdir, 60), num_file); if ((fptr = fopen (nom_fichier, "wt")) != NULL) #endif #ifdef __FBBDOS__ sprintf (nom_fichier, "%s\\d_serv%02d.IN", getcwd (localdir, 60), num_file); if ((fptr = fopen (nom_fichier, "wt")) != NULL) #endif { fprintf (fptr, "SP %s < %s\n", pbul->desti, pbul->exped); fprintf (fptr, "%s\n", pbul->titre); fflush (fptr); /* Fait une copie du message original */ if ((fptm = ouvre_mess (O_TEXT, pbul->numero, pbul->status)) != NULL) { fflush (fptr); fflush (fptm); copy_fic (fileno (fptm), fileno (fptr), NULL); fprintf (fptr, "\n/EX\n"); ferme (fptm, 75); ferme (fptr, 76); /* Teste les services "speciaux" */ if ((*lptr->nom_pg == '*') && strcmp ("REQCFG", lptr->nom_serveur) == 0) { retour = req_cfg (nom_fichier); } else if ((*lptr->nom_pg == '*') && strcmp ("REDIST", lptr->nom_serveur) == 0) { retour = redist (nom_fichier); } else if ((*lptr->nom_pg == '*') && strcmp ("WP", lptr->nom_serveur) == 0) { if (strcmp (pbul->exped, mycall) == 0) { /* Exped = moi ? */ if (*pbul->bbsv) supprime = 0; /* Ne supprime pas le message */ else retour = wp_service (nom_fichier); } else if (*pbul->bbsv == '\0') retour = wp_service (nom_fichier); /* Exped = autre */ else supprime = 0; } else { #ifdef __LINUX__ char commande[256]; sprintf (commande, "cd %s ; ./%s %s", SERVDIR, lptr->nom_pg, back2slash(nom_fichier)); printf("Server : {%s}\n", commande); /* Appel serveurs via Linux */ retour = system (commande) >> 8; if (retour == 127) retour = -1; if (++num_file == 10) num_file = 1; #endif #ifdef __WINDOWS__ char commande[256]; char *extension; extension = strrchr (lptr->nom_pg, '.'); if (extension && (strcmp (extension, ".DLL") == 0)) { /* DLL appel immediat... */ HINSTANCE hinstFilter; retour = -1; hinstFilter = LoadLibrary (lptr->nom_pg); if (hinstFilter > HINSTANCE_ERROR) { int (FAR PASCAL * DllProc) (int ac, char FAR ** av); int ac = 0; char *av[30]; ac = 0; av[ac++] = lptr->nom_pg; av[ac++] = nom_fichier; av[ac] = NULL; (FARPROC) DllProc = GetProcAddress (hinstFilter, "svc_main"); if (DllProc) retour = (*DllProc) (ac, (char FAR **) av); FreeLibrary (hinstFilter); } } else { sprintf (commande, "%s %s", lptr->nom_pg, nom_fichier); /* Appel serveurs via Windows */ retour = (fbb_exec (commande) == 1) ? 0 : -1; } if (++num_file == 10) num_file = 1; #endif #ifdef __FBBDOS__ deb_io (); /* Stoppe le multitaches */ disk = getdisk (); strcpy (cur_dir, "X:\\"); cur_dir[0] = 'A' + disk; getcurdir (0, cur_dir + 3); operationnel = FALSE; /* Stoppe les stats de taches */ duplic = dup (1); /* Ferme le stdout */ close (1); break_ok (); /* Valide le Ctrl C */ retour = spawnlp (P_WAIT, lptr->nom_pg, lptr->nom_serveur, nom_fichier, NULL); break_stop (); /* Devalide le Ctrl C */ dup2 (duplic, 1); /* Remet le stdout */ close (duplic); operationnel = TRUE; setdisk (disk); chdir (cur_dir); fin_io (); unlink (nom_fichier); #endif /* __WINDOWS__ */ } if ((retour != 0) && (retour != 10)) { /* Erreur de lancement : Envoi d'un message SYSOP */ #ifdef ENGLISH cprintf ("Error starting server %s (%s)\r\n", lptr->nom_serveur, lptr->nom_pg); sprintf (texte, "Error starting server %s (%s)\n", lptr->nom_serveur, lptr->nom_pg); if (w_mask & W_SERVER) mess_warning (admin, "*** SERVER ERROR *** ", texte); #else cprintf ("Erreur appel serveur %s (%s) \r\n", lptr->nom_serveur, lptr->nom_pg); sprintf (texte, "Erreur appel serveur %s (%s) \n", lptr->nom_serveur, lptr->nom_pg); if (w_mask & W_SERVER) mess_warning (admin, "*** ERREUR SERVEUR ***", texte); #endif } if (retour == 10) supprime = 0; } else ferme (fptr, 77); timeprec = 0L; } if (supprime) { if ((mptr = findmess (pbul->numero)) != NULL) { /* Tue le message */ ouvre_dir (); pbul->status = 'K'; write_dir (mptr->noenr, pbul); ferme_dir (); noeud = cher_noeud (pbul->desti); --(noeud->nbnew); --(noeud->nbmess); chg_mess (0xffff, pbul->numero); /* Plus de destinataire */ } } return (supprime); } int ptctrx (int port, char *cmde) { int pp; int ok = 0; char cmdbuf[80]; for (pp = 1; pp < NBPORT; pp++) { if ((HST (pp)) && (p_port[pp].moport & 0x80)) { sprintf (cmdbuf, "!%s", cmde + 3); tnc_commande (pp, cmdbuf, PORTCMD); ok = 1; break; } } /* Les autres ports attendent deux secondes pour etre sur que la commande a ete envoyee */ if ((ok) && (pp != port)) { p_port[port].stop = 2; } return (ok); } fbb-7.04j/src/statis.c0100644000175100017510000002105707726646105012666 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE STATIS.C */ #include static void menu_statistiques (void); static void histo_jour (void) { FILE *fptr; long hist[7], max, sommet, nbc, debtime; int i, d; struct tm *sdate; statis buffstat; for (i = 0; i < 7; hist[i++] = 0L) ; incindd (); tester_masque (); debtime = time (NULL) - (86400L * 14L); fptr = ouvre_stats (); fflush (fptr); nbc = filelength (fileno (fptr)); do { nbc -= (MAXSTAT * (long) sizeof (buffstat)); if (nbc < 0L) { nbc = 0; break; } fseek (fptr, nbc, 0); fread ((char *) &buffstat, sizeof (buffstat), 1, fptr); } while (buffstat.datcnx > debtime); do { if (buffstat.datcnx >= debtime) { char cal[8]; n_cpy (6, cal, buffstat.indcnx); if (strmatch (cal, pvoie->ch_temp)) { sdate = localtime (&buffstat.datcnx); hist[(sdate->tm_wday + 6) % 7] += buffstat.tpscnx; } } } while (fread ((char *) &buffstat, sizeof (buffstat), 1, fptr) == 1); ferme (fptr, 13); sommet = max = 10L; for (i = 0; i < 7; i++) if (hist[i] > max) max = hist[i]; for (i = 0; i < 7; i++) hist[i] = (hist[i] * sommet) / max; texte (T_STA + 3); for (i = (int) sommet; i > 0; i--) { out (" ", 1); for (d = 0; d < 7; d++) { if (hist[d] >= i) out (" *** ", 5); else out (" ", 5); } out ("\r", 1); } outln (" ----------------------------------", 35); texte (T_STA + 4); retour_menu (N_STAT); } static void histo_heure (void) { long hist[24], max, sommet; FILE *fptr; int i, h; long nbc, nbc_total; struct tm *sdate; statis buffstat; long record; for (i = 0; i < 24; hist[i++] = 0L) ; incindd (); tester_masque (); fptr = ouvre_stats (); fflush (fptr); record = filelength (fileno (fptr)); nbc_total = record / (long) sizeof (statis); nbc = record - (MAXSTAT * (long) sizeof (statis)); if (nbc < 0L) nbc = 0L; fseek (fptr, nbc, 0); if (record) { nbc = MAXSTAT; } else { nbc = nbc_total; } while (fread ((char *) &buffstat, sizeof (buffstat), 1, fptr) == 1) { char cal[8]; n_cpy (6, cal, buffstat.indcnx); if (strmatch (cal, pvoie->ch_temp)) { sdate = localtime (&buffstat.datcnx); hist[sdate->tm_hour] += buffstat.tpscnx; } } ferme (fptr, 14); sommet = max = 10L; for (i = 0; i < 24; i++) if (hist[i] > max) max = hist[i]; for (i = 0; i < 24; i++) hist[i] = (hist[i] * sommet) / max; texte (T_STA + 5); for (i = (int) sommet; i > 0; i--) { for (h = 0; h < 24; h++) { if (hist[h] >= i) out ("*", 1); else out (" ", 1); } out ("\r", 1); } outln ("------------------------", 24); texte (T_STA + 6); texte (T_STA + 7); retour_menu (N_STAT); } static void generalites (void) { struct tm *sdate; statis buffstat; FILE *fptr; long nbc = (long) MAXSTAT, nbc_total; int i, nbjour = 0, h1 = 0, h2 = 0; long hist[24], somme_tps = 0L, max1 = 0L, max2 = 0L; long record, depart = 0; for (i = 0; i < 24; hist[i++] = 0L) ; fptr = ouvre_stats (); fflush (fptr); record = filelength (fileno (fptr)); nbc_total = record / (long) sizeof (statis); nbc = record - (MAXSTAT * (long) sizeof (statis)); if (nbc < 0L) nbc = 0L; fseek (fptr, nbc, 0); nbc = 0L; nbjour = 0L; while (fread ((char *) &buffstat, sizeof (buffstat), 1, fptr) == 1) { if (nbjour == 0) { /* Compte le nombre de jours */ nbjour = (int) ((time (NULL) - buffstat.datcnx) / 86400L); /* Fait le calcul sur un nombre de jours entier */ depart = time (NULL) - (long) nbjour *86400L; } sdate = localtime (&buffstat.datcnx); if (buffstat.datcnx > depart) { hist[sdate->tm_hour] += (long) buffstat.tpscnx; ++nbc; } } for (i = 0; i < 24; i++) { somme_tps += hist[i]; if (hist[i] > max1) { h2 = h1; max2 = max1; h1 = i; max1 = hist[i]; } else if (hist[i] > max2) { h2 = i; max2 = hist[i]; } } rewind (fptr); fread ((char *) &buffstat, sizeof (buffstat), 1, fptr); ferme (fptr, 15); texte (T_STA + 8); ltoa (nbc_total, varx[0], 10); if (nbc_total) ptmes->date = buffstat.datcnx; else ptmes->date = time (NULL); texte (T_STA + 9); if (nbc) i = (int) (somme_tps / (long) nbc); else i = 0; itoa (i / 60, varx[0], 10); sprintf (varx[1], "%02d", i % 60); texte (T_STA + 10); if (nbjour == 0) nbjour = 1; ltoa (nbc / (long) nbjour, varx[0], 10); texte (T_STA + 11); itoa (h1, varx[0], 10); itoa (h2, varx[1], 10); texte (T_STA + 12); retour_menu (N_STAT); } static void occupation (void) { long total, stotal; float ftotal; stotal = stemps[N_DOS] + stemps[N_QRA] + stemps[N_INFO] + stemps[N_STAT] + stemps[N_NOMC] + stemps[N_TRAJ]; total = stotal + stemps[N_MBL]; ftotal = ((float) total) / 100.0; if (ftotal == 0.0) { ftotal = 1E-5; } texte (T_STA + 13); sprintf (varx[0], "%4.1f", ((float) stemps[N_MBL]) / ftotal); texte (T_STA + 14); sprintf (varx[0], "%4.1f", ((float) stotal) / ftotal); texte (T_STA + 15); ftotal = (float) (stotal) / 100.0; if (ftotal == 0.0) ftotal = 1E-5; texte (T_STA + 16); sprintf (varx[0], "%4.1f", ((float) stemps[N_DOS]) / ftotal); texte (T_STA + 17); sprintf (varx[0], "%4.1f", ((float) stemps[N_QRA]) / ftotal); texte (T_STA + 18); sprintf (varx[0], "%4.1f", ((float) stemps[N_INFO]) / ftotal); texte (T_STA + 19); sprintf (varx[0], "%4.1f", ((float) stemps[N_STAT]) / ftotal); texte (T_STA + 20); sprintf (varx[0], "%4.1f", ((float) stemps[N_NOMC]) / ftotal); texte (T_STA + 21); sprintf (varx[0], "%4.1f", ((float) stemps[N_TRAJ]) / ftotal); texte (T_STA + 22); retour_menu (N_STAT); } static void liste_connect (void) { char c; FILE *fptr; pvoie->lignes = -1; switch (pvoie->niv3) { case 0: incindd (); tester_masque (); fptr = ouvre_stats (); fseek (fptr, 0L, 2); pvoie->noenr_menu = ftell (fptr); if (page_connect ('\0', fptr)) { texte (T_TRT + 11); maj_niv (3, 1, 1); } else retour_menu (N_STAT); ferme (fptr, 16); break; case 1: c = toupper (*indd); if ((c == 'A') || (c == 'F') || (c == Non)) { maj_niv (3, 0, 0); incindd (); menu_statistiques (); } else { fptr = ouvre_stats (); if (!page_connect ('\0', fptr)) retour_menu (N_STAT); else texte (T_TRT + 11); ferme (fptr, 17); } break; default: fbb_error (ERR_NIVEAU, "LIST-CONN", pvoie->niv3); break; } } /* * MENUS - PREMIER NIVEAU STATISTIQUES */ static void menu_statistiques (void) { int error = 0; char com[80]; limite_commande (); while (*indd && (!ISGRAPH (*indd))) indd++; strn_cpy (70, com, indd); switch (toupper (*indd)) { case 'L': maj_niv (3, 1, 0); liste_connect (); break; case 'I': maj_niv (3, 2, 0); incindd (); liste_indic (); break; case 'J': maj_niv (3, 3, 0); /* maj_niv non necessaire */ histo_jour (); /* histo traite en un seul bloc */ break; case 'H': maj_niv (3, 4, 0); histo_heure (); break; case 'G': maj_niv (3, 5, 0); generalites (); break; case 'O': maj_niv (3, 6, 0); occupation (); break; case 'B': maj_niv (N_MENU, 0, 0); sortie (); break; case 'F': maj_niv (0, 1, 0); incindd (); choix (); break; case '\0': prompt (pvoie->finf.flags, pvoie->niv1); break; default: if (!defaut ()) error = 1; break; } if (error) { cmd_err (indd); } } void statistiques (void) { switch (pvoie->niv2) { case 0: menu_statistiques (); break; case 1: liste_connect (); break; case 2: liste_indic (); break; case 3: histo_jour (); break; case 4: histo_heure (); break; case 5: generalites (); break; case 6: occupation (); break; default: fbb_error (ERR_NIVEAU, "STATS", pvoie->niv2); break; } } fbb-7.04j/src/themes.c0100644000175100017510000010130607726646105012640 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * THEMES.C * * Gestion des themes de bulletins */ #include #define READ_OK(st) ((st.status != 'K') && (st.status != 'A') && (st.status != 'H')) #define iswcard(c) ((c) == '*' || (c) == '?' || (c) == '&' || (c) == '#' || (c) == '@' || (c) == '=') #define isword(c) ((c) == '@' || iswcard(c) || isalnum(c)) #define isope(c) ((c) == '&' || (c) == '|') #define OPE_OR 255 #define OPE_AND 254 #define OPE_NOT 253 #define OPE 252 #define TYP_TO 0 #define TYP_VIA 1 #define MAX_THEMES 250 static int themes_read (int verbose); static void error_file (void); static void libere_theme (void); static void prompt_themes (void); static void trans_num (void); static void group_select(char *ptr); static void group_read(char *ptr); static void group_previous(void); static void group_next(void); static void group_xhdr(char *ptr); static void group_xover(char *ptr); typedef char NomTh[7]; #define LG_THEME 32 typedef struct type_Fields { char typ_field; char *val_field; } Fields; typedef struct type_Equate { Fields fields[256]; int nb_fields; char equ[512]; int nb_equ; } Equate; typedef struct { char nom[LG_THEME+1]; // char nb_themes; // NomTh *lthemes; Equate equate; int nb_bull; long first_bull; long last_bull; } Theme; typedef struct { long msg_num; int grp_num; } grplu; #define NBGRPLU 100 typedef struct typ_grpbloc { grplu *grpel; int nb_tot; int nb_cur; } grpbloc; typedef struct typ_th_date { char nom[LG_THEME+1]; time_t date; int trouve; } th_date; static grpbloc *group_index[MAX_THEMES]; static th_date theme_date[MAX_THEMES*2]; static int tot_themes; static int nolig; static int nb_dates; int scan_pos; char *scan_line; static Theme *theme_liste = NULL; void end_themes (void) { if (theme_liste) libere_theme (); } #define CADENCE 5; void scan_themes (int add) { #ifdef __FBBDOS__ fen *fen_ptr; #endif unsigned offset = 0; int nb = 0; long last_num = 0L; bloc_mess *bptr = tete_dir; bullist ligne; deb_io (); #ifdef __FBBDOS__ #ifdef ENGLISH fen_ptr = open_win (10, 5, 50, 8, INIT, "Themas"); #else fen_ptr = open_win (10, 5, 50, 8, INIT, "Themes"); #endif #endif ouvre_dir (); while (bptr) { if (bptr->st_mess[offset].noenr) { ++nb; read_dir (bptr->st_mess[offset].noenr, &ligne); if ((ligne.type == 'B') && (READ_OK (ligne))) { valide_themes (bptr->st_mess[offset].noenr, add, &ligne); } if ((nb % 100) == 0) { #if defined(__WINDOWS__) || defined(__LINUX__) char buf[80]; sprintf (buf, "%ld", bptr->st_mess[offset].nmess); InitText (buf); #endif #ifdef __FBBDOS__ cprintf ("%ld\r", bptr->st_mess[offset].nmess); #endif } last_num = bptr->st_mess[offset].nmess; } if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } } #if defined(__WINDOWS__) || defined(__LINUX__) { char buf[80]; sprintf (buf, "%ld", last_num); InitText (buf); } #else cprintf ("%ld\r", last_num); #endif ferme_dir (); #ifdef __FBBDOS__ attend_caractere (2); close_win (fen_ptr); #endif fin_io (); } int theme_existe (char *theme, char liste[MAX_THEMES][LG_THEME+1]) { int i; for (i = 0; i < tot_themes; i++) { if (strcmp (theme, liste[i]) == 0) return (1); } return (0); } static void read_dates (void) { int nb; FILE *fptr; memset(theme_date, sizeof(th_date) * MAX_THEMES * 2, 0); fptr = fopen (d_disque ("THEMES.DAT"), "rt"); if (fptr == NULL) return; for (nb_dates = 0 ; nb_dates < MAX_THEMES ; nb_dates++) { nb = fscanf(fptr, "%s %ld\n", theme_date[nb_dates].nom, &theme_date[nb_dates].date); if (nb != 2) break; theme_date[nb_dates].trouve = 0; } fclose(fptr); return; } char *check_dates (time_t date) { int i; int nb = 0; static char buf[4 + (LG_THEME+2) * MAX_THEMES]; for (i = 0 ; i < nb_dates ; i++) { if ((theme_date[i].trouve) && (date < theme_date[i].date)) { nb += sprintf(buf+nb, "%s\r\n", theme_date[i].nom); } } sprintf(buf+nb, ".\r\n"); return buf; } static void write_dates (void) { int i; FILE *fptr = fopen (d_disque ("THEMES.DAT"), "wt"); if (fptr == NULL) return; for (i = 0 ; i < nb_dates ; i++) { if (theme_date[i].trouve) fprintf(fptr, "%s %ld\n", theme_date[i].nom, theme_date[i].date); } fclose(fptr); return; } static void add_date (char *nom) { int i; for (i = 0 ; i < nb_dates ; i++) { if (strcmpi(theme_date[i].nom, nom) == 0) { theme_date[i].trouve = 1; return; } } n_cpy (LG_THEME, theme_date[nb_dates].nom, nom); theme_date[nb_dates].date = time(NULL); theme_date[nb_dates].trouve = 1; printf("%s", ctime(&theme_date[nb_dates].date)); nb_dates++; } static int new_val(Equate *st, int type, char *value) { st->fields[st->nb_fields].val_field = value; st->fields[st->nb_fields].typ_field = type; st->equ[st->nb_equ++] = st->nb_fields++; return 1; } static int new_ope(Equate *st, int operation) { st->equ[st->nb_equ++] = operation; return 1; } static char *next_word(void) { int nb = 0; while (isword(scan_line[scan_pos+nb])) ++nb; if (nb > 0) { char *word = malloc(nb+1); memcpy(word, scan_line+scan_pos, nb); word[nb] = '\0'; scan_pos += nb; return word; } return NULL; } /* return values 0 : OK 1 : unattended character 2 : ')' missing 3 : No memory */ static int expression(Equate *st) { int operation; int type; while (isspace(scan_line[scan_pos])) ++scan_pos; /* 1st word */ if (isope(scan_line[scan_pos])) { return 1; } if (scan_line[scan_pos] ==')') { return 0; } if (scan_line[scan_pos] =='!') { int ret; ++scan_pos; ret = expression(st); if (ret != 0) return ret; new_ope(st, OPE_NOT); } else if (scan_line[scan_pos] == '(') { int ret; ++scan_pos; ret = expression(st); if (ret != 0) return ret; if (scan_line[scan_pos] != ')') return 2; ++scan_pos; } else if (isword(scan_line[scan_pos])) { type = TYP_TO; if (scan_line[scan_pos] == '@') { type = TYP_VIA; ++scan_pos; } if (!new_val(st, type, next_word())) return 3; } else { return 1; } operation = OPE_OR; /* next words */ for (;;) { while (isspace(scan_line[scan_pos])) ++scan_pos; if (scan_line[scan_pos] == '\0') return 0; else if (scan_line[scan_pos] == '&') { ++scan_pos; operation = OPE_AND; continue; } else if (scan_line[scan_pos] == '|') { ++scan_pos; operation = OPE_OR; continue; } else if (scan_line[scan_pos] =='!') { int ret; ++scan_pos; ret = expression(st); if (ret != 0) return ret; new_ope(st, OPE_NOT); continue; } else if (scan_line[scan_pos] == '(') { int ret; ++scan_pos; ret = expression(st); if (ret != 0) return ret; if (scan_line[scan_pos] != ')') return 2; ++scan_pos; } else if (scan_line[scan_pos] ==')') { return 0; } else if (isword(scan_line[scan_pos])) { type = TYP_TO; if (scan_line[scan_pos] == '@') { type = TYP_VIA; ++scan_pos; } if (!new_val(st, type, next_word())) return 3; } else { return 10; } new_ope(st, operation); operation = OPE_OR; } } void load_themes (void) { int i; // int nb; FILE *fptr; char *ptr; char buffer[258]; // NomTh tmp_nom[100]; // NomTh *pnom; struct stat st; char nom_themes[MAX_THEMES][LG_THEME+1]; if ((stat (c_disque ("THEMES.SYS"), &st) == 0) && (st.st_mtime == t_thm)) return; t_thm = st.st_mtime; if (theme_liste) { libere_theme (); theme_liste = NULL; } for (i = 0 ; i < MAX_THEMES ; i++) group_index[i] = NULL; nolig = 0; tot_themes = 0; fptr = fopen (c_disque ("THEMES.SYS"), "rt"); if (fptr == NULL) { return; } while (fgets (buffer, 257, fptr)) { ++nolig; ptr = strtok (buffer, " \t\n"); if ((ptr == NULL) || (*ptr == '#')) continue; if (theme_existe (ptr, nom_themes)) { fclose (fptr); error_file (); tot_themes = 0; return; } n_cpy (10, nom_themes[tot_themes], ptr); ++tot_themes; if (tot_themes == MAX_THEMES) break; } if (tot_themes == 0) { fclose (fptr); return; } theme_liste = (Theme *) m_alloue (tot_themes * sizeof (Theme)); rewind (fptr); read_dates (); tot_themes = 0; while (fgets (buffer, 257, fptr)) { int ret; sup_ln (buffer); ptr = strtok (buffer, " \t"); if ((ptr == NULL) || (*ptr == '#')) continue; n_cpy (LG_THEME, theme_liste[tot_themes].nom, ptr); add_date(ptr); scan_line = strtok (NULL, "\n"); scan_pos = 0; if (scan_line) { ret = expression(&theme_liste[tot_themes].equate); if (ret != 0) { printf("error %d - theme \"%s\" (col %d)\n", ret, theme_liste[tot_themes].nom, strlen(ptr)+scan_pos+1); printf("%s\n", scan_line); for (i = 0 ; i < scan_pos ; i++) putchar(' '); printf("^\n"); } } /* nb = 0; while ((ptr = strtok (NULL, " \t")) != NULL) { n_cpy (6, tmp_nom[nb], ptr); ++nb; } if (nb) pnom = (NomTh *) m_alloue (nb * sizeof (NomTh)); else pnom = NULL; for (i = 0; i < nb; i++) strcpy (pnom[i], tmp_nom[i]); theme_liste[tot_themes].lthemes = pnom; theme_liste[tot_themes].nb_themes = nb; */ theme_liste[tot_themes].nb_bull = 0; theme_liste[tot_themes].first_bull = 1L; theme_liste[tot_themes].last_bull = 0L; ++tot_themes; if (tot_themes == MAX_THEMES) break; } write_dates (); fclose (fptr); scan_themes (0); scan_themes (1); } static int add_to_group(int add, int group, bullist *pbul) { if (group_index[group] == NULL) { group_index[group] = (grpbloc *)calloc(sizeof(grpbloc), 1); if (group_index[group] == NULL) return 0; group_index[group]->nb_tot = NBGRPLU; group_index[group]->grpel = (grplu *)calloc(sizeof(grplu), group_index[group]->nb_tot); if (group_index[group]->grpel == NULL) return 0; } ++theme_liste[group].nb_bull; if (add || pbul->grpnum <= theme_liste[group].last_bull) { pbul->grpnum = ++theme_liste[group].last_bull; pbul->theme = 0L; } if (theme_liste[group].nb_bull == 1) theme_liste[group].first_bull = pbul->grpnum; theme_liste[group].last_bull = pbul->grpnum; group_index[group]->grpel[group_index[group]->nb_cur].msg_num = pbul->numero; group_index[group]->grpel[group_index[group]->nb_cur].grp_num = pbul->grpnum; ++group_index[group]->nb_cur; if (group_index[group]->nb_cur == group_index[group]->nb_tot) { group_index[group]->nb_tot += NBGRPLU; group_index[group]->grpel = (grplu *)realloc(group_index[group]->grpel, sizeof(grplu) * group_index[group]->nb_tot); if (group_index[group]->grpel == NULL) return 0; } return 1; } static long grp_to_bull(int group, int grp_num) { int i; for (i = 0 ; i < group_index[group]->nb_cur ; i++) { if (group_index[group]->grpel[i].grp_num == grp_num) return group_index[group]->grpel[i].msg_num; } return 0L; } int th_check(Equate *st, bullist * pbul) { #define TH_STACK 256 char *to = pbul->desti; char *via = pbul->bbsv; char stack[TH_STACK+1]; int stpos = -1; // int res = 0; int i; int val; stack[0] = 0; for (i = 0 ; i < st->nb_equ ; i++) { int x = st->equ[i]; if (x > OPE) { /* char *op[] = {"ENTER", "OR", "AND" }; int t = -x - 1; printf(" %s ", op[t]); */ if (stpos <= 0) return -1; switch (x) { case OPE_NOT: val = stack[stpos]; stack[stpos] = !val; break; case OPE_AND: val = stack[stpos--]; stack[stpos] &= val; break; case OPE_OR: val = stack[stpos--]; stack[stpos] |= val; break; } } else { int cur = 0; if (stpos == TH_STACK) return -1; /* printf("%d %s", st->fields[x].typ_field, st->fields[x].val_field); */ if (st->fields[x].typ_field == TYP_TO) cur = strmatch(to, st->fields[x].val_field); else if (st->fields[x].typ_field == TYP_VIA) cur = strmatch(via, st->fields[x].val_field); stack[++stpos] = cur; } /* printf("\n"); */ } /* printf("stack = %d, result = %d\n", stpos, stack[stpos]); */ return (stack[stpos]); } /* * * First pass (add = 0) : Validate all already well classed bulletins * Second pass (add = 1): Validate unclassed or new bulletins * */ void valide_themes (unsigned noenr, int add, bullist * pbul) { int i; // , j; int update = 0; /* long val = 1L;*/ long masque = -1L; if (theme_liste == NULL) return; for (i = 1; i < tot_themes; i++) { /* for (j = 0; j < theme_liste[i].nb_themes; j++) { if (strmatch (pbul->desti, theme_liste[i].lthemes[j])) { masque = i; break; } } if (masque != -1L) break; */ if (th_check(&theme_liste[i].equate, pbul)) { /* No duplicate */ masque = i; break; } } if (add == 0) { /* masque must be equal to the theme */ if (pbul->theme == masque) update = 1; } else { /* unclassed or new bulletins */ if (pbul->theme != masque) update = 1; } if (update) { int group = (masque == -1L) ? 0 : (int)masque; add_to_group(add, group, pbul); if (pbul->theme != masque) { pbul->theme = masque; if (noenr != 0) write_dir (noenr, pbul); } } } static void libere_theme (void) { int i; if (theme_liste == NULL) return; for (i = 0; i < NBVOIES; i++) { if ((svoie[i]->niv1 == N_THEMES) && (svoie[i]->niv2 != 0)) { selvoie (i); pvoie->finf.theme = 0; prompt_themes (); } } for (i = 0; i < tot_themes; i++) { int j; Equate *st = &theme_liste[i].equate; for (j = 0 ; j < st->nb_fields; j++) { free(st->fields[j].val_field); } /* if (theme_liste[i].nb_themes) { m_libere (theme_liste[i].lthemes, theme_liste[i].nb_themes * sizeof (NomTh)); } */ } m_libere (theme_liste, tot_themes * sizeof (Theme)); theme_liste = NULL; tot_themes = 0; } char *cur_theme (int voie) { return (theme_liste[(int)svoie[voie]->finf.theme].nom); } int nbull_theme (int voie) { return (theme_liste[(int)svoie[voie]->finf.theme].nb_bull); } static void prompt_themes (void) { maj_niv (N_THEMES, 0, 0); pvoie->sr_mem = 0; texte (T_THE + 2); } static void list_topics (void) { /* int i; char s[100]; int numero = pvoie->finf.theme; for (i = 0; i < theme_liste[numero].nb_themes; i++) { sprintf (s, " %-6s", theme_liste[numero].lthemes[i]); out (s, strlen (s)); if ((i + 1) % 8 == 0) cr (); } if (i % 8) cr (); */ } static void display_themes (void) { int i; char s[100]; for (i = 0; i < tot_themes; i++) { sprintf (s, "%2d:%-25s %-4d", i, theme_liste[i].nom, theme_liste[i].nb_bull); out (s, strlen (s)); if ((i + 1) % 2 == 0) cr (); else out (" ", 5); } if (i % 2) cr (); prompt_themes (); } static char *ltitre (int mode, bullist * pbul) /* Mode = 1 pour LS */ { /* int lg = (mode) ? 80 : 36 ; */ int lg = 80; static char buf[100]; if (pvoie->typlist) { sprintf (buf, "%-12s ", pbul->bid); if (mode) strn_cpy (lg, buf + 13, pbul->titre); else n_cpy (lg, buf + 13, pbul->titre); } else { if (mode) strn_cpy (lg, buf, pbul->titre); else n_cpy (lg, buf, pbul->titre); } return (buf); } static void alloue_list_numeros (void) { if (pvoie->ptemp) { m_libere ((char *) pvoie->ptemp, pvoie->psiz); pvoie->ptemp = NULL; pvoie->psiz = 0; } pvoie->psiz = pvoie->temp2 * sizeof (long); pvoie->ptemp = m_alloue (pvoie->psiz); } static void aff_ligne (int numero, bullist * ligne) { char *ptr; *ptmes = *ligne; if (*(ligne->bbsv)) sprintf (varx[0], "@%-6s", bbs_via (ligne->bbsv)); else strcpy (varx[0], " "); var_cpy (1, ltitre (0, ligne)); ptmes->numero = (long) numero; ptr = var_txt (langue[vlang]->plang[T_THE + 1 - 1]); if (strlen (ptr) > 80) { ptr[79] = '\r'; ptr[80] = '\0'; } outs (ptr, strlen (ptr)); } static int entete_theme (void) { return (texte (T_THE + 0)); } static int themes_bloc_liste (void) { long *num_list; int retour = 1; int num_lig = 0; int max_lig; int group; unsigned offset = pvoie->recliste.offset; bloc_mess *bptr = pvoie->recliste.ptemp; bullist ligne; num_list = (long *) pvoie->ptemp; if ((num_list == NULL) || (pvoie->psiz == 0)) return (retour); pvoie->sr_mem = pvoie->seq = FALSE; group = (pvoie->finf.theme == 0) ? -1 : pvoie->finf.theme; max_lig = pvoie->psiz / sizeof (long); num_lig = max_lig - pvoie->temp2; ouvre_dir (); while (bptr) { /* Pb debordement du tableau ! */ if (num_lig >= max_lig) { retour = 2; break; } if (!pvoie->reverse) --offset; if (bptr->st_mess[offset].noenr) { read_dir (bptr->st_mess[offset].noenr, &ligne); if ((ligne.type == 'B') && (READ_OK (ligne))) { if (ligne.theme == group) { if (pvoie->temp1) { pvoie->temp2 -= entete_theme (); pvoie->temp1 = 0; } num_list[num_lig++] = ligne.numero; aff_ligne (num_lig, &ligne); --pvoie->temp2; } } if (pvoie->temp2 == 0) { retour = 2; break; } } if (pvoie->reverse) { if (++offset == T_BLOC_MESS) { bptr = bptr->suiv; offset = 0; } } else { if (offset == 0) { bptr = prec_dir (bptr); offset = T_BLOC_MESS; } } if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; retour = 0; break; } if (trait_time > MAXTACHE) { pvoie->seq = TRUE; retour = 0; break; } } ferme_dir (); pvoie->recliste.offset = offset; pvoie->recliste.ptemp = bptr; return (retour); } int themes_lx (void) { pvoie->temp1 = 1; if (pvoie->reverse) { pvoie->recliste.ptemp = tete_dir; pvoie->recliste.offset = 0; } else { pvoie->recliste.ptemp = last_dir (); pvoie->recliste.offset = T_BLOC_MESS; } return (1); } int themes_rx (int verbose) { int error = 0; long no; int c, ok = TRUE; bullist *pbul; rd_list *ptemp = NULL; df ("themes_rx", 1); /* print_fonction(stdout); print_history(stdout); sleep_(10); for (;;); */ sup_ln (indd); c = toupper (*indd); ++indd; if ((c != ' ') && (*indd != ' ') && (*indd != '\0')) { ff (); return (1); } pvoie->aut_nc = 1; libere_tread (voiecur); init_recliste (voiecur); pvoie->recliste.l = verbose; switch (c) { /* case 'A' : pvoie->recliste.status = 'A' ; break ; case 'L' : if (teste_espace()) { if (isdigit(*indd)) pvoie->recliste.last = lit_chiffre(0) ; else { texte(T_ERR + 3) ; ok = 0 ; } } else { --indd; error = 1; ok = 4 ; } break ; case 'M' : case 'N' : if (read_mine(c)) ok = 2 ; else ok = 0 ; break ; case 'S' : if (teste_espace()) strn_cpy(19, pvoie->recliste.find, indd) ; else { --indd; error = 1; ok = 4 ; } break ; case '<' : if (teste_espace()) { strn_cpy(6, pvoie->recliste.exp, indd) ; } else { texte(T_ERR + 2) ; ok = 0 ; } break ; case '>' : if (teste_espace()) { strn_cpy(6, pvoie->recliste.dest, indd) ; } else { texte(T_ERR + 2) ; ok = 0 ; } break ; */ case ' ': trans_num (); /*if (strchr(indd, '-')) { if (isdigit(*indd)) pvoie->recliste.debut = lit_chiffre(1) ; else { texte(T_ERR + 3) ; ok = 0 ; break ; } ++indd ; if (isdigit(*indd)) pvoie->recliste.fin = lit_chiffre(1) ; if (pvoie->recliste.fin <= pvoie->recliste.debut) ok = 0 ; } else { */ ok = 0; while ((no = lit_chiffre (1)) != 0L) { if ((pbul = ch_record (NULL, no, 'Y')) != NULL) { if (droit_ok (pbul, 1)) { if (ptemp) { ptemp->suite = (rd_list *) m_alloue (sizeof (rd_list)); ptemp = ptemp->suite; } else { pvoie->t_read = ptemp = (rd_list *) m_alloue (sizeof (rd_list)); } ptemp->suite = NULL; ptemp->nmess = no; ptemp->verb = verbose; ok = 2; } else texte (T_ERR + 10); } else texte (T_ERR + 10); } /* } */ break; default: if ((c == '\0') && (verbose)) { texte (T_MBL + 8); ok = 0; } else { error = 1; --indd; ok = 4; } break; } switch (ok) { case 0: prompt_themes (); break; case 1: pvoie->recliste.ptemp = last_dir (); pvoie->recliste.offset = T_BLOC_MESS; pvoie->temp1 = 1; pvoie->sr_mem = 1; ch_niv3 (1); themes_read (verbose); break; case 2: pvoie->sr_mem = 1; ch_niv3 (2); themes_read (verbose); break; } ff (); return (error); } static int themes_read (int verbose) { int error = 0; df ("themes_read", 1); switch (pvoie->niv3) { case 0: ++indd; error = themes_rx (verbose); break; case 1: switch (mbl_bloc_list ()) { case 0: /* Pas de message */ texte (T_MBL + 3); prompt_themes (); case 1: /* Pas fini */ break; case 2: /* Termine */ ch_niv3 (2); mbl_read (verbose); break; } break; case 2: if (mbl_mess_read () == 0) { prompt_themes (); } break; case 3: if (read_mess (1) == 0) ch_niv3 (2); break; default: fbb_error (ERR_NIVEAU, "MSG-READ", pvoie->niv3); } ff (); return (error); } static void trans_num (void) { char s[256]; char buf[80]; char *ptr; int num; int i; n_cpy (255, s, indd); *indd = '\0'; ptr = s; while (*ptr) { if (isdigit (*ptr)) { i = 0; while (isdigit (*ptr)) { buf[i++] = *ptr++; } buf[i] = '\0'; num = atoi (buf) - 1; if ((num >= 0) && (num < (pvoie->psiz / sizeof (long)))) { long lnum; lnum = ((long *) pvoie->ptemp)[num]; strcat (indd, ltoa (lnum, buf, 10)); } else { /* Erreur */ } } else { buf[0] = *ptr++; buf[1] = '\0'; strcat (indd, buf); } } } int themes_list (void) { int mode_list = 1; int verbose = 0; int error = 0; switch (pvoie->niv3) { case 0: if (toupper (*indd) == 'C') { return (list_lc ()); } switch (themes_lx ()) { case 0: prompt_themes (); case 2: mode_list = 0; break; case 1: pvoie->temp2 = nbl_page (voiecur); alloue_list_numeros (); ch_niv3 (1); break; case 3: mode_list = 0; error = 1; --indd; break; } break; case 1: break; case 2: while_space (); switch (toupper (*indd)) { case 'A': mode_list = 0; prompt_themes (); break; case 'V': verbose = 1; case 'R': mode_list = 0; incindd (); if (isdigit (*indd)) { trans_num (); pvoie->aut_nc = 1; list_read (verbose); pvoie->sr_mem = 1; if (mbl_mess_read () == 0) { pvoie->sr_mem = 0; texte (T_QST + 6); } } else { texte (T_ERR + 3); texte (T_QST + 6); } break; default: pvoie->temp2 = nbl_page (voiecur); alloue_list_numeros (); ch_niv3 (1); break; } break; case 3: mode_list = 0; pvoie->aut_nc = 1; if (read_mess (1) == 0) ch_niv3 (4); break; case 4: mode_list = 0; pvoie->aut_nc = 1; pvoie->sr_mem = 1; if (mbl_mess_read () == 0) { pvoie->sr_mem = 0; texte (T_QST + 6); ch_niv3 (2); } break; default: fbb_error (ERR_NIVEAU, "MSG-LIST", pvoie->niv3); } if (mode_list) { pvoie->lignes = -1; switch (themes_bloc_liste ()) { case 0: break; case 1: prompt_themes (); break; case 2: texte (T_QST + 6); ch_niv3 (2); break; } } return (error); } int nom_theme (char *nom) { int i; strupr (sup_ln (nom)); if (strlen(nom) > 2) { for (i = 0; i < tot_themes; i++) { if (strncmpi (theme_liste[i].nom, nom, strlen(nom)) == 0) { pvoie->finf.theme = i; list_topics (); prompt_themes (); return (1); } } } return (0); } void theme_err (char *ptri) { int i = 0; char *ptr = varx[0]; while (ISGRAPH (*ptri)) { if (++i == 40) break; else *ptr++ = *ptri++; } *ptr = '\0'; texte (T_ERR + 1); *varx[0] = '\0'; if ((FOR (pvoie->mode)) || (++pvoie->nb_err == MAX_ERR)) pvoie->deconnect = 6; else prompt_themes (); } int menu_themes (void) { int error = 0; int verbose = 0; char *com = indd; if (tot_themes == 0) { texte (T_DOS + 2); retour_mbl (); return (error); } if (nom_theme (indd)) return (error); switch (toupper (*indd)) { case 'H': display_themes (); break; case 'Q': case 'F': retour_mbl (); break; case 'L': ch_niv2 (1); error = themes_list (); break; case 'V': verbose = 1; case 'R': ch_niv2 (2); error = themes_read (verbose); break; case 'B': maj_niv (N_MENU, 0, 0); sortie (); break; default: if (isdigit (*indd)) { int select = atoi (indd); if ((select >= 0) && (select < tot_themes) && (theme_liste[select].nb_bull)) { pvoie->finf.theme = select; list_topics (); } else { texte (T_DOS + 2); } prompt_themes (); } else if (!ISGRAPH (*indd)) { display_themes (); } else { error = 1; } break; } if (error) theme_err (com); return (error); } int themes (void) { int ret = 0; if (POP (no_port(voiecur))) { incindd (); switch (*indd) { case 'G': /* Select group "G name" */ incindd(); group_select(indd); break; case 'P': /* Select previous bulletin in the theme */ group_previous(); break; case 'N': /* Select next bulletin in the theme */ group_next(); break; case 'R': /* Read a bulletin number "R mode #nb" */ incindd(); group_read(indd); break; case 'H': /* Read a bulletin number "R mode #nb" */ incindd(); group_xhdr(indd); break; case 'O': /* Read a bulletin number "R mode #nb" */ incindd(); group_xover(indd); break; default : ret = 1; break; } retour_mbl(); return ret; } switch (pvoie->niv2) { case 0: ret = menu_themes (); break; case 1: ret = themes_list (); break; case 2: ret = themes_read (0); break; default : ret = 0; break; } return (ret); } static void error_file (void) { char wtexte[200]; deb_io (); #ifdef ENGLISH if (operationnel) { sprintf (wtexte, "\r\nError in file THEMES.SYS line %d \r\n\a", nolig); if (w_mask & W_FILE) mess_warning (admin, "*** FILE ERROR *** ", wtexte); } sprintf (wtexte, "Error in file THEMES.SYS line %d ", nolig); #else if (operationnel) { sprintf (wtexte, "\r\nErreur fichier THEMES.SYS ligne %d\r\n\a", nolig); if (w_mask & W_FILE) mess_warning (admin, "*** ERREUR FICHIER ***", wtexte); } sprintf (wtexte, "Erreur fichier THEMES.SYS ligne %d", nolig); #endif fin_io (); win_message (5, wtexte); } /* Functions for the NNTP server */ static int n_theme; static int pos_theme(char *nom) { int i; strupr (sup_ln (nom)); for (i = 0; i < tot_themes; i++) { if (strcmpi (theme_liste[i].nom, nom) == 0) return i; } return -1; } char *next_group (void) { static char cur_buf[80]; if (n_theme >= tot_themes) return NULL; sprintf(cur_buf, "%s %ld %ld %c", theme_liste[n_theme].nom, theme_liste[n_theme].last_bull, theme_liste[n_theme].first_bull, 'n'); ++n_theme; return cur_buf; } char *first_group (void) { load_themes(); n_theme = 0; return next_group(); } char *get_group_info(char *nom, char *buffer) { int val = pos_theme (nom); if (val == -1) return NULL; sprintf(buffer, "%d %ld %ld %s", theme_liste[val].nb_bull, theme_liste[val].first_bull, theme_liste[val].last_bull, theme_liste[val].nom); return buffer; } static int group_st(char *buffer, long nbul, int mode) { char *strm[4] = {"text follows", "head follows", "body follows", "statistics"}; int intm[4] = {220, 221, 222, 223}; bullist *pbul = NULL; int cur_theme = pvoie->groupe; int ret = 0; if (cur_theme == -1) { strcpy(buffer, "412 No group selected"); } else if (nbul == -1L) { strcpy(buffer, "420 No current bulletin"); } else { long numero; int group = (cur_theme == 0) ? -1 : cur_theme; numero = grp_to_bull(cur_theme, nbul); pbul = ch_record (NULL, numero, ' '); if (pbul == NULL) strcpy(buffer, "430 No such bulletin"); else if (pbul->theme != group) strcpy(buffer, "423 No such bulletin in the current group"); else { sprintf(buffer, "%d %ld <%ld@%s> - %s", intm[mode], nbul, numero, mycall, strm[mode]); pvoie->cur_bull = nbul; ret = 1; } } return (ret); } static int get_range(char *ptr, long *first, long *last) { char *scan; *first = 0; *last = 0x7fffffff; if (*ptr) { *first = atol(ptr); scan = strchr(ptr, '-'); if (scan) { ++scan; if (isdigit(*scan)) *last = atol(scan); } else { *last = *first; } } return 1; } static void send_overview(long numero, bullist *pbul) { char buffer[256]; int nb; nb = sprintf(buffer, "%ld\t[%s] %s\t%s\t%s\t<%ld@%s>\t\t%ld\t%d", /* pbul->numero,*/ numero, pbul->desti, pbul->titre, pbul->exped, pop_date(pbul->datesd), pbul->numero, mycall, /* reference, ? */ pbul->taille, 1); outsln(buffer, nb); } static void group_xover(char *ptr) { char buffer[80]; long nbul; long numero; bullist *pbul; long first, last; int cur_theme; cur_theme = (int)pvoie->groupe; if (cur_theme == -1) { strcpy(buffer, "412 No group selected\r\032"); } else { if (get_range(ptr, &first, &last)) { if (last > theme_liste[cur_theme].last_bull) last = theme_liste[cur_theme].last_bull; strcpy(buffer, "224 Overview information"); outsln(buffer, strlen(buffer)); ouvre_dir (); for (nbul = first ; nbul <= last ; nbul++) { if (nbul < theme_liste[cur_theme].first_bull || nbul > theme_liste[cur_theme].last_bull) continue; numero = grp_to_bull(cur_theme, nbul); if (numero > 0L) { pbul = ch_record (NULL, numero, ' '); send_overview(nbul, pbul); } } ferme_dir (); outsln("\033\r", 2); return; } else { strcpy(buffer, "420 No bulletin selected\r\032"); } } outsln(buffer, strlen(buffer)); } static void group_select(char *ptr) { int val = pos_theme (ptr); int nb; char buf[80]; if (val == -1) { nb = sprintf(buf, "411 No such group"); } else { pvoie->groupe = val; nb = sprintf(buf, "211 %d %ld %ld %s", theme_liste[val].nb_bull, theme_liste[val].first_bull, theme_liste[val].last_bull, theme_liste[val].nom); } outsln(buf, nb); } static void group_read(char *ptr) { char buffer[80]; char *scan; int mode; int ret; long numero = pvoie->cur_bull; scan = strchr(ptr, '<'); if (scan) { /* Get by ID */ sscanf(ptr, "%d", &mode); ++scan; numero = atol(scan); } else { /* Get by number */ sscanf(ptr, "%d %ld", &mode, &numero); } ret = group_st(buffer, numero, mode); outsln(buffer, strlen(buffer)); if (ret) { if (!scan) { /* update the current bulletin number */ pvoie->cur_bull = numero; } if (mode != 3) { int cur_theme = pvoie->groupe; int group = (cur_theme == -1L) ? 0 : cur_theme; long nbul = grp_to_bull(group, numero); sprintf(indd, " %ld\r", nbul); mbl_read (0); } } else { outsln("\032\r", 2); } } static void group_next(void) { char buffer[80]; int trouve = 0; int cur_theme = pvoie->groupe; long nbul = pvoie->cur_bull; if (cur_theme == -1) { strcpy(buffer, "412 No group selected"); } else if (nbul == -1L) { strcpy(buffer, "420 No current bulletin"); } else { while (nbul < theme_liste[cur_theme].last_bull) { ++nbul; if (grp_to_bull(cur_theme, nbul) != 0L) { trouve = 1; break; } } if (trouve) { group_st(buffer, nbul, 3); } else { strcpy(buffer, "422 No next bulletin in group"); } } outsln(buffer, strlen(buffer)); } static void group_previous(void) { char buffer[80]; int trouve = 0; int cur_theme = pvoie->groupe; long nbul = pvoie->cur_bull; if (cur_theme == -1) { strcpy(buffer, "412 No group selected"); } else if (nbul == -1L) { strcpy(buffer, "420 No current bulletin"); } else { while (nbul > theme_liste[cur_theme].first_bull) { --nbul; if (grp_to_bull(cur_theme, nbul) != 0L) { trouve = 1; break; } } if (trouve) { group_st(buffer, nbul, 3); } else { strcpy(buffer, "422 No previous bulletin in group"); } } outsln(buffer, strlen(buffer)); } static void group_xhdr(char *ptr) { /* char head[80]; char range[80]; sscanf(ptr, "%s %s", head, range); if (strcmpi(head, "subject) != 0) */ } fbb-7.04j/src/tnc.c0100644000175100017510000010411307726646105012136 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE TNC.C : INTERFACE AVEC LE TNC - MODE DUPLEX */ #include static int capture = 0; static int ch_canal (int); static int open_capture (void); static int pactor_cq (void); static void disp_freq (int); static void close_capture (void); static void gw_help (void); static void prog_indic (int); static void tnc_cmd (int, int); #define TNC_START 1 #define TNC_END 2 int connect_tnc (void) { df ("connect_tnc", 0); if (svoie[CONSOLE]->sta.connect) return (0); selvoie (CONSOLE); strn_cpy (6, pvoie->sta.indicatif.call, cons_call.call); pvoie->sta.indicatif.num = cons_call.num; if (voiecur == CONSOLE) { pvoie->timout = time_n; capture = 0; } else pvoie->timout = time_n; pvoie->tstat = pvoie->debut = time (NULL); pvoie->l_mess = 0L; pvoie->l_yapp = 0L; pvoie->ret = 0; pvoie->sid = 0; pvoie->pack = 0; pvoie->read_only = 0; pvoie->vdisk = 2; pvoie->msg_held = 0; pvoie->xferok = pvoie->mess_recu = 1; pvoie->mbl = 0; init_timout (voiecur); pvoie->temp3 = 0; pvoie->nb_err = 0; console = 1; maj_niv (N_TELL, 0, 0); pvoie->deconnect = FALSE; console_on (); aff_event (CONSOLE, 1); connexion (voiecur); nouveau (voiecur); pvoie->sta.connect = 16; change_droits (voiecur); aff_nbsta (); curseur (); ff (); return (TRUE); } static int open_capture (void) { capture = open (pvoie->appendf, O_CREAT | O_APPEND | O_WRONLY | O_TEXT, S_IREAD | S_IWRITE); if (capture < 0) { texte (T_ERR + 11); return (0); } return (capture); } static void close_capture (void) { close (capture); } void write_capture (char *text, int len) { int lg; char *ptr = text; if ((voiecur != CONSOLE) || (capture == 0)) return; for (lg = 0; lg < len; lg++) { if (*ptr == '\r') *ptr = '\n'; ++ptr; } if (open_capture ()) { write (capture, text, len); close_capture (); } ptr = text; for (lg = 0; lg < len; lg++) { if (*ptr == '\n') *ptr = '\r'; ++ptr; } } void duplex_tnc (void) { char *ptr; char s[81]; char buffer[300]; struct stat bufstat; int nb, novoie, fin, save_voie, noport, prompt = 1; int command; switch (pvoie->niv3) { case 0: if (read_only ()) { fin_tnc (); break; } pvoie->lignes = -1; texte (T_GAT + 0); aff_freq (); texte (T_GAT + 1); ch_niv3 (1); break; case 1: sup_ln (indd); strupr (indd); if ((*indd == 'E') || (*indd == 'Q')) fin_tnc (); else if (*indd == 'H') { gw_help (); texte (T_GAT + 1); } else { noport = *indd - '0'; if ((voiecur != CONSOLE) && (noport == no_port (voiecur))) { texte (T_GAT + 6); texte (T_GAT + 1); } else { if ((noport > 0) && (noport < NBPORT) && (p_port[noport].pvalid) && (((p_port[noport].moport & 0x8) == 0) || (voiecur == CONSOLE)) && ((p_port[noport].moport & 0x10) || (droits (ACCGATE)))) { if ((novoie = ch_canal (noport)) > 0) { /* *getvoie(novoie] = *pvoie; */ svoie[novoie]->debut = time (NULL); svoie[novoie]->kiss = voiecur; init_timout (novoie); svoie[novoie]->sta.connect = 17; svoie[novoie]->lignes = -1; svoie[novoie]->xferok = 1; svoie[novoie]->msg_held = 0; svoie[novoie]->mess_recu = 1; set_binary (novoie, 0); svoie[novoie]->pack = 0; svoie[novoie]->read_only = 0; svoie[novoie]->vdisk = 2; svoie[novoie]->mbl = 0; svoie[novoie]->finf.lang = pvoie->finf.lang; svoie[novoie]->l_mess = 0L; svoie[novoie]->l_yapp = 0L; svoie[novoie]->temp3 = 0; svoie[novoie]->nb_err = 0; svoie[novoie]->niv1 = 0; svoie[novoie]->niv2 = 0; svoie[novoie]->niv3 = 0; if (voiecur == CONSOLE) { *svoie[novoie]->passwd = 'O'; svoie[novoie]->finf.flags |= F_SYS; } pvoie->cross_connect = novoie; itoa ((novoie > 0) ? novoie - 1 : 0, varx[0], 10); var_cpy (1, p_port[noport].freq); texte (T_GAT + 2); if (p_port[no_port (novoie)].typort == TYP_BPQ) { command = 1; sta_drv (novoie, CMDE, (void *) &command); texte (T_GAT + 5); ch_niv3 (3); } else { texte (T_GAT + 4); ch_niv3 (2); } prog_indic (novoie); aff_nbsta (); tnc_cmd (TNC_START, novoie); } else { texte (T_GAT + 3); texte (T_GAT + 1); } } else { texte (T_GAT + 7); texte (T_GAT + 1); } } } break; case 2: sup_ln (indd); strupr (indd); pvoie->lignes = -1; if (strlen (indd)) { *buffer = '\0'; *indd = toupper (*indd); #ifndef __LINUX__ if (p_port[no_port (pvoie->cross_connect)].typort == TYP_MOD) { switch (*indd) { case 'Q': case 'E': save_voie = voiecur; pvoie->ch_mon = -1; selvoie (pvoie->cross_connect); dec (voiecur, 1); selvoie (save_voie); fin_tnc (); return; case 'D': save_voie = voiecur; selvoie (pvoie->cross_connect); md_no_echo (voiecur); dec (voiecur, 1); selvoie (save_voie); break; case 'K': texte (T_GAT + 5); ch_niv3 (3); return; case 'P': save_voie = voiecur; pvoie->ch_mon = -1; selvoie (pvoie->cross_connect); dec (voiecur, 1); tnc_cmd (TNC_END, voiecur); if (p_port[no_port (voiecur)].typort == TYP_MOD) re_init_modem (voiecur); pvoie->kiss = -1; pvoie->sta.connect = FALSE; selvoie (save_voie); pvoie->cross_connect = -1; incindd (); if (*indd) ch_niv3 (1); else ch_niv3 (0); duplex_tnc (); return; case 'S': if (voiecur != CONSOLE) { indd[40] = '\0'; var_cpy (0, indd); texte (T_GAT + 9); break; } if (svoie[pvoie->cross_connect]->sta.connect) { incindd (); strcpy (pvoie->appendf, indd); if ((stat (pvoie->appendf, &bufstat) == -1) || ((bufstat.st_mode & S_IFREG) == 0)) { texte (T_ERR + 11); break; } texte (T_GAT + 10); save_voie = voiecur; pvoie->ch_mon = -1; selvoie (pvoie->cross_connect); status (voiecur); strcpy (pvoie->sr_fic, indd); pvoie->enrcur = 0L; fin = senddata (0); if (!fin) { maj_niv (N_TELL, 0, 4); prompt = 0; } selvoie (save_voie); if (!fin) ch_niv3 (5); else { texte (T_GAT + 5); ch_niv3 (3); } } else texte (T_GAT + 3); break; case 'W': if (voiecur != CONSOLE) { indd[40] = '\0'; var_cpy (0, indd); texte (T_GAT + 9); break; } if (svoie[pvoie->cross_connect]->sta.connect) { incindd (); if (*indd) { strcpy (pvoie->appendf, indd); if (open_capture ()) { texte (T_GAT + 11); close (capture); } } else { if (capture) { texte (T_GAT + 12); capture = 0; } else texte (T_ERR + 0); } } else texte (T_GAT + 3); break; default: save_voie = voiecur; selvoie (pvoie->cross_connect); outln (indd, strlen (indd)); selvoie (save_voie); break; } } else if (p_port[no_port (pvoie->cross_connect)].typort != TYP_BPQ) #endif { /* DED && KAM && FLEX && LINUX */ switch (*indd) { case 'Q': case 'E': save_voie = voiecur; pvoie->ch_mon = -1; selvoie (pvoie->cross_connect); dec (voiecur, 1); dec (voiecur, 1); selvoie (save_voie); fin_tnc (); return; case 'K': prog_indic (pvoie->cross_connect); texte (T_GAT + 5); ch_niv3 (3); return; case 'C': pvoie->ch_mon = -1; if (*(indd + 1) == 'Q') { if (!pactor_cq ()) texte (T_ERR + 2); } else if ((*(indd + 1) != ' ') && (p_port[no_port (voiecur)].typort != TYP_BPQ)) { texte (T_ERR + 2); } else { save_voie = voiecur; selvoie (pvoie->cross_connect); *buffer = '\0'; if (p_port[no_port (voiecur)].typort == TYP_PK) *(indd + 1) = 'O'; nb = 0; deb_io (); switch (p_port[no_port (voiecur)].typort) { case TYP_DED: case TYP_HST: prog_indic (voiecur); if (!IS_PACTOR (no_port (voiecur)) && (DRSI (no_port (voiecur)) || HST (no_port (voiecur)))) { while (ISGRAPH (*indd)) ++indd; while (isspace (*indd)) ++indd; sprintf (buffer, "C %d:%s", p_port[no_port (voiecur)].ccanal, indd); } else strcpy (buffer, indd); tnc_commande (voiecur, buffer, SNDCMD); break; case TYP_PK: tnc_commande (voiecur, indd, SNDCMD); break; case TYP_KAM: kam_commande (voiecur, indd); break; case TYP_BPQ: texte (T_GAT + 5); ch_niv3 (3); break; #ifdef __WINDOWS__ case TYP_AGW: #endif case TYP_SCK: case TYP_TCP: case TYP_ETH: case TYP_FLX: prog_indic (voiecur); tnc_commande (voiecur, indd, SNDCMD); break; } fin_io (); selvoie (save_voie); outs (buffer, nb); aff_nbsta (); } break; case 'D': save_voie = voiecur; selvoie (pvoie->cross_connect); *buffer = '\0'; nb = 0; deb_io (); switch (p_port[no_port (voiecur)].typort) { case TYP_DED: case TYP_HST: case TYP_SCK: case TYP_TCP: case TYP_ETH: case TYP_FLX: #ifdef __WINDOWS__ case TYP_AGW: #endif tnc_commande (voiecur, "D", SNDCMD); break; case TYP_PK: tnc_commande (voiecur, "DI", SNDCMD); break; case TYP_KAM: kam_commande (voiecur, "D"); break; } fin_io (); selvoie (save_voie); outs (buffer, nb); break; case 'J': j_list ((char) no_port (pvoie->cross_connect) + '0'); break; case 'M': if (pvoie->ch_mon == -1) { pvoie->ch_mon = no_port (pvoie->cross_connect); sprintf (s, "%s: MONITOR ON", my_call); } else { pvoie->ch_mon = -1; sprintf (s, "%s: MONITOR OFF", my_call); } outln (s, strlen (s)); break; case 'P': save_voie = voiecur; pvoie->ch_mon = -1; selvoie (pvoie->cross_connect); dec (voiecur, 1); dec (voiecur, 1); tnc_cmd (TNC_END, voiecur); #ifndef __LINUX__ if (p_port[no_port (voiecur)].typort == TYP_MOD) re_init_modem (voiecur); #endif pvoie->kiss = -1; pvoie->sta.connect = FALSE; selvoie (save_voie); pvoie->cross_connect = -1; incindd (); if (*indd) ch_niv3 (1); else ch_niv3 (0); duplex_tnc (); return; case 'S': if (voiecur != CONSOLE) { indd[40] = '\0'; var_cpy (0, indd); texte (T_GAT + 9); break; } if (svoie[pvoie->cross_connect]->sta.connect) { incindd (); strcpy (pvoie->appendf, indd); if ((stat (pvoie->appendf, &bufstat) == -1) || ((bufstat.st_mode & S_IFREG) == 0)) { texte (T_ERR + 11); break; } texte (T_GAT + 10); save_voie = voiecur; pvoie->ch_mon = -1; selvoie (pvoie->cross_connect); status (voiecur); strcpy (pvoie->sr_fic, indd); pvoie->enrcur = 0L; fin = senddata (0); if (!fin) { maj_niv (N_TELL, 0, 4); prompt = 0; } selvoie (save_voie); if (!fin) ch_niv3 (5); else { texte (T_GAT + 5); ch_niv3 (3); } } else texte (T_GAT + 3); break; case 'W': if (voiecur != CONSOLE) { indd[40] = '\0'; var_cpy (0, indd); texte (T_GAT + 9); break; } if (svoie[pvoie->cross_connect]->sta.connect) { incindd (); if (*indd) { strcpy (pvoie->appendf, indd); if (open_capture ()) { texte (T_GAT + 11); close (capture); } } else { if (capture) { texte (T_GAT + 12); capture = 0; } else texte (T_ERR + 0); } } else texte (T_GAT + 3); break; case 'Y': if (voiecur != CONSOLE) { indd[40] = '\0'; var_cpy (0, indd); texte (T_GAT + 9); break; } if (svoie[pvoie->cross_connect]->sta.connect) { strcpy (pvoie->dos_path, "\\"); ptr = ++indd; if (toupper (*ptr) == 'U') *ptr = 'D'; else if (toupper (*ptr) == 'D') *ptr = 'U'; incindd (); strcpy (pvoie->appendf, indd); if (*ptr == 'D') { #ifdef ENGLISH sprintf (buffer, "Yapp sending %s ...", indd); #else sprintf (buffer, "Yapp envoie %s ... ", indd); #endif #ifdef __FBBDOS__ trait (0, buffer); #endif } else { #ifdef ENGLISH sprintf (buffer, "Yapp receiving %s ...", indd); #else sprintf (buffer, "Yapp reoit %s ... ", indd); #endif #ifdef __FBBDOS__ trait (0, buffer); #endif } indd = ptr; save_voie = voiecur; pvoie->ch_mon = -1; selvoie (pvoie->cross_connect); status (voiecur); maj_niv (N_YAPP, 0, 0); pvoie->temp1 = pvoie->niv1; pvoie->kiss = -2; menu_yapp (); if (pvoie->binary) { selvoie (save_voie); ch_niv3 (6); } else { selvoie (save_voie); } prompt = 0; } else { var_cpy (0, " "); texte (T_TRT + 2); } break; case 'H': case '?': gw_help (); break; case 'F': if (p_port[no_port (pvoie->cross_connect)].lfreq) { incindd (); if (*indd == '\0') { disp_freq (no_port (pvoie->cross_connect)); break; } } else { indd[40] = '\0'; var_cpy (0, indd); texte (T_GAT + 9); break; } default: /* if (!defaut()) { */ if ((p_port[no_port (pvoie->cross_connect)].lfreq) && (isdigit (*indd))) { /* Selection d'une frequence */ char *ptr; int port = no_port (pvoie->cross_connect); int val; int ok = 0; ListFreq *plf = p_port[port].lfreq; double freq; /* Transforme les ',' en '.' */ ptr = indd; while (*ptr) { if (*ptr == ',') *ptr = '.'; ++ptr; } freq = atof (indd); val = (int) freq; if ((double) val == freq) { /* rechercher d'abord par val */ while (plf) { if (plf->val == val) { ok = 1; break; } plf = plf->next; } } if (!ok) { /* C'est peut-etre la frequence */ plf = p_port[port].lfreq; while (plf) { if (plf->freq == freq) { ok = 1; break; } plf = plf->next; } } if (ok) { char buf[80]; sprintf (buf, "-> %g", plf->freq); outln (buf, strlen (buf)); /* envoyer la commande */ if (strncmpi (plf->cmde, "PTCTRX", 6) == 0) { ptctrx (port, plf->cmde); } else { char *cmde = plf->cmde; #ifdef __WINDOWS__ if (call_dll (cmde, NO_REPORT_MODE, NULL, 0, NULL) == -1) call_nbdos (&cmde, 1, NO_REPORT_MODE, NULL, NULL, NULL); #endif #ifdef __FBBDOS__ send_dos (2, cmde, NULL); #endif #ifdef __LINUX__ call_nbdos (&cmde, 1, NO_REPORT_MODE, NULL, TOOLDIR, NULL); #endif } } else { texte (T_ERR + 0); disp_freq (port); } } else { indd[40] = '\0'; var_cpy (0, indd); texte (T_GAT + 9); } /* } */ break; } } #ifndef __LINUX__ else { /* BPQ */ /* prog_indic(pvoie->cross_connect) ; */ switch (*indd) { case 'Q': case 'E': save_voie = voiecur; pvoie->ch_mon = -1; selvoie (pvoie->cross_connect); dec (voiecur, 1); dec (voiecur, 1); selvoie (save_voie); fin_tnc (); return; case 'K': texte (T_GAT + 5); ch_niv3 (3); return; case 'D': save_voie = voiecur; selvoie (pvoie->cross_connect); *buffer = '\0'; nb = 0; deb_io (); command = 2; sta_drv (voiecur, CMDE, (void *) &command); fin_io (); selvoie (save_voie); outs (buffer, nb); break; case 'P': save_voie = voiecur; pvoie->ch_mon = -1; selvoie (pvoie->cross_connect); dec (voiecur, 1); dec (voiecur, 1); tnc_cmd (TNC_END, voiecur); pvoie->kiss = -1; pvoie->sta.connect = FALSE; selvoie (save_voie); pvoie->cross_connect = -1; incindd (); if (*indd) ch_niv3 (1); else ch_niv3 (0); duplex_tnc (); /* prog_indic (pvoie->cross_connect); */ return; case 'S': if (voiecur != CONSOLE) { indd[40] = '\0'; var_cpy (0, indd); texte (T_GAT + 9); break; } if (svoie[pvoie->cross_connect]->sta.connect) { incindd (); strcpy (pvoie->appendf, indd); if ((stat (pvoie->appendf, &bufstat) == -1) || ((bufstat.st_mode & S_IFREG) == 0)) { texte (T_ERR + 11); break; } texte (T_GAT + 10); save_voie = voiecur; pvoie->ch_mon = -1; selvoie (pvoie->cross_connect); status (voiecur); strcpy (pvoie->sr_fic, indd); pvoie->enrcur = 0L; fin = senddata (0); if (!fin) { maj_niv (N_TELL, 0, 4); prompt = 0; } selvoie (save_voie); if (!fin) ch_niv3 (5); else { texte (T_GAT + 5); ch_niv3 (3); } } else texte (T_GAT + 3); break; case 'W': if (voiecur != CONSOLE) { indd[40] = '\0'; var_cpy (0, indd); texte (T_GAT + 9); break; } if (svoie[pvoie->cross_connect]->sta.connect) { incindd (); if (*indd) { strcpy (pvoie->appendf, indd); if (open_capture ()) { texte (T_GAT + 11); close (capture); } } else { if (capture) { texte (T_GAT + 12); capture = 0; } else texte (T_ERR + 0); } } else texte (T_GAT + 3); break; case 'Y': if (voiecur != CONSOLE) { indd[40] = '\0'; var_cpy (0, indd); texte (T_GAT + 9); break; } if (svoie[pvoie->cross_connect]->sta.connect) { strcpy (pvoie->dos_path, "\\"); ptr = ++indd; if (toupper (*ptr) == 'U') *ptr = 'D'; else if (toupper (*ptr) == 'D') *ptr = 'U'; incindd (); strcpy (pvoie->appendf, indd); if (*ptr == 'D') { #ifdef ENGLISH sprintf (buffer, "Yapp sending %s ...", indd); #else sprintf (buffer, "Yapp envoie %s ... ", indd); #endif #ifdef __FBBDOS__ trait (0, buffer); #endif } else { #ifdef ENGLISH sprintf (buffer, "Yapp receiving %s ...", indd); #else sprintf (buffer, "Yapp reoit %s ... ", indd); #endif #ifdef __FBBDOS__ trait (0, buffer); #endif } indd = ptr; save_voie = voiecur; pvoie->ch_mon = -1; selvoie (pvoie->cross_connect); status (voiecur); maj_niv (N_YAPP, 0, 0); pvoie->temp1 = pvoie->niv1; pvoie->kiss = -2; menu_yapp (); if (pvoie->binary) { selvoie (save_voie); ch_niv3 (6); } else { selvoie (save_voie); } prompt = 0; } else { var_cpy (0, " "); texte (T_TRT + 2); } break; case 'H': case '?': gw_help (); break; default: /* if (!defaut()) { */ indd[40] = '\0'; var_cpy (0, indd); texte (T_GAT + 9); /* } */ break; } } #endif } if (prompt) texte (T_GAT + 4); break; case 3: pvoie->lignes = -1; ptr = indd; while (*ptr) { if (*ptr == '\n') *ptr = '\r'; ++ptr; } if (((*indd == '\033') || (*indd == '>')) && (strlen (indd) == 2)) { ch_niv3 (2); texte (T_GAT + 4); } else { int len = strlen (indd); save_voie = voiecur; selvoie (pvoie->cross_connect); snd_drv (voiecur, DATA, indd, len, NULL); tor_stop (voiecur); pvoie->pack = 0; write_capture (indd, len); selvoie (save_voie); write_capture (indd, len); } break; case 4: fin = senddata (0); if (fin) { save_voie = voiecur; selvoie (pvoie->kiss); texte (T_GAT + 5); ch_niv3 (3); selvoie (save_voie); maj_niv (0, 0, 0); } break; case 5: if (*indd == '\033') { selvoie (pvoie->cross_connect); /* Arret du transfert */ selvoie (CONSOLE); #ifdef ENGLISH sprintf (buffer, "Transfer aborted"); #else sprintf (buffer, "Transfert arrt"); #endif #ifdef __FBBDOS__ trait (-1, buffer); #endif sleep_ (1); } break; case 6: if (*indd == '\033') { selvoie (pvoie->cross_connect); cancel ("Abort\r"); selvoie (CONSOLE); #ifdef ENGLISH sprintf (buffer, "Transfer aborted"); #else sprintf (buffer, "Transfert arrt"); #endif #ifdef __FBBDOS__ trait (-1, buffer); #endif sleep_ (1); } break; } } static int ch_canal (int port) { /* * Cherche une voie libre sur un port. * Commence par la derniere voie du port * Teste les voies reservees */ int i, j; if (port == 0) { if (svoie[CONSOLE]->sta.connect) return (-1); return (0); } if (p_port[port].pvalid == 0) return (-1); #ifdef __LINUX__ if (S_LINUX (port)) { if (port_free (port) == 0) return (-1); for (i = nbcan_linux (); i > 0; i--) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == i) && (S_LINUX (no_port (j))) && (!svoie[j]->sta.connect) && (!voie_forward (j)) && (!svoie[j]->localmode) ) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; return (j); } } } } else #endif if (DRSI (port)) { if (port_free (port) == 0) return (-1); for (i = nbcan_drsi (); i > 0; i--) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == i) && (DRSI (no_port (j))) && (!svoie[j]->sta.connect) && (!voie_forward (j)) && (!svoie[j]->localmode) ) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; return (j); } } } } else if (HST (port)) { if (port_free (port) == 0) return (-1); if (p_port[port].ccanal == 0) { /* Port Pactor. Cherche la voie correspondante */ for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == PACTOR_CH) && (HST (no_port (j))) && (!svoie[j]->sta.connect) && (!voie_forward (j)) && (!svoie[j]->localmode) ) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; return (j); } } return (-1); } for (i = nbcan_hst (); i > 0; i--) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == i) && (HST (no_port (j))) && (!svoie[j]->sta.connect) && (!voie_forward (j)) && (!svoie[j]->localmode) ) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; return (j); } } } } else if (BPQ (port)) { if (port_free (port) == 0) return (-1); for (i = nbcan_bpq (); i > 0; i--) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.canal == i) && (BPQ (no_port (j))) && (!svoie[j]->sta.connect) && (!voie_forward (j)) && (!svoie[j]->localmode) ) { svoie[j]->affport.port = port; for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; return (j); } } } } else { for (i = p_port[port].nb_voies; i > 0; i--) { for (j = 1; j < NBVOIES; j++) { if ((svoie[j]->affport.port == port) && (svoie[j]->affport.canal == i) && (!svoie[j]->sta.connect) && (!voie_forward (j)) && (!svoie[j]->localmode) ) { for (i = 0; i < 8; i++) *(svoie[j]->sta.relais[i].call) = '\0'; return (j); } } } } return (-1); } void prog_indic (int novoie) { char s[81]; switch (p_port[no_port (novoie)].typort) { case TYP_DED: case TYP_HST: case TYP_SCK: case TYP_ETH: case TYP_FLX: #ifdef __WINDOWS__ case TYP_AGW: #endif if (P_TOR (novoie)) sprintf (s, "I %s", pvoie->sta.indicatif.call); else sprintf (s, "I %s-%d", pvoie->sta.indicatif.call, pvoie->sta.indicatif.num); break; case TYP_BPQ: sprintf (s, "*** Linked to %s-%d\r", pvoie->sta.indicatif.call, pvoie->sta.indicatif.num); break; } strcpy (svoie[novoie]->sta.indicatif.call, pvoie->sta.indicatif.call); if (P_TOR (novoie)) svoie[novoie]->sta.indicatif.num = 0; else svoie[novoie]->sta.indicatif.num = pvoie->sta.indicatif.num; selcanal (no_port (novoie)); switch (p_port[no_port (novoie)].typort) { case TYP_DED: case TYP_HST: case TYP_SCK: case TYP_ETH: case TYP_FLX: #ifdef __WINDOWS__ case TYP_AGW: #endif tnc_commande (novoie, s, SNDCMD); break; case TYP_BPQ: snd_drv (novoie, DATA, s, strlen (s), NULL); break; } selcanal (no_port (voiecur)); } int nbgate (void) { int nb = 0; int port; for (port = 1; port < NBPORT; port++) { if ((p_port[port].pvalid) && (port != no_port (voiecur)) && ((p_port[port].moport & 8) == 0) && ((p_port[port].moport & 0x10) || (droits (ACCGATE)))) { ++nb; } } return (nb); } void aff_freq (void) { int port; char s[80]; for (port = 1; port < NBPORT; port++) { if ((p_port[port].pvalid) && (port != no_port (voiecur)) && (((p_port[port].moport & 8) == 0) || (voiecur == CONSOLE)) && ((p_port[port].moport & 0x10) || (droits (ACCGATE)))) { sprintf (s, "%d : %s", port, p_port[port].freq); outln (s, strlen (s)); } } } void fin_tnc (void) { char s[80]; int autre_voie = pvoie->cross_connect; if (autre_voie > 0) { tnc_cmd (TNC_END, autre_voie); /* Remet l'indicatif de la BBS */ switch (p_port[no_port (autre_voie)].typort) { case TYP_DED: case TYP_HST: case TYP_SCK: case TYP_ETH: case TYP_FLX: #ifdef __WINDOWS__ case TYP_AGW: #endif if (P_TOR (autre_voie)) sprintf (s, "I %s", mycall); else sprintf (s, "I %s-%d", mycall, myssid); break; case TYP_BPQ: sprintf (s, "*** Linked to %s-%d\r", mycall, myssid); break; } selcanal (no_port (autre_voie)); switch (p_port[no_port (autre_voie)].typort) { case TYP_DED: case TYP_HST: case TYP_SCK: case TYP_ETH: case TYP_FLX: #ifdef __WINDOWS__ case TYP_AGW: #endif tnc_commande (autre_voie, s, SNDCMD); break; case TYP_BPQ: snd_drv (autre_voie, DATA, s, strlen (s), NULL); break; } selcanal (no_port (voiecur)); svoie[autre_voie]->kiss = -1; svoie[autre_voie]->sta.connect = FALSE; #ifndef __LINUX__ if (p_port[no_port (autre_voie)].typort == TYP_MOD) re_init_modem (autre_voie); #endif } pvoie->ch_mon = -1; pvoie->cross_connect = -1; *indd = '\0'; if (pvoie->temp3 == N_MBL) { aff_nbsta (); retour_mbl (); } else if (pvoie->temp3 == 0) { pvoie->sta.connect = FALSE; maj_niv (0, 0, 0); if (voiecur == CONSOLE) console_off (); } #ifndef MINISERV else { maj_niv (0, 1, 0); choix (); } #endif curseur (); aff_nbsta (); } void gw_help (void) { incindd (); if (*indd == '\0') strcpy (indd, "H"); out_help (indd); } static void error_file (int nolig) { char wtexte[200]; deb_io (); #ifdef ENGLISH if (operationnel) { sprintf (wtexte, "\r\nError in file gateway.sys line %d \r\n\a", nolig); if (w_mask & W_FILE) mess_warning (admin, "*** FILE ERROR *** ", wtexte); } sprintf (wtexte, "Error in file gateway.sys line %d ", nolig); #else if (operationnel) { sprintf (wtexte, "\r\nErreur fichier gateway.sys ligne %d\r\n\a", nolig); if (w_mask & W_FILE) mess_warning (admin, "*** ERREUR FICHIER ***", wtexte); } sprintf (wtexte, "Erreur fichier gateway.sys ligne %d", nolig); #endif fin_io (); win_message (5, wtexte); } static int cmde (char *com_buf) { int type; char *ptr = com_buf, *lptr = com_buf; sup_ln (com_buf); while ((*ptr) && (!ISGRAPH (*ptr))) ++ptr; type = toupper (*ptr); ++ptr; /* ELSE */ if ((type == 'E') && (toupper (*ptr) == 'L')) type = '@'; while (ISGRAPH (*ptr)) ++ptr; while ((*ptr) && (!ISGRAPH (*ptr))) ++ptr; while ((*lptr++ = *ptr++) != '\0'); return (type); } static void clear_freq (int port) { ListFreq *plf; while (p_port[port].lfreq) { plf = p_port[port].lfreq; p_port[port].lfreq = plf->next; m_libere (plf, sizeof (ListFreq)); } } static int add_freq (int port, char *buf) { int v; char *freq; ListFreq *plf; ListFreq *phead = p_port[port].lfreq; v = atoi (buf); cmde (buf); if ((v < 1) || (v > 99)) return (FALSE); freq = buf; while (ISGRAPH (*buf)) ++buf; if (!isprint (*buf)) return FALSE; *buf++ = '\0'; /* buf pointe la commande */ if (phead) { while (phead->next) phead = phead->next; plf = m_alloue (sizeof (ListFreq)); phead->next = plf; } else { plf = m_alloue (sizeof (ListFreq)); p_port[port].lfreq = plf; } plf->val = v; plf->freq = atof (freq); n_cpy (sizeof (plf->cmde) - 1, plf->cmde, buf); plf->next = NULL; return TRUE; } static void tnc_cmd (int cmd, int voie) { int c; int d; int cptif = 0; int nolig = 0; int temp; int port; long h_time = time (NULL); FILE *fptr; typ_pfwd *ptnc = NULL; char com_buf[300]; if (voie <= 0) return; port = no_port (voie); clear_freq (port); fptr = fopen (c_disque ("gateway.sys"), "r"); if (fptr == NULL) return; while (fgets (com_buf, sizeof (com_buf), fptr)) { ++nolig; c = cmde (com_buf); switch (c) { case '\0': case '#': /* comment */ break; case 'E': /* ENDIF */ --cptif; break; case 'I': /* IF */ ++cptif; if (tst_fwd (com_buf, 0, h_time, port, NULL, 0, port) == FALSE) { temp = cptif - 1; while (cptif != temp) { if (fgets (com_buf, sizeof (com_buf), fptr) == NULL) break; ++nolig; d = cmde (com_buf); switch (d) { case 'I': /* if */ ++cptif; break; case 'E': /* endif */ --cptif; break; case '@': /* else */ if (cptif == (temp + 1)) ++temp; break; default: break; } } } break; case '@': /* ELSE */ temp = cptif - 1; while (cptif != temp) { if (fgets (com_buf, sizeof (com_buf), fptr) == NULL) break; ++nolig; d = cmde (com_buf); switch (d) { case 'I': /* if */ ++cptif; break; case 'E': /* endif */ --cptif; break; default: break; } } break; case 'B': /* BEGIN */ if (cmd == TNC_START) { d = cmde (com_buf); switch (d) { case 'D': param_tnc (1, &ptnc, com_buf); break; case 'L': /* Ligne de commande TNC */ param_tnc (0, &ptnc, com_buf); break; case 'X': /* Commande TNC */ param_tnc (2, &ptnc, com_buf); break; default: /* ??? */ error_file (nolig); break; } } break; case 'F': /* CMD */ if (!add_freq (port, com_buf)) error_file (nolig); break; case 'S': /* STOP */ if (cmd == TNC_END) { d = cmde (com_buf); switch (d) { case 'D': param_tnc (1, &ptnc, com_buf); break; case 'L': /* Ligne de commande TNC */ param_tnc (0, &ptnc, com_buf); break; case 'X': /* Commande TNC */ param_tnc (2, &ptnc, com_buf); break; default: /* ??? */ error_file (nolig); break; } } break; default: /* ??? */ error_file (nolig); break; } } fclose (fptr); if (ptnc) program_fwd (FALSE, TRUE, &ptnc, voie); } static void disp_freq (int port) { char buf[80]; int nb = 0; ListFreq *plf = p_port[port].lfreq; while (plf) { sprintf (buf, "%2d:%-10g ", plf->val, plf->freq); out (buf, strlen (buf)); if (++nb == 4) { cr (); nb = 0; } plf = plf->next; } if (nb) cr (); } static int pactor_cq (void) { char buffer[80]; char callsign[20]; char name[20]; char qth[40]; int i; int autre_voie = pvoie->cross_connect; if (IS_PACTOR (no_port (autre_voie))) { if (BUSY (no_port (autre_voie))) { sprintf (buffer, "%s: FREQ-BUSY fm PACTOR", mycall); outsln (buffer, strlen (buffer)); return (1); } /* Indicatif de l'appelant */ strcpy (callsign, pvoie->sta.indicatif.call); /* Prenom de l'appelant */ if (*(pvoie->finf.prenom)) strcpy (name, pvoie->finf.prenom); else strcpy (name, "???"); /* QTH de l'appelant */ if (*(pvoie->finf.ville)) strcpy (qth, pvoie->finf.ville); else strcpy (qth, "???"); prog_indic (autre_voie); tnc_commande (autre_voie, "!U", SNDCMD); #define NB_CALL 3 for (i = 0; i < NB_CALL; i++) { sprintf (buffer, "CQ CQ CQ de %s %s %s (%d)\r", callsign, callsign, callsign, NB_CALL - i); snd_drv (autre_voie, DATA, buffer, strlen (buffer), NULL); outs (buffer, strlen (buffer)); } sprintf (buffer, "Op %s fm %s is QRV ... Pse K\r", name, qth); snd_drv (autre_voie, DATA, buffer, strlen (buffer), NULL); outs (buffer, strlen (buffer)); tnc_commande (autre_voie, "!D", SNDCMD); aff_nbsta (); return (1); } else return (0); } fbb-7.04j/src/tncio.c0100644000175100017510000010673307726646105012500 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE TNCIO.C : ENTREES-SORTIE */ #include #define INT10 0x10 static void clear_marque (int); static void aff_bas_suite (int, int, char *, int); #ifndef dump_core static void dump_data (char *title, FILE * fptr, char *ptr, int len) { int i; int j; fprintf (fptr, "\r\nDump of %s\r\n", title); for (i = 0; i < len; i += 16) { fprintf (fptr, "%05d ", i); for (j = 0; j < 16; j++) { if ((i + j) < len) fprintf (fptr, "%02x ", ptr[i + j] & 0xff); else fprintf (fptr, " "); } for (j = 0; j < 16; j++) { if ((i + j) < len) fprintf (fptr, "%c", (ptr[i + j] >= 0x20) ? ptr[i + j] : '.'); } fprintf (fptr, "\r\n"); } } void dump_core (void) { time_t temps = time (NULL); struct tm *tm = localtime (&temps); FILE *fptr = fopen ("debug.bug", "ab"); if (!fptr) return; fprintf (fptr, "\r\n\r\nOn %02d/%02d %02d:%02d:%02d\r\n\r\n", tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); fprintf (fptr, "Channel %d\r\n\r\n", voiecur - 1); wreq_cfg (fptr); dump_data ("svoie", fptr, (char *) svoie[voiecur], sizeof (Svoie)); fclose (fptr); /* *((char *)NULL) = 0; */ exit (999); } #endif #ifdef __WINDOWS__ void BWinSleep (int temps) { long cur; long fin; long ncur; temps /= 50; if (temps == 0) temps = 1; cur = btime (); fin = cur + (long) temps; for (;;) { deb_io (); ncur = btime (); if (ncur > fin) break; fin_io (); } } #endif int aff_ok(int voie) { if (svoie[voie]->binary) return 0; if (voie == CONSOLE) return 0; if ((voie == INEXPORT) && !aff_inexport) return 0; if (POP(no_port(voie)) && !aff_popsmtp) return 0; return 1; } static void outbuf (int mod, char *si, int nb) { obuf *optr = pvoie->outptr; char *ptr, *sv, *debut; int nbout, c, ncars, var = 0, fin_buf = 0, nbbuf = 0; /* * mod = 0 : sans variables * mod = 1 : avec variables * mod = 2 : sans variables + cr * mod = 3 : avec variables + cr */ df ("outbuf", 4); if (optr) { while (optr->suiv) { optr = optr->suiv; ++nbbuf; } } else { int i; pvoie->memoc += 250; optr = (obuf *) m_alloue (sizeof (obuf)); pvoie->outptr = optr; optr->nb_car = optr->no_car = 0; for (i = 0; i < NB_MARQUES; i++) optr->marque[i] = -1; optr->suiv = NULL; } ncars = optr->nb_car; ptr = optr->buffer + ncars; nbout = 0; debut = ptr; for (;;) { if (nb == 0) { if (mod & 2) { c = '\r'; mod = 0; } else break; } else { nb--; c = *si++; } if ((c == '\r') && (!pvoie->binary)) pvoie->ret = TRUE; else if ((c == '\n') && (!pvoie->binary)) { if (!pvoie->ret) c = '\r'; else continue; } else pvoie->ret = FALSE; if ((var == 1) && (c == 'W')) { c = '\r'; var = 0; } if (var == 1) { var = 0; sv = variable (c); while (*sv) { if (ncars == 250) { int i; pvoie->memoc += 250; if ((nbout) && aff_ok(voiecur)) { deb_io (); aff_bas (voiecur, W_SNDT, debut, nbout); fin_io (); } optr->nb_car = ncars; optr->suiv = (obuf *) m_alloue (sizeof (obuf)); optr = optr->suiv; optr->nb_car = optr->no_car = ncars = 0; for (i = 0; i < NB_MARQUES; i++) optr->marque[i] = -1; optr->suiv = NULL; ptr = optr->buffer; nbout = 0; debut = ptr; ++nbbuf; } ++ncars; ++nbout; *ptr++ = *sv++; } if (fin_buf) ncars = 250; } else if (var == 2) { var = 0; sv = alt_variable (c); while (*sv) { if (ncars == 250) { int i; pvoie->memoc += 250; if ((nbout) && aff_ok(voiecur)) { deb_io (); aff_bas (voiecur, W_SNDT, debut, nbout); fin_io (); } optr->nb_car = ncars; optr->suiv = (obuf *) m_alloue (sizeof (obuf)); optr = optr->suiv; optr->nb_car = optr->no_car = ncars = 0; for (i = 0; i < NB_MARQUES; i++) optr->marque[i] = -1; optr->suiv = NULL; ptr = optr->buffer; nbout = 0; debut = ptr; ++nbbuf; } ++ncars; ++nbout; *ptr++ = *sv++; } if (fin_buf) ncars = 250; } else { if ((c == '$') && (mod & 1)) var = 1; else if ((c == '%') && (mod & 1)) var = 2; else { if (ncars == 250) { int i; pvoie->memoc += 250; if ((nbout) && aff_ok(voiecur)) { deb_io (); aff_bas (voiecur, W_SNDT, debut, nbout); fin_io (); } optr->nb_car = ncars; optr->suiv = (obuf *) m_alloue (sizeof (obuf)); optr = optr->suiv; optr->nb_car = optr->no_car = ncars = 0; for (i = 0; i < NB_MARQUES; i++) optr->marque[i] = -1; optr->suiv = NULL; ptr = optr->buffer; nbout = 0; debut = ptr; ++nbbuf; } ++ncars; ++nbout; *ptr++ = c; } } } optr->nb_car = ncars; if (pvoie->dde_int != 2) { if ((ncars) && aff_ok(voiecur)) { deb_io (); aff_bas (voiecur, W_SNDT, debut, nbout); fin_io (); } } ff (); return; } void cr (void) { df ("cr", 0); out ("$W", 2); ff (); return; } void outs (char *si, int nb) { df ("outs", 3); outbuf (0, si, nb); ff (); return; } void out (char *si, int nb) { df ("out", 3); outbuf (1, si, nb); ff (); return; } void outsln (char *si, int nb) { df ("outsln", 3); outbuf (2, si, nb); ff (); return; } void outln (char *si, int nb) { df ("outln", 3); outbuf (3, si, nb); ff (); return; } void marque_obuf (void) { int i; obuf *optr = pvoie->outptr; df ("marque_obuf", 0); if (optr) { while (optr->suiv) { optr = optr->suiv; } for (i = 0; i < NB_MARQUES; i++) { if (optr->marque[i] == -1) optr->marque[i] = optr->nb_car; } } ff (); return; } int get_inbuf (int voie) { ibuf *bufptr = &(svoie[voie]->inbuf); lbuf *ligptr; if ((bufptr->curr == NULL) || (bufptr->nbcar == 0)) return (0); /* pas de buffer !! */ if (bufptr->curr->lgbuf) { char *ptr = bufptr->curr->buffer; --bufptr->curr->lgbuf; --bufptr->nbcar; if (bufptr->curr->lgbuf == 0) { /* libere le buffer */ if (bufptr->tete == bufptr->curr) { /* C'est le premier buffer */ m_libere ((char *) bufptr->curr->buffer, 1); m_libere ((char *) bufptr->curr, sizeof (lbuf)); bufptr->tete = bufptr->curr = NULL; } else { /* Cherche l'avant-dernier buffer ... */ ligptr = bufptr->tete; while (ligptr->suite != bufptr->curr) { ligptr = ligptr->suite; if (ligptr == NULL) return (0); /* Okazou ! */ } /* Ok... */ m_libere ((char *) bufptr->curr->buffer, 1); m_libere ((char *) bufptr->curr, sizeof (lbuf)); bufptr->curr = ligptr; bufptr->curr->suite = NULL; } } else { /* Realloue le buffer */ bufptr->curr->buffer = (char *) m_alloue (bufptr->curr->lgbuf); memcpy (bufptr->curr->buffer, ptr, bufptr->curr->lgbuf); m_libere (ptr, bufptr->curr->lgbuf + 1); } } return (1); } void in_buf (int voie, char *buffer, int lgbuf) { ibuf *bufptr = &(svoie[voie]->inbuf); lbuf *ligptr; char *ptr; int car; df ("in_buf", 4); if (lgbuf == 0) return; deb_io (); ligptr = (lbuf *) m_alloue (sizeof (lbuf)); ligptr->suite = NULL; if (bufptr->tete == NULL) { bufptr->tete = bufptr->curr = ligptr; bufptr->nocar = bufptr->nbcar = bufptr->nblig = 0; } else { bufptr->curr->suite = ligptr; bufptr->curr = ligptr; } ptr = bufptr->curr->buffer = (char *) m_alloue (lgbuf); bufptr->curr->lgbuf = lgbuf; bufptr->nbcar += lgbuf; while (lgbuf--) { car = *buffer++; *ptr++ = car; if (car == '\r') { if ((svoie[voie]->binary == 0) && (svoie[voie]->kiss == -1) && (svoie[voie]->cross_connect == -1) && (svoie[voie]->seq || svoie[voie]->outptr) && (bufptr->curr->lgbuf == 2)) { if ((*(bufptr->curr->buffer) == 'A') || (*(bufptr->curr->buffer) == 'a')) { svoie[voie]->dde_int = 1; clear_inbuf (voie); break; } if ((*(bufptr->curr->buffer) == 'C') || (*(bufptr->curr->buffer) == 'c')) { if (svoie[voie]->aut_nc) svoie[voie]->dde_int = 3; clear_inbuf (voie); break; } if ((*(bufptr->curr->buffer) == 'N') || (*(bufptr->curr->buffer) == 'n')) { if (svoie[voie]->aut_nc) svoie[voie]->dde_int = 2; } } bufptr->nblig++; } } fin_io (); ff (); return; } void interruption (int voie) { #ifdef __FBBDOS__ FScreen *screen = &conbuf; #endif df ("interruption", 1); switch (svoie[voie]->dde_int) { case 1: /* Abort */ clear_outbuf (voie); libere_tread (voie); svoie[voie]->seq = svoie[voie]->sta.ack = svoie[voie]->stop = 0; svoie[voie]->sr_mem = svoie[voie]->dde_int = 0; svoie[voie]->lignes = -1; selvoie (voie); init_langue (voie); aff_header (voie); #ifdef __FBBDOS__ if ((voie == CONSOLE) && (screen->totlig)) inputs (CONSOLE, W_CNST, "A\r"); #endif texte (T_QST + 3); if ((pvoie->mbl) && (pvoie->niv2 == 1)) { /* Liste ! */ texte (T_QST + 6); ch_niv3 (2); } else if (pvoie->niv1 == N_THEMES) { /* Themes */ maj_niv (N_THEMES, 0, 0); texte (T_THE + 2); } else retour_menu (svoie[voie]->niv1); break; case 2: /* Next */ /* svoie[voie]->dde_int = 0; */ svoie[voie]->stop = 0; clear_marque (voie); svoie[voie]->dde_int = 0; break; case 3: /* Continu */ /* svoie[voie]->dde_int = 0; */ svoie[voie]->dde_int = svoie[voie]->stop = 0; svoie[voie]->lignes = -1; break; default: retour_menu (svoie[voie]->niv1); break; } ff (); return; } int lig_bufi (int voie) { int val; df ("lig_bufi", 1); val = svoie[voie]->inbuf.nblig; ff (); return (val); } void cr_cond (void) { obuf *optr = pvoie->outptr; char *ptr; df ("cr_cond", 0); if (optr) { while (optr->suiv) optr = optr->suiv; ptr = optr->buffer + optr->nb_car - 1; if (*ptr == '\r') { ff (); return; } } cr (); ff (); return; } int send_buf (int voie) { int ncars, nbcars, nocars; int retour = 0; int fin = 0; char buf[257]; char *lptr = NULL; obuf *optr; char *ptr, *tptr; int maxcar; df ("send_buf", 1); /* Commute le TNC en emission (TOR mode) */ if ((voie) && (svoie[voie]->pack == 0)) { /* tor_start (voie); */ svoie[voie]->pack = 1; } if ((voie == CONSOLE) || (voie == INEXPORT)) maxcar = 250; else maxcar = svoie[voie]->paclen; if (maxcar == 0) sta_drv (voie, PACLEN, &maxcar); if ((voie == CONSOLE) && (kb_vide () == 0)) { ff (); return (1); } if (!svoie[voie]->stop) { init_timout (voie); if ((optr = svoie[voie]->outptr) != NULL) { ncars = 0; tptr = buf; nbcars = optr->nb_car; nocars = optr->no_car; ptr = optr->buffer + nocars; while (1) { if (nbcars == nocars) { svoie[voie]->outptr = optr->suiv; m_libere (optr, sizeof (obuf)); svoie[voie]->memoc -= 250; if ((optr = svoie[voie]->outptr) != NULL) { nbcars = optr->nb_car; nocars = 0; ptr = optr->buffer; } else { /* cprintf(" Vide ") ; */ break; } } *tptr++ = *ptr; ++nocars; if ((*ptr == '\r') && (svoie[voie]->lignes > 0)) { if ((--svoie[voie]->lignes == 0) && ((svoie[voie]->sr_mem) || (svoie[voie]->seq) || (svoie[voie]->t_tr) || (nbcars != nocars) || (optr->suiv))) { init_langue (voie); svoie[voie]->stop = 1; optr->no_car = nocars; lptr = langue[vlang]->plang[T_QST - 1]; while (*lptr) { if (++ncars == maxcar) { fin = 1; break; } *tptr++ = *lptr++; } if (!fin) { lptr = NULL; ++ncars; } break; } } if (++ncars == maxcar) { optr->no_car = nocars; break; } ++ptr; } if (voie == CONSOLE) { deb_io (); aff_bas (voie, W_SNDT, buf, ncars); if (lptr) aff_bas (voie, W_SNDT, lptr, strlen (lptr)); is_idle = 0; fin_io (); retour = 1; } /* else if (voie == INEXPORT) { deb_io (); aff_bas (voie, W_SNDT, buf, ncars); if (lptr) aff_bas (voie, W_SNDT, lptr, strlen (lptr)); is_idle = 0; fin_io (); retour = 1; } */ else { retour = snd_drv (voie, DATA, buf, ncars, NULL); ++svoie[voie]->sta.ack; if (lptr) { retour = snd_drv (voie, DATA, lptr, strlen (lptr), NULL); ++svoie[voie]->sta.ack; } } } } free_mem (); ff (); return (retour); } void clear_outbuf (int voie) { obuf *optr; df ("clear_outbuf", 1); while ((optr = svoie[voie]->outptr) != NULL) { svoie[voie]->outptr = optr->suiv; m_libere (optr, sizeof (obuf)); svoie[voie]->memoc -= 250; } free_mem (); ff (); return; } void clear_marque (int voie) { int i; int trouve = 0; obuf *optr; df ("clear_marque", 1); while (svoie[voie]->t_read || svoie[voie]->outptr) { while ((optr = svoie[voie]->outptr) != NULL) { for (i = 0; i < NB_MARQUES; i++) { if (optr->marque[i] >= optr->no_car) { optr->no_car = optr->marque[i]; optr->marque[i] = -1; trouve = 1; break; } } if (trouve) break; svoie[voie]->outptr = optr->suiv; m_libere (optr, sizeof (obuf)); svoie[voie]->memoc -= 250; } if (trouve) break; if ((svoie[voie]->memoc <= MAXMEM / 2) && (svoie[voie]->sr_mem)) { selvoie (voie); premier_niveau (); } } svoie[voie]->stop = 1; free_mem (); ff (); return; } int no_port (int voie) { int val; df ("no_port", 1); if (voie == CONSOLE) { ff (); return (0); } val = svoie[voie]->affport.port; ff (); return (val); } int no_canal (int voie) { int val; df ("no_canal", 1); val = svoie[voie]->affport.canal; ff (); return (val); } int tncin (int voie) { int val; df ("tncin", 1); val = rcv_tnc (no_port (voie)); ff (); return (val); } void tncout (int voie, int ch) { int port; df ("tncout", 2); port = no_port (voie); while (car_tx (port)) ; /* attend que le buffer d'emission soit vide */ send_tnc (port, ch); ff (); return; } void tncstr (int port, char *ptr, int echo) { int c; df ("tncstr", 4); while (car_tx (port)) ; /* attend que le buffer d'emission soit vide */ while ((c = *ptr++) != '\0') { send_tnc (port, c); #ifdef __FBBDOS__ if (echo) { putch (c); if (c == '\r') putch ('\n'); } #endif } ff (); return; } void ctrl_z (void) { df ("ctrl_z", 0); outs ("\032\r", 2); ff (); return; } #ifdef __FBBDOS__ void curon (void) /*******/ /* allume le curseur sur ecran alphanum */ { df ("curon", 0); _setcursortype (_NORMALCURSOR); ff (); return; } void curoff (void) /********/ /* eteind le curseur sur l'ecran alphanum */ { df ("curoff", 0); _setcursortype (_NOCURSOR); ff (); return; } void cursor (int val) { union REGS registres; df ("cursor", 1); registres.h.ah = 1; registres.x.cx = val; int86 (INT10, ®istres, ®istres); ff (); return; } int attcurs (void) { int *ptr = MK_FP (0x40, 0x60); return (*ptr); } #endif static void wheader (int voie, int color, char *s) { #ifdef __FBBDOS__ FScreen *screen; #endif deb_io (); #if defined(__WINDOWS__) || defined(__LINUX__) aff_bas_suite (voie, color, "\r", 1); #endif #ifdef __FBBDOS__ screen = (voie == CONSOLE) ? &conbuf : &winbuf; if (screen->carpos) { aff_bas_suite (screen->voie, screen->color, "\r", 1); } #endif aff_bas_suite (voie, color, s, strlen (s)); fin_io (); return; } void aff_header (int voie) { char s[80]; char *ptr = s; /* if (voie == CONSOLE) */ if (!aff_ok(voie)) return; df ("aff_header", 1); if ((ok_aff) && (voie != lastaff) && (svoie[voie]->sta.connect > 1)) { deb_io (); sprintf (ptr, "[PORT %d (%s) - %2d - %s-%d]\r", no_port (voie), p_port[no_port (voie)].freq, virt_canal (voie), svoie[voie]->sta.indicatif.call, svoie[voie]->sta.indicatif.num); wheader (voie, -1, s); lastaff = voie; fin_io (); } ff (); return; } void aff_bas (int voie, int color, char *str, int nb) { df ("affbas", 4); aff_header (voie); aff_bas_suite (voie, color, str, nb); ff (); return; } static void aff_bas_suite (int voie, int color, char *str, int nb) { int i; int nbp = nb; char *ptr = str; static char buf[600]; char *p_str = buf; if (nb == 0) return; df ("aff_bas_suite", 5); while (nb--) { if (*ptr >= '\040') *p_str++ = *ptr; else { switch (*ptr) { case '\a': *p_str++ = 14; break; case '\r': *p_str++ = '\r'; *p_str++ = '\n'; break; case '\t': for (i = 0; i < 8; i++) *p_str++ = ' '; break; case '\n': case '\032': *p_str++ = *ptr; break; } } ++ptr; } *p_str = '\0'; winputs (voie, color, buf); if (voie == CONSOLE) { #if defined(__WINDOWS__) || defined(__LINUX__) if (print) { trait_time = 0; SpoolLine (voie, color, str, nbp); } #else if (print) trait_time = 0; while ((print) && (nbp--)) { if (*str >= '\040') fputc (*str, file_prn); else { switch (*str) { case '\a': fputc ('^', file_prn); fputc ('G', file_prn); break; case '\r': fputc ('\r', file_prn); fputc ('\n', file_prn); break; case '\t': for (i = 0; i < 8; i++) fputc (' ', file_prn); break; case '\032': fputc ('^', file_prn); fputc ('G', file_prn); break; } } ++str; } #endif } ff (); return; } char extind (char *chaine, char *indicatif) { int i = 6; int ssid = 0; df ("extind", 4); while ((i--) && isalnum (*chaine)) { *indicatif++ = *chaine++; } *indicatif = '\0'; if ((*chaine) && (*chaine != ' ')) { while (*chaine && !isdigit (*chaine)) ++chaine; if (*chaine) { ssid = atoi (chaine); } } ff (); return ((char) ssid); } void tst_appel (void) { struct stat st; df ("tst_appel", 0); if (stat (d_disque ("OPTIONS.SYS"), &st) == 0) { if (st.st_mtime != t_appel) { t_appel = st.st_mtime; lit_appel (); } } ff (); return; } void tnc_commande (int select, char *command, int cmd) { int voie; char buffer[600]; /* cmd = ECHOCMD select = voie cmd = SNDCMD select = voie cmd = PORTCMD select = port */ if (*command == '\0') return; if (cmd == PORTCMD) { int nb = 0; char *ptr = buffer, *sv; voie = p_port[select].pr_voie; deb_io (); while (*command) { if (*command == '$') { ++command; sv = variable (*command++); while (*sv) { *ptr++ = *sv++; if (++nb == 250) break; } } else if (*command == '%') { ++command; sv = alt_variable (*command++); while (*sv) { *ptr++ = *sv++; if (++nb == 250) break; } } else { *ptr++ = *command++; nb++; } if (nb == 250) break; } *ptr = '\0'; command = buffer; fin_io (); #ifdef __FBBDOS__ if (!operationnel) { ptr = buffer; cprintf ("%d : ", select); nb = 0; while (*ptr) { if (*ptr == '\r') putch ('\n'); putch (*ptr); ++ptr; if ((++nb == 2) && (p_port[select].typort == TYP_PK)) putch (' '); } putch ('\n'); putch ('\r'); } #endif } else voie = select; sta_drv (voie, cmd, (void *) command); } /* Called when Pactor was disconnected after 10 seconds */ static void FAR hst_disc (int port, void *userdata) { /* Imediate disconnection */ force_deconnexion ((int) userdata, 1); } void dec (int voie, int mode) /* Mode = 1 deconnexion 2 retour au nodal */ { #ifndef __LINUX__ int command; #endif df ("dec", 2); deb_io (); switch (p_port[no_port (voie)].typort) { case TYP_DED: case TYP_FLX: tnc_commande (voie, "D", SNDCMD); break; case TYP_HST: tnc_commande (voie, "D", SNDCMD); if (P_TOR (voie)) { /* Timer to force disconnection after 10 seconds */ del_timer (p_port[port].t_delay); p_port[port].t_delay = add_timer (10, port, (void FAR *) hst_disc, (void *) voie); } break; case TYP_PK: tnc_commande (voie, "DI", SNDCMD); break; case TYP_MOD: deconnect_modem (voie); break; case TYP_KAM: kam_commande (voie, "D"); break; #ifdef __WINDOWS__ case TYP_TCP: case TYP_ETH: case TYP_AGW: tnc_commande (voie, "D", SNDCMD); break; #endif #ifdef __LINUX__ case TYP_TCP: case TYP_ETH: case TYP_SCK: case TYP_POP: tnc_commande (voie, "D", SNDCMD); break; #else case TYP_BPQ: command = mode + 1; sta_drv (voie, CMDE, (void *) &command); break; #endif } fin_io (); ff (); return; } void programm_indic (int voie) { char buffer[257]; df ("programm_indic", 1); if ((svoie[voie]->sta.callsign.call[0]) && (p_port[no_port (voie)].typort == TYP_DED)) { if ((!DEBUG) && (p_port[no_port (voie)].pvalid)) { sprintf (buffer, "I %s-%d", svoie[voie]->sta.callsign.call, svoie[voie]->sta.callsign.num); tnc_commande (voie, buffer, ECHOCMD); if (*buffer & !svoie[CONSOLE]->sta.connect) cprintf (buffer); } } ff (); return; } void aff_event (int voie, int event) { static char *event_string[3] = { #ifdef ENGLISH "", "Connect ", "Disconnect ", #else "", "Connexion", "Dconnexion", #endif }; char s[80]; char *ptr = s; if (!aff_ok(voie)) return; df ("aff_event", 2); if (!svoie[CONSOLE]->sta.connect) { deb_io (); sprintf (ptr, "[PORT %d (%s) - %2d - %s-%d] %s %s\r", no_port (voie), p_port[no_port (voie)].freq, virt_canal (voie), svoie[voie]->sta.indicatif.call, svoie[voie]->sta.indicatif.num, strheure (time (NULL)), event_string[event]); wheader (voie, W_VOIE, s); if (voie != CONSOLE) lastaff = voie; fin_io (); } ff (); return; } int dec_voie (int voie) { char temp[80]; int save_voie, autre_voie; df ("dec_voie", 1); if (svoie[voie]->kiss != -1) { if (svoie[voie]->kiss < 0) svoie[voie]->kiss = CONSOLE; if (p_port[no_port (voie)].typort == TYP_BPQ) { int kiss = svoie[voie]->kiss; selvoie (kiss); texte (T_GAT + 0); aff_freq (); texte (T_GAT + 1); aff_etat ('E'); send_buf (voie); svoie[kiss]->niv3 = 1; svoie[kiss]->cross_connect = -1; svoie[voie]->kiss = -1; selvoie (voie); } else { int kiss = svoie[voie]->kiss; selvoie (kiss); svoie[kiss]->niv3 = 2; texte (T_GAT + 4); selvoie (voie); ff (); return (0); } } if ((svoie[voie]->binary) && (svoie[voie]->niv1 == N_FORW) && (svoie[voie]->niv2 == 5) && (svoie[voie]->niv3 == 4)) { /* Vide le message en cours de reception */ if (svoie[voie]->fbb >= 2) { write_temp_bin (voie, FALSE); libere (voie); } else { del_part (voie, svoie[voie]->entmes.bid); libere (voie); } } programm_indic (voie); del_temp (voie); del_copy (voie); if (svoie[voie]->cross_connect != -1) { autre_voie = svoie[voie]->cross_connect; if (svoie[autre_voie]->kiss != -1) { if (svoie[autre_voie]->kiss < 0) svoie[autre_voie]->kiss = CONSOLE; save_voie = voie; selvoie (autre_voie); dec (autre_voie, 1); dec (autre_voie, 1); selvoie (save_voie); fin_tnc (); } svoie[autre_voie]->cross_connect = svoie[autre_voie]->kiss = -1; } if (v_tell == voie) { console_off (); v_tell = 0; music (0); svoie[CONSOLE]->sta.connect = 0; svoie[CONSOLE]->niv1 = svoie[CONSOLE]->niv2 = svoie[CONSOLE]->niv3 = 0; } if (svoie[voie]->l_yapp) { svoie[voie]->finf.lastyap = svoie[voie]->l_yapp; svoie[voie]->l_yapp = 0L; } if (svoie[voie]->sta.connect) { if (svoie[voie]->sta.connect > 1) aff_event (voie, 2); status (voie); if (((!voie_forward (voie)) && (svoie[voie]->sta.connect != 17)) || ((voie_forward (voie)) && (svoie[voie]->curfwd->no_con >= 8))) { majfich (voie); } svoie[voie]->deconnect = svoie[voie]->sta.connect = FALSE; aff_nbsta (); curseur (); } if (svoie[voie]->curfwd) { svoie[voie]->curfwd->forward = -1; svoie[voie]->curfwd->no_bbs = 0; } /********* A VERIFIER !! ********** if (voie == p_port[no_port(voie)].forward) { p_port[no_port(voie)].forward = -1 ; } */ svoie[voie]->mode = 0; #ifndef __WINDOWS__ if (svoie[voie]->binary) aff_yapp (voie); #endif #ifdef __LINUX__ kill_rzsz (voie); #endif if (P_TOR (voie)) { int port = no_port (voie); clear_queue (voie); if (p_port[port].t_busy) { m_libere (p_port[port].t_busy->userdata, sizeof (PortData)); del_timer (p_port[port].t_busy); p_port[port].t_busy = NULL; } if (p_port[port].t_wait) { m_libere (p_port[port].t_wait->userdata, sizeof (PortData)); del_timer (p_port[port].t_wait); p_port[port].t_wait = NULL; } del_timer (p_port[port].t_iss); p_port[port].t_iss = NULL; } svoie[voie]->deconnect = svoie[voie]->sta.connect = svoie[voie]->sta.stat = 0; svoie[voie]->temp1 = 1; svoie[voie]->fbb = bin_fwd; svoie[voie]->timout = time_n; if (svoie[voie]->conf) { svoie[voie]->conf = 0; text_conf (T_CNF + 5); } svoie[voie]->curfwd = NULL; set_binary (voie, 0); set_bs (voie, TRUE); svoie[voie]->conf = svoie[voie]->seq = 0; svoie[voie]->niv1 = svoie[voie]->niv2 = svoie[voie]->niv3 = 0; svoie[voie]->paclen = p_port[no_port (voie)].pk_t; svoie[voie]->cross_connect = -1; svoie[voie]->kiss = -1; svoie[voie]->groupe = -1; svoie[voie]->cur_bull = -1L; svoie[voie]->ch_mon = -1; svoie[voie]->clock = '\0'; svoie[voie]->tmach = 0; svoie[voie]->memoc = 0; svoie[voie]->rev_mode = 1; svoie[voie]->type_yapp = 0; svoie[voie]->aut_linked = 1; svoie[voie]->maj_ok = FALSE; svoie[voie]->ind_mess = 0; svoie[voie]->nb_prompt = 0; svoie[voie]->prot_fwd = prot_fwd; if (svoie[voie]->ctnc) libere_tnc (&(svoie[voie]->ctnc)); /*************** svoie[voie]->ncur->coord = 0xffff; *****************/ unlink (copy_name (voie, temp)); libere_zones_allouees (voie); /* Vide les eventuelles listes */ init_fb_mess (voie); fbb_log (voie, 'X', "D"); aff_forward (); #if defined(__WINDOWS__) || defined(__LINUX__) window_disconnect (voie); #endif ff (); return (1); } int port_free (int port) { int i; int free; df ("port_free", 1); free = p_port[port].nb_voies; for (i = 1; i < NBVOIES; i++) { if ((no_port (i) == port) && (svoie[i]->sta.connect)) --free; } ff (); return (free); } #define STATIMER 5 static void pactor_data (int port, int voie) { static long prev = 0; static long pprev = 0; long delta; int tempo; if (pprev) { delta = p_port[port].cur - pprev; tempo = STATIMER * 2; } else { delta = p_port[port].cur - prev; tempo = STATIMER; } if (delta < 0) delta = 0; pprev = prev; prev = p_port[port].cur; sta_drv (voie, TOR, "%T"); if (svoie[voie]->sta.connect) { p_port[port].nbc = (int) (delta / tempo); add_timer (STATIMER, port, pactor_data, (void *) voie); } else { prev = pprev = 0; p_port[port].nbc = 0; } aff_traite (voie, -1); } int con_voie (int voie, char *ptr) { int i; int port, canal; df ("con_voie", 3); if (svoie[voie]->kiss != -1) { int kiss_voie = svoie[voie]->kiss; svoie[kiss_voie]->niv3 = 3; ff (); return (0); } else { if (arret) svoie[voie]->dde_marche = TRUE; else svoie[voie]->dde_marche = FALSE; init_timout (voie); svoie[voie]->nb_err = svoie[voie]->seq = svoie[voie]->stop = 0; connect_fen (); lastaff = -1; svoie[voie]->private_dir = 0; /* svoie[voie]->wp = 0; */ svoie[voie]->ret = 0; svoie[voie]->sid = 0; svoie[voie]->pack = 0; svoie[voie]->read_only = 0; svoie[voie]->aut_nc = 0; svoie[voie]->vdisk = 2; svoie[voie]->cmd_new = 0; svoie[voie]->rev_param = 0; svoie[voie]->log = 1; svoie[voie]->sta.stat = svoie[voie]->sta.connect = 4; svoie[voie]->deconnect = FALSE; svoie[voie]->ch_mon = svoie[voie]->cross_connect = -1; set_binary (voie, 0); svoie[voie]->sr_mem = svoie[voie]->conf = 0; *svoie[voie]->sr_fic = '\0'; /* p_debug(no_port(voie), "Bip"); */ bipper (); svoie[voie]->tstat = svoie[voie]->debut = time (NULL); svoie[voie]->aut_linked = 1; svoie[voie]->tmach = 0L; svoie[voie]->sta.ret = svoie[voie]->sta.ack = svoie[voie]->mode = 0; svoie[voie]->msg_held = 0; svoie[voie]->xferok = svoie[voie]->mess_recu = 1; svoie[voie]->entmes.numero = 0L; svoie[voie]->nb_egal = 0; svoie[voie]->mbl_ext = 1; svoie[voie]->rev_mode = 1; svoie[voie]->r_tete = NULL; *svoie[voie]->passwd = '\0'; if (strtok (NULL, " ")) { ptr = strtok (NULL, " "); /* sta.indicatif */ if (*(ptr + 1) == ':') { /* Connexion DRSI ou BPQ */ canal = *ptr - '0'; if (DRSI (no_port (voie))) { port = drsi_port (no_port (voie), canal); svoie[voie]->affport.port = port; } else if (HST (no_port (voie))) { port = hst_port (no_port (voie), canal); svoie[voie]->affport.port = port; } else if (BPQ (no_port (voie))) { port = bpq_port (no_port (voie), canal); svoie[voie]->affport.port = port; } #ifdef __WINDOWS__ else if (AGW (no_port (voie))) { port = agw_port (no_port (voie), canal); svoie[voie]->affport.port = port; } #endif #ifdef __LINUX__ else if (S_LINUX (no_port (voie))) { port = linux_port (no_port (voie), canal); svoie[voie]->affport.port = port; } #endif else { port = no_port (voie); } ptr += 2; /* Drsi Port */ if (port_free (port) < 0) svoie[voie]->deconnect = 7; } /* if (*ptr == '!') */ if (*ptr && !isalnum(*ptr)) /* PTC-II prefixes the call with some characters */ ++ptr; svoie[voie]->sta.indicatif.num = extind (ptr, svoie[voie]->sta.indicatif.call); } for (i = 0; i < 8; i++) *(svoie[voie]->sta.relais[i].call) = '\0'; ptr = (strtok (NULL, " ")); if (ptr && ((*ptr == 'v') || (*ptr == 'V'))) { /* relais */ i = 0; while ((ptr = strtok (NULL, " ")) != NULL) { svoie[voie]->sta.relais[i].num = extind (ptr, svoie[voie]->sta.relais[i].call); i++; } } /* svoie[voie]->paclen = p_port[no_port(voie)].pk_t; */ aff_event (voie, 1); status (voie); curseur (); #if defined(__WINDOWS__) || defined(__LINUX__) window_connect (voie); #endif svoie[voie]->entmes.bid[0] = '\0'; init_fb_mess (voie); connexion (voie); /* positionne ncur */ new_om = nouveau (voie); /* nb de lignes de la pagination */ /* svoie[voie]->mode = svoie[voie]->finf.flags & 0xff ; */ svoie[voie]->mode = 0; svoie[voie]->l_mess = 0L; svoie[voie]->l_yapp = 0L; if ((fbb_fwd) && (svoie[voie]->fbb)) { svoie[voie]->mode |= F_NFW; /* Supporte le protocole FBB */ } svoie[voie]->mbl = TRUE; svoie[voie]->maj_ok = 0; if (svoie[voie]->niv1 == 0) connect_log (voie, "\0"); change_droits (voie); strcpy (svoie[voie]->dos_path, "\\"); aff_nbsta (); if ((P_READ (voie)) && (!SYS (svoie[voie]->finf.flags)) && (!LOC (svoie[voie]->finf.flags))) { svoie[voie]->read_only = 1; /* read_only_alert (0, indd); */ } if (P_TOR (voie)) { /* clear_queue (voie); TEST F6FBB */ sta_drv (voie, TOR, "%T"); add_timer (STATIMER, no_port (voie), pactor_data, (void *) voie); if (svoie[voie]->niv1 == 0) { /* Appel entrant */ tor_start (voie); /* WinDebug("Incoming Call\r\n"); */ } else { /* Appel entrant */ tor_stop (voie); /* WinDebug("Outgoing Call\r\n"); */ } } if (POP (no_port (voie))) { send_list(voie); svoie[voie]->mode |= F_FOR; } if ((svoie[voie]->ctnc == NULL) && (BBS (svoie[voie]->finf.flags))) prog_rev_tnc (voie); ff (); return (1); } } void connect_log (int voie, char *ajoute) { int i; char s[256], s1[80]; df ("connect_log", 3); sprintf (s, "%c %s-%d", (char) no_port (voie) + '@', svoie[voie]->sta.indicatif.call, svoie[voie]->sta.indicatif.num); for (i = 0; i < 8; i++) { if (*(svoie[voie]->sta.relais[i].call) == '\0') break; if (i == 0) strcat (s, " VIA "); else strcat (s, ","); if (svoie[voie]->sta.relais[i].num) sprintf (s1, "%s-%d", svoie[voie]->sta.relais[i].call, svoie[voie]->sta.relais[i].num); else sprintf (s1, "%s", svoie[voie]->sta.relais[i].call); strcat (s, s1); } strcat (s, ajoute); fbb_log (voie, 'C', s); ff (); return; } #ifdef LOG FILE *logfp; int curlog = 0; int flog = 0; char liglog[80]; char *ptrlog; open_log (void) { df ("open_log", 1); logfp = fopen ("RES.RES", "wt"); curlog = 0; flog = 1; ff (); return; } write_log (int c) { df ("write_log", 1); if (flog == 0) { ff (); return; } liglog[curlog] = (isgraph (c)) ? c : '.'; fprintf (logfp, "%02x ", c & 0xff); if (++curlog == 16) { liglog[curlog] = '\0'; fprintf (logfp, " %s\n", liglog); curlog = 0; } ff (); return; } close_log (void) { df ("close_log", 1); fclose (logfp); flog = 0; ff (); return; } #endif int kam_commande (int voie, char *chaine) { int retour; retour = sta_drv (voie, SNDCMD, (void *) chaine); return (retour); } void monitor (int port, char *buffer, int nb) { int i; int old_voie; for (i = 0; i < NBVOIES; i++) { if (svoie[i]->ch_mon == port) { old_voie = voiecur; selvoie (i); prog_more (i); /* cprintf("Envoie monitor sur voie %d\r\n") ; */ outsln (buffer, nb); selvoie (old_voie); } } return; } int rcv_tnc (int port) { int c; int nb = 0; char s[80]; df ("rcv_tnc", 1); if (!DEBUG) { tempo = 50; while (tempo) { if ((c = rec_tnc (port)) >= 0) { ff (); return (c); } #ifdef __WINDOWS__ BWinSleep (50); if (tempo > 0) --tempo; #endif } if (p_port[port].typort == TYP_DED) { while (((c = rec_tnc (port)) == -1) && (nb < 255)) { if (operationnel) { } nb++; /* a mettre dans la fenetre */ #ifdef __WINDOWS__ DisplayResync (port, nb); #else sprintf (s, "Port %d Resync %-4d", port, nb); aff_chaine (W_DEFL, 1, 1, s); #endif /*if (!getvoie(CONSOLE)->sta.connect) cprintf("\r%s", s) ; */ /* cprintf(" %d", nb_int) ; */ while (car_tx (port)) ; /* attend que le buffer d'emission soit vide */ send_tnc (port, '\001'); tempo = 2; while (tempo) { #ifdef __WINDOWS__ BWinSleep (50); if (tempo > 0) --tempo; #endif /* environ 100 ms */ } } if (c == -1) { if (!svoie[CONSOLE]->sta.connect) cprintf ("Resynchronisation impossible. Systeme arrete !!\r\n"); fbb_error (ERR_SYNCHRO, "DED RECEIVE DATA", port); ff (); return (-1); } } vide (port, 0); ++com_error; #ifdef __WINDOWS__ DisplayResync (port, 0); #endif ff (); return (-1); } ff (); return (-1); } int vide (int port, int echo) { int c, nb = 0; df ("vide", 2); if ((DEBUG) || (!p_port[port].pvalid)) { deb_io (); cprintf ("Erreur port %d!\n", port); fin_io (); ff (); return (0); } p_port[port].portind = 0; tempo = 20; deb_io (); while (tempo) { if ((c = rec_tnc (port)) >= 0) { #ifdef __FBBDOS__ if (echo) { putch (c); if (c == '\r') putch ('\n'); } #endif tempo = 20; ++nb; } #ifdef __WINDOWS__ else { BWinSleep (100); if (tempo > 0) --tempo; } #endif #ifdef __LINUX__ else { usleep (100000); if (tempo > 0) --tempo; } #endif } fin_io (); ff (); return (nb); } /* * end of tncio.c * */ fbb-7.04j/src/trait.c0100644000175100017510000005716107726646105012507 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * TRAIT.C * */ #include #include static int cross_connexion (void); static int dde_prenom (void); static void accueil (void); static void aff_new_message (void); static void arret_serveur (char *, int); static void inconnu (void); static void insere_info (int); static void majrelai (int); static void majstat (int); static void menu_serveur (int, int); static void mess_cross_connect (void); static void pont (void); /* * PROCEDURES GENERALES A TOUS LES NIVEAUX * AIDE EN LIGNE - ECHANGE DE MESSAGES */ #define AIDE -1 int defaut (void) { int i, sum_call; switch (toupper (*indd)) { case '?': case 'H': ++indd; if (ISPRINT (*indd)) { while (isspace (*indd)) ++indd; help (indd); } else prompt (AIDE, pvoie->niv1); break; case '#': texte (T_MBL + 8); prompt (pvoie->finf.flags, pvoie->niv1); break; case '!': q_mark (); prompt (pvoie->finf.flags, pvoie->niv1); break; case '>': if (pvoie->read_only) return (0); pont (); prompt (pvoie->finf.flags, pvoie->niv1); break; case '=': if (pvoie->read_only) return (0); pvoie->sniv1 = pvoie->niv1; pvoie->sniv2 = pvoie->niv2; pvoie->sniv3 = pvoie->niv3; maj_niv (0, 4, 0); if (!cross_connexion ()) { maj_niv (pvoie->sniv1, pvoie->sniv2, pvoie->sniv3); prompt (pvoie->finf.flags, pvoie->niv1); } break; case '%': mbl_stat (); retour_menu (pvoie->niv1); break; case '/': incindd (); if (isdigit (*indd)) { i = 0; sum_call = 0; while (isalnum (mycall[i])) sum_call += (int) mycall[i++]; if (atoi (indd) == sum_call) { pvoie->sniv1 = pvoie->niv1; pvoie->sniv2 = pvoie->niv2; pvoie->sniv3 = pvoie->niv3; maj_niv (0, 3, 2); while (isdigit (*indd)) ++indd; arret_serveur (d_disque ("ETAT.SYS"), FALSE); } else { texte (T_ERR + 0); prompt (pvoie->finf.flags, pvoie->niv1); } } else { if (droits (CMDRESET)) { pvoie->sniv1 = pvoie->niv1; pvoie->sniv2 = pvoie->niv2; pvoie->sniv3 = pvoie->niv3; maj_niv (0, 3, 0); arret_serveur (d_disque ("ETAT.SYS"), TRUE); } else { texte (T_ERR + 0); prompt (pvoie->finf.flags, pvoie->niv1); } } break; default: return (0); } return (1); } static int ok_break (int voie) { return ((svoie[voie]->niv3 == 0) && (svoie[voie]->niv1 != N_DOS) && (svoie[voie]->niv1 != N_FORW) && (svoie[voie]->niv1 != N_TELL) && (svoie[voie]->niv1 != N_CONF) && (svoie[voie]->niv1 != N_GATE) && (svoie[voie]->niv1 != N_YAPP) && (!FOR (svoie[voie]->mode))); } static int convers (int voie) { return ((svoie[voie]->niv1 == 0) && (svoie[voie]->niv2 == 4) && (svoie[voie]->niv3 == 1)); } int cross_connexion (void) { int voie_exp, voie_dest; char temp[20]; int i = 0; switch (pvoie->niv3) { case 0: ++indd; while (!ISGRAPH (*indd)) ++indd; while (isalnum (*indd)) { if (i < 10) temp[i++] = *indd; ++indd; } temp[i] = '\0'; while (*indd && (!ISGRAPH (*indd))) ++indd; if (find (temp)) { if ((voie_dest = num_voie (temp)) != -1) { if ((!FOR (svoie[voie_dest]->mode)) && (svoie[voie_dest]->cross_connect == -1) && (svoie[voie_dest]->kiss == -1)) { pvoie->cross_connect = voie_dest; svoie[voie_dest]->cross_connect = voiecur; if (ok_break (voie_dest)) { if (voie_dest != voiecur) { svoie[voie_dest]->sniv1 = svoie[voie_dest]->niv1; svoie[voie_dest]->sniv2 = svoie[voie_dest]->niv2; svoie[voie_dest]->sniv3 = svoie[voie_dest]->niv3; voie_exp = voiecur; selvoie (voie_dest); maj_niv (0, 4, 1); selvoie (voie_exp); } mess_cross_connect (); } else texte (T_TRT + 0); maj_niv (0, 4, 1); return (TRUE); } else texte (T_TRT + 1); } else { var_cpy (0, temp); texte (T_TRT + 2); } } else texte (T_ERR + 0); return (FALSE); case 1: voie_dest = pvoie->cross_connect; if (voie_dest >= 0) { voie_exp = voiecur; selvoie (voie_dest); if (!pvoie->sta.connect) { svoie[voie_exp]->cross_connect = pvoie->cross_connect = -1; } else { if (*indd) { if (*indd == CTRLZ) { svoie[voie_exp]->cross_connect = pvoie->cross_connect = -1; if ((pvoie->niv1 == svoie[voie_exp]->niv1) && (pvoie->niv2 == svoie[voie_exp]->niv2) && (pvoie->niv3 == svoie[voie_exp]->niv3)) { maj_niv (pvoie->sniv1, pvoie->sniv2, pvoie->sniv3); texte (T_TRT + 4); prompt (pvoie->finf.flags, pvoie->niv1); } /* break ; */ } else if (convers (voie_dest)) { outs (indd, strlen (indd)); } } } selvoie (voie_exp); } if ((voie_dest != voiecur) && (pvoie->cross_connect == -1)) { texte (T_TRT + 4); maj_niv (pvoie->sniv1, pvoie->sniv2, pvoie->sniv3); prompt (pvoie->finf.flags, pvoie->niv1); } break; } return (TRUE); } static void arret_serveur (char *fich_etat, int typ) { FILE *file_ptr; long caltemps; while ((*indd) && (!ISGRAPH (*indd))) indd++; switch (toupper (*indd)) { case 'A': /* Stop */ arret = TRUE; texte (T_TRT + 9); send_buf (voiecur); maintenance (); #ifdef __FBBDOS__ exit (4); #else fbb_quit (4); #endif break; case 'K': /* Maintenance */ texte (T_TRT + 9); house_keeping (); break; case 'L': /* Re-Run */ texte (T_TRT + 9); save_fic = 1; #ifdef __FBBDOS__ affich_logo (W_DEFL); #endif type_sortie = 2; set_busy (); break; case 'M': /* Immediate Re-run */ texte (T_TRT + 9); aff_etat ('E'); send_buf (voiecur); attend_caractere (1); maintenance (); exit (2); case 'R': /* Stop */ if ((file_ptr = fopen (fich_etat, "r+t")) == NULL) fbb_error (ERR_OPEN, fich_etat, 1); else { fseek (file_ptr, 64L, 0); fprintf (file_ptr, "Reset demande par %s-%c le %s\n", pvoie->sta.indicatif.call, pvoie->sta.indicatif.num, strdate (time (&caltemps))); ferme (file_ptr, 52); } texte (T_TRT + 10); maintenance (); /* reboot serveur */ #ifdef __LINUX__ exit (6); #endif #ifdef __WINDOWS__ ExitWindows (EW_REBOOTSYSTEM, 0); #endif #ifdef __FBBDOS__ reset (); #endif break; default: cmd_err (indd); break; } maj_niv (pvoie->sniv1, pvoie->sniv2, pvoie->sniv3); prompt (pvoie->finf.flags, pvoie->niv1); } static void pont (void) { int voie_exp, voie_dest; char temp[20]; int i = 0; ++indd; while (!ISGRAPH (*indd)) ++indd; while (isalnum (*indd)) { if (i < 10) temp[i++] = *indd; ++indd; } temp[i] = '\0'; while (*indd && (!ISGRAPH (*indd))) ++indd; if (find (temp)) { if (*indd) { if ((voie_dest = num_voie (temp)) != -1) { if (ok_break (voie_dest)) { voie_exp = voiecur; selvoie (voie_dest); /* Ajout */ var_cpy (0, svoie[voie_exp]->sta.indicatif.call); texte (T_TRT + 5); outs (indd, strlen (indd)); cr_cond (); texte (T_TRT + 6); selvoie (voie_exp); /* Ajout */ var_cpy (0, svoie[voie_dest]->sta.indicatif.call); texte (T_TRT + 7); } else { texte (T_TRT + 1); } } else { var_cpy (0, temp); texte (T_TRT + 2); } } else texte (T_ERR + 4); } else texte (T_ERR + 0); } static void mess_cross_connect (void) { int voie_dest, voie_exp; voie_dest = pvoie->cross_connect; var_cpy (0, svoie[voie_dest]->sta.indicatif.call); texte (T_TRT + 3); if (voie_dest != voiecur) { voie_exp = voiecur; selvoie (voie_dest); var_cpy (0, svoie[voie_exp]->sta.indicatif.call); texte (T_TRT + 3); selvoie (voie_exp); } } static void menu_serveur (int typ_aide, int pos) { if (typ_aide != AIDE) texte (pos); else { if (droits (MODLABEL)) texte (pos + 1); texte (pos + 2); } } static void aff_new_message (void) { if (pvoie->ncur->nbnew) { itoa (pvoie->ncur->nbnew, varx[0], 10); if (strcmp (pvoie->ncur->indic, "MODEM") != 0) texte (T_MES + 10); } } void prompt (int typ_aide, int niveau) { if ((pvoie->niv1 != N_TELL) && (pvoie->cross_connect != -1)) { mess_cross_connect (); pvoie->sniv1 = pvoie->niv1; pvoie->sniv2 = pvoie->niv2; pvoie->sniv3 = pvoie->niv3; maj_niv (0, 4, 1); return; } if (pvoie->ptemp) { m_libere ((char *) pvoie->ptemp, pvoie->psiz); pvoie->ptemp = NULL; pvoie->psiz = 0; } pvoie->sr_mem = 0; switch (niveau) { case N_MENU: menu_serveur (typ_aide, T_MEN); break; case N_QRA: menu_serveur (typ_aide, T_QRA); break; case N_STAT: menu_serveur (typ_aide, T_STA); break; case N_INFO: doc_path (); menu_serveur (typ_aide, T_INF); break; case N_NOMC: menu_serveur (typ_aide, T_NOM); break; case N_TRAJ: menu_serveur (typ_aide, T_TRJ); break; case N_DOS: prompt_dos (); break; case N_TELL: if (pvoie->niv3 == 1) texte (T_GAT + 1); else texte (T_GAT + 4); break; default: if (FOR (pvoie->mode)) texte (T_MBL + 43); else if (BBS (typ_aide)) texte (T_MBL + 0); else if (EXP (typ_aide) || P_BBS (voiecur)) { aff_new_message (); texte (T_MBL + 0); } else if (LOC (typ_aide) || SYS (typ_aide)) { aff_new_message (); texte (T_MBL + 2); } else if (P_GUEST (voiecur)) { aff_new_message (); texte (T_MBL + 1); } else { aff_new_message (); texte (T_MBL + 2); } break; } pvoie->maj_ok = 1; } char *epure (infptr, len) char *infptr; int len; { char *ptr = infptr; *infptr = '\0'; while ((*indd) && (len)) { if (*indd == ' ') { while (*indd == ' ') indd++; *infptr++ = ' '; --len; } else if (!iscntrl (*indd)) { *infptr++ = *indd++; --len; } else ++indd; } if (*(infptr - 1) == ' ') --infptr; *infptr = '\0'; return (ptr); } /* * ENTETE - ACCUEIL SUR LE SERVEUR */ static char s_langue (char *indic) { char chaine[300]; char ligne[81]; char *ptr, *ind; int ok, niv, val, cpt, nbc; FILE *fptr; if ((fptr = fopen (c_disque ("LANGUE.SYS"), "rt")) == NULL) return ('\0'); ok = cpt = nbc = val = niv = 0; while (fgets (ligne, 80, fptr)) { if (*ligne == '#') continue; switch (niv) { case 0: if (isdigit (*ligne)) { nbc = atoi (ligne); } ++niv; break; case 1: if (++cpt == nbc) ++niv; break; case 2: sscanf (ligne, "%s %d", chaine, &val); val--; ptr = chaine; ind = indic; while (*ptr == *ind) { ++ptr; ++ind; } if (*ptr == '*') ok = 1; else val = 0; break; } if (ok) break; } fclose (fptr); return ((char) val); } void init_info (info * frec, indicat * indicatif) { memset ((char *) frec, '\0', sizeof (info)); strcpy (frec->indic.call, indicatif->call); frec->indic.num = indicatif->num; strcpy (frec->qra, "?"); frec->flags = def_mask; frec->nbl = 20; frec->lang = s_langue (indicatif->call); frec->hcon = time (NULL); frec->lastmes = nomess - 20L; } static int wp_val (int lg, char *field_info, char *wp_value) { char *value; value = (*wp_value == '?') ? "\0" : wp_value; if (*value) n_cpy (lg, field_info, value); else if ((*field_info) && (*field_info != '?')) { return (1); } return (0); } int maj_with_wp (int voie) { Wps *rec; int ok = 0; if (EMS_WPG_OK ()) { if ((rec = wp_find (svoie[voie]->sta.indicatif.call, 1)) != NULL) { ok += wp_val (12, svoie[voie]->finf.prenom, rec->name); ok += wp_val (30, svoie[voie]->finf.ville, rec->first_qth); ok += wp_val (8, svoie[voie]->finf.zip, rec->first_zip); ok += wp_val (40, svoie[voie]->finf.home, rec->first_homebbs); } else { ok = 1; } if (ok) user_wp (&svoie[voie]->finf); return (1); } return (0); } int nouveau (int voie) { int new; FILE *fptr; /* vptr->wp = 0; */ if (svoie[voie]->ncur->coord == 0xffff) { new = 1; /* creer le message d'accueil */ init_info (&svoie[voie]->finf, &svoie[voie]->sta.indicatif); if (find (svoie[voie]->sta.indicatif.call)) { svoie[voie]->ncur->coord = rinfo++; insere_info (voie); } } else { new = 0; fptr = ouvre_nomenc (); fseek (fptr, svoie[voie]->ncur->coord * ((long) sizeof (info)), 0); fread ((char *) &(svoie[voie]->finf), (int) sizeof (info), 1, fptr); ferme (fptr, 18); } maj_with_wp (voie); return (new); } static void inconnu (void) { itoa (pvoie->ncur->nbnew, varx[0], 10); texte (T_MES + 9); } static int dde_prenom (void) { if (info_ok) { pvoie->sniv1 = pvoie->niv1; pvoie->sniv2 = pvoie->niv2; pvoie->sniv3 = pvoie->niv3; maj_niv (N_NOMC, 5, 0); saisie_infos (); return (0); } else { if (*pvoie->finf.prenom == '\0') texte (T_MES + 3); if (*pvoie->finf.ville == '\0') texte (T_MES + 4); if (*pvoie->finf.home == '\0') texte (T_MES + 5); if (*pvoie->finf.zip == '\0') texte (T_MES + 6); return (1); } } void finentete (void) { char s[80]; struct stat bufstat; sprintf (s, "LANG\\%s.ENT", nomlang + nlang * LG_LANG); outfich (c_disque (s)); sprintf (s, "LANG\\%s.NEW", nomlang + nlang * LG_LANG); if ((stat (c_disque (s), &bufstat) == 0) && (bufstat.st_ctime != pvoie->finf.newbanner)) { pvoie->finf.newbanner = bufstat.st_ctime; outfich (c_disque (s)); } if ((pvoie->ncur->nbmess) && (strcmp (pvoie->ncur->indic, "MODEM") != 0)) { if (pvoie->ncur->nbnew) { if (NEW (pvoie->finf.flags)) { cr (); pvoie->typlist = 0; list_messages (1, pvoie->no_indic, 0); cr (); } } else { itoa (pvoie->ncur->nbmess, varx[0], 10); texte (T_MES + 11); } } if ((nb_hold) && (droits_2 (COSYSOP))) { var_cpy (0, itoa (nb_hold, s, 10)); texte (T_MBL + 57); } } static void insere_info (int voie) { FILE *fptr; unsigned r; if (svoie[voie]->ncur) { r = svoie[voie]->ncur->coord; if (r == 0xffff) dump_core (); fptr = ouvre_nomenc (); fseek (fptr, ((long) r) * ((long) sizeof (info)), 0); fwrite ((char *) &(svoie[voie]->finf), (int) sizeof (info), 1, fptr); inscoord (r, &(svoie[voie]->finf), svoie[voie]->ncur); ferme (fptr, 19); } } int accept_cnx (void) { static int test_connect = 2; int retour = 1; int ret; char s[256]; indd[80] = '\0'; if (test_connect) { char buffer[1024]; *buffer = '\0'; #ifdef __LINUX__ sprintf (s, "%sc_filter %s-%d %d %u %d %d %d", FILTDIR, pvoie->sta.indicatif.call, pvoie->sta.indicatif.num, pvoie->niv3, pvoie->finf.flags, new_om, pvoie->ncur->coord, no_port (voiecur)); ret = filter (s, buffer, sizeof (buffer), sup_ln (indd), FILTDIR); #else sprintf (s, "c_filter %s-%d %d %u %d %d %d", pvoie->sta.indicatif.call, pvoie->sta.indicatif.num, pvoie->niv3, pvoie->finf.flags, new_om, pvoie->ncur->coord, no_port (voiecur)); ret = filter (s, buffer, sizeof (buffer), sup_ln (indd), NULL); #endif buffer[1023] = '\0'; if (*buffer) out (buffer, strlen (buffer)); switch (ret) { case -1: if (test_connect == 2) { /* premiere fois ... Pas de C_FILTER trouve */ test_connect = 0; } else { /* Le C_FILTER a retourne -1 ... On deconnecte ! */ pvoie->deconnect = 6; retour = 0; } break; case 0: /* OK... Plus d'appel */ retour = 1; break; case 1: /* Appel avec No incremente */ retour = 0; break; case 2: /* Deconnexion immediate */ pvoie->deconnect = 6; retour = 0; break; case 3: /* Mode read-only */ pvoie->read_only = 1; retour = 1; break; case 4: /* Mode read-only */ pvoie->msg_held = 1; retour = 1; break; default: if (ret >= 100) { /* No redefini par le filtre */ pvoie->niv3 = ret - 1; /* niv3 est incremente apres !! */ retour = 0; } else retour = 0; break; } } if (test_connect == 2) test_connect = 1; return (retour); } static int premices (void) { char *st; init_langue (voiecur); if ((voiecur != CONSOLE) && (!find (pvoie->sta.indicatif.call))) { fbb_log (voiecur, 'X', "I"); pvoie->log = 0; pvoie->deconnect = 3; } else if ((voiecur != CONSOLE) && (EXC (pvoie->finf.flags))) { fbb_log (voiecur, 'X', "E"); pvoie->log = 0; pvoie->deconnect = 3; } else if ((voiecur != CONSOLE) && (P_BBS (voiecur)) && (!LOC (pvoie->finf.flags)) && (!BBS (pvoie->finf.flags))) { fbb_log (voiecur, 'X', "G"); pvoie->log = 0; texte (T_MES + 8); pvoie->deconnect = 6; } else { st = idnt_fwd (); outs (st, strlen (st)); } return (pvoie->deconnect == 0); } static void accueil (void) { df ("accueil", 0); if (accept_cnx ()) { if (POP (no_port (voiecur))) { /* No text for pop connection */ } else if (BBS (pvoie->finf.flags)) { texte (T_MES + 0); } else if (EXP (pvoie->finf.flags) || (SYS (pvoie->finf.flags))) { texte (T_MES + 1); if (new_om) inconnu (); if (!dde_prenom ()) { ff (); return; } finentete (); } else if (P_GUEST (voiecur) && (!LOC (pvoie->finf.flags))) { texte (T_MES + 7); if (new_om) inconnu (); if (!dde_prenom ()) { ff (); return; } finentete (); } else { texte (T_MES + 2); if (new_om) inconnu (); if (!dde_prenom ()) { ff (); return; } finentete (); } if (pvoie->niv1 == N_CONF) { pvoie->conf = 1; } else { maj_niv (N_MBL, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } } else pvoie->niv3++; ff (); } int msg_find (char *s) { char *t = s; int n = 0; if (*t == '_') { ++t; while (*t) { if (*t == '.') break; if (!isdigit (*t)) return (0); ++n; ++t; } return (n); } else return (find (s)); } /* * DECONNEXION DE L'OM */ void sortie (void) { pvoie->deconnect = TRUE; if (pvoie->l_mess) { pvoie->finf.lastmes = pvoie->l_mess; pvoie->l_mess = 0L; } if (voiecur == CONSOLE) close_print (); } void majrelai (int voie) { int i; strcpy (svoie[voie]->finf.indic.call, svoie[voie]->sta.indicatif.call); svoie[voie]->finf.indic.num = svoie[voie]->sta.indicatif.num; for (i = 0; i < 8; i++) { if (*(svoie[voie]->sta.relais[i].call)) { strcpy (svoie[voie]->finf.relai[i].call, svoie[voie]->sta.relais[i].call); svoie[voie]->finf.relai[i].num = svoie[voie]->sta.relais[i].num; } else *(svoie[voie]->finf.relai[i].call) = '\0'; } ++(svoie[voie]->finf.nbcon); } void majstat (int voie) { FILE *fptr; statis bufstat; if ((voie) && (svoie[voie]->ncur) && (svoie[voie]->ncur->coord != 0xffff)) { strncpy (bufstat.indcnx, svoie[voie]->sta.indicatif.call, 6); bufstat.port = (uchar) no_port (voie) - 1; bufstat.voie = (uchar) (voie - 1); bufstat.datcnx = svoie[voie]->debut; bufstat.tpscnx = (int) (time (NULL) - svoie[voie]->debut); if ((fptr = ouvre_stats ()) != NULL) { fseek (fptr, 0L, 2); fwrite ((char *) &bufstat, sizeof (bufstat), 1, fptr); ferme (fptr, 20); } } } void majinfo (int voie, int sens) { /* * Si sens = 1 -> lecture * sens = 2 -> ecriture * sens = 3 -> maj_heure */ FILE *fptr; if ((fptr = fopen (d_disque ("TPSTAT.SYS"), "wb")) == NULL) { fbb_error (ERR_OPEN, d_disque ("TPSTAT.SYS"), 0); } fwrite ((char *) stemps, sizeof (long) * NBRUB, 1, fptr); ferme (fptr, 21); if ((svoie[voie]->ncur) && (svoie[voie]->ncur->coord != 0xffff)) { fptr = ouvre_nomenc (); if ((sens & 1) == 1) { fseek (fptr, svoie[voie]->ncur->coord * ((long) sizeof (svoie[voie]->finf)), 0); fread ((char *) &(svoie[voie]->finf), (int) sizeof (info), 1, fptr); } if ((sens & 2) == 2) { fseek (fptr, svoie[voie]->ncur->coord * ((long) sizeof (info)), 0); svoie[voie]->finf.hcon = svoie[voie]->debut; fwrite ((char *) &(svoie[voie]->finf), (int) sizeof (info), 1, fptr); } ferme (fptr, 22); } } void libere_zones_allouees (int voie) { if (svoie[voie]->ptemp) { m_libere ((char *) svoie[voie]->ptemp, svoie[voie]->psiz); svoie[voie]->ptemp = NULL; svoie[voie]->psiz = 0; } if (svoie[voie]->Xfwd) { m_libere (svoie[voie]->Xfwd, sizeof (XInfo)); svoie[voie]->Xfwd = NULL; } libere (voie); /* message en cours de creation */ libere_tread (voie); /* Liste de lecture de messages */ libere_edit (voie); /* Libere la liste de l'editeur */ /* libere_label(voie) ; Libere les labels de YAPP */ libere_route (voie); /* Libere les routes rx forward */ #ifndef __LINUX__ libere_ymodem (voie, 0);; /* Libere la liste de fichiers */ #endif clear_inbuf (voie); /* Vide le buffer d'entree */ clear_outbuf (voie); /* Vide le buffer de sortie */ } void majfich (int voie) { if (v_tell == voie) { t_tell = -1; v_tell = 0; } libere_zones_allouees (voie); if ((svoie[voie]->ncur) && (svoie[voie]->maj_ok)) { if (voie != CONSOLE) majstat (voie); majrelai (voie); majinfo (voie, 2); } } void retour_menu (int niveau) { if (pvoie->mbl) maj_niv (N_MBL, 0, 0); else if (niveau == N_MENU) maj_niv (niveau, 1, 0); else if (niveau != N_TELL) maj_niv (niveau, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } void q_mark (void) { texte (T_MES + 13); } void limite_commande (void) { if (nb_trait > 80) { indd[80] = '\0'; nb_trait = 80; } } /* * MENU PRINCIPAL - PREMIER NIVEAU */ #ifndef MINISERV void choix (void) { int c, modex, error = 0; char com[80]; limite_commande (); while (*indd && (!ISGRAPH (*indd))) indd++; strn_cpy (70, com, indd); switch (toupper (*indd)) { case 'Q': maj_niv (N_QRA, 0, 0); incindd (); qraloc (); break; case 'C': maj_niv (N_STAT, 0, 0); incindd (); statistiques (); break; case 'D': maj_niv (N_INFO, 0, 0); *pvoie->ch_temp = '\0'; incindd (); documentations (); break; case 'N': maj_niv (N_NOMC, 0, 0); incindd (); nomenclature (); break; case 'T': maj_niv (N_TRAJ, 0, 0); incindd (); trajec (); break; case 'F': if (indd == data) { if ((*(indd + 1) == '>') && (FOR (pvoie->mode))) { maj_niv (N_FORW, 1, 0); fwd (); break; } } pvoie->mbl = TRUE; /* pvoie->mode = pvoie->finf.flags ; */ /* ??????????????????? */ pvoie->mode = 0; texte (T_TRT + 13); maj_niv (N_MBL, 0, 0); prompt (pvoie->finf.flags, N_MBL); break; case 'B': maj_niv (N_MENU, 0, 0); sortie (); break; case '[': modex = TRUE; while ((c = *indd) != '\0') { ++indd; if (c == '\n') modex = FALSE; if ((modex) && (*indd == ']')) { pvoie->mode = F_FOR; } } prompt (pvoie->finf.flags, pvoie->niv1); break; case ';': break; case '\0': prompt (pvoie->finf.flags, pvoie->niv1); break; default: if (!defaut ()) error = 1; break; } if (error) { ch_niv1 (N_MENU); cmd_err (indd); } } #endif void menu_principal (void) { df ("menu_principal", 0); switch (pvoie->niv2) { case 0: if (premices ()) { ch_niv2 (2); accueil (); } break; #ifndef MINISERV case 1: choix (); break; #endif case 2: accueil (); break; case 3: arret_serveur (d_disque ("ETAT.SYS"), 1); break; case 4: cross_connexion (); break; default: fbb_error (ERR_NIVEAU, "PRIM-MENU", pvoie->niv2); break; } ff (); } fbb-7.04j/src/trajec.c0100644000175100017510000003545307726646105012634 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE TRAJECTOGRAPHIE */ #include /* * Constantes de la trajectographie satellite */ #ifndef PI #define PI 3.1415926535 #endif #define P0 0.017453292519 #define CC 2.997925e5 #define R0 6378.16 /* Rayon terrestre a l'equateur */ #define F 0.00335289187 #define F2 0.001676445935 /* f/2 */ #define G0 7.5369793e13 #define G1 1.0027379093 #define EPSILON 1e-8 /* parametres satellite */ static double i0; /* inclinaison plan orbite sur plan equateur */ static double a0; static double a8; static double a9; static double c1; static double c11; static double c12; static double c21; static double c22; static double c31; static double c32; static double c7; static double c8; static double c9; static double e0; static double e1; static double e2; static double e8; static double e9; static double f1; static double f9; static double g2; static double g3; static double h9; static double jjdeb; static double jjref; static double k; static double k0; static double k_prec; static double l5; static double l9; static double m0; static double m8; static double m9; static double n0; static double n8; static double o0; static double pas_var; static double q0; static double q3; static double r5; static double r8; static double r_doppler; static double s1; static double s7; static double s8; static double s9; static double t9; static double v1; static double w0; static double w5; static double w9; static double x9; static double x_sat; static double y9; static double y_sat; static double z9; static double z_sat; static double julien (double, int, int, int, int, int); static int round (double); static long julien_to_pc (double); static void calc1_trajec (void); static void calcul_page_trajec (int); static void calpas (void); static void entete_sat (char *); static void ligne_sat (int, int, int, int, double, long, long, int, int, int); static void load_param_satel (int entete); static void load_param_station (void); static void orbite_sat (double date_sat, long no); static void precal_trajec (void); static void resimp_trajec (void); static void satpos (void); static void satsta (void); static int round (double val) { if (val > 0.0) return ((int) (val + 0.5)); else return ((int) (val - 0.5)); } static double julien (double d3, int n3, int y3, int h3, int m3, int s3) { double j8; if (n3 == 0) n3 = 1; if (n3 < 3) { --y3; n3 += 12; } if (y3 < 80) y3 += 2000; else if (y3 < 100) y3 += 1900; j8 = floor ((double) y3 / 100.); j8 = floor (j8 / 4.) - j8 + floor (365.25 * (double) y3) + floor (30.6001 * (double) (n3 + 1)) + floor (d3) + 1720997.; j8 += (d3 - floor (d3) + (3600. * (double) h3 + 60. * (double) m3 + (double) s3) / 86400. + 2e-6); return (j8); } static long julien_to_pc (double jj) { /* Conversion jour julien en date systeme */ long tps_jul; tps_jul = (long) ((jj - 2440588.) * 86400.); return (tps_jul); } long date_to_pc (int d3, int n3, int y3, int h3, int m3, int s3) { return (julien_to_pc (julien ((double) d3, n3, y3, h3, m3, s3))); } /* * CALCULS TRAJECTOGRAPHIE */ static void init_trajec (void) { /* r6, r4 = sauvegardes des 2 dernieres distances pour calcul doppler */ pvoie->r6 = 0.0; pvoie->r4 = 0.0; pvoie->t_trajec = 0.0; } static void precal_trajec (void) { /* en entree : pvoie->tdeb, e0, i0, m0, k0 * en sortie : constantes g2, e2, e1, s1, c1, q0 * k_prec, pas_var */ double t2, r2; double y4; y4 = (double) (pvoie->tdeb.annee - 1); t2 = floor (y4 / 400.0) - floor (y4 / 100.0) + floor (365.25 * y4); t2 = (t2 - 693595.5) / 36525.0; r2 = 6.6460656 + 2400.051262 * t2 + 0.00002581 * t2 * t2; g2 = (r2 - (24.0 * (y4 - 1899.0))) / 24.0; e2 = 1.0 - e0 * e0; e1 = sqrt (e2); s1 = sin (i0 * P0); c1 = cos (i0 * P0); q0 = m0 / 360.0 + (double) k0; k_prec = 0L; /* orbite precedente pour affichage message de changement d'orbite */ pas_var = t9; /* pas de calcul variable en fonction de la visibilite */ } static void calc1_trajec (void) { /* en entree : n0, jjdeb, jjref, q3, e2, o0, c1, s1, k * en sortie : n8 = mouvement moyen corrige * a8 = demi grand axe corrige * o8 = raan corrige * m8, m9 = phase * c11, c12, c21, c22, c31, c32 = coef matrice passage * repere plan orbite a repere inertie celeste * c7, s7 = coef passage repere inertie celeste * a repere terrestre */ double u8, k2, o8, w8, s0, c0, s2, c2, gg7, q, temp; u8 = jjdeb + pvoie->t_trajec - jjref; n8 = n0 + q3 * u8; a8 = pow ((G0 / (n8 * n8)), 1.0 / 3.0); k2 = (9.95 * pow ((R0 / a8), 3.5) * u8) / (e2 * e2); o8 = o0 - k2 * c1; s0 = sin (o8 * P0); c0 = cos (o8 * P0); w8 = w0 + k2 * (2.5 * c1 * c1 - 0.5); s2 = sin (w8 * P0); c2 = cos (w8 * P0); c11 = c2 * c0 - s2 * s0 * c1; c12 = -s2 * c0 - c2 * s0 * c1; c21 = c2 * s0 + s2 * c0 * c1; c22 = c2 * c0 * c1 - s2 * s0; c31 = s2 * s1; c32 = c2 * s1; gg7 = (g3 + u8) * G1 + g2; /* calcul temps sideral */ gg7 = modf (gg7, &temp) * PI * 2.0; s7 = -sin (gg7); c7 = cos (gg7); /* calcul de la phase */ q = q0 + n8 * u8; k = (long) q; if (q < 0.) k--; m9 = (int) ((q - (double) k) * 256.0 + 0.5); m8 = (q - (double) k) * PI * 2.0; } static void satpos (void) { /* en entree : m8, e0, a8, e1 * en sortie : x_sat, y_sat, z_sat, r8 */ double e, s4, c4, r3, am5, x0, y0, x1, y1, z1; /* e = solution equation de Kepler. */ e = m8 + sin (m8) * e0 + 0.5 * e0 * e0 * sin (2.0 * m8); do { /* putchar('#') ; */ s4 = sin (e); c4 = cos (e); r3 = 1.0 - e0 * c4; am5 = e - e0 * s4 - m8; e -= am5 / r3; } while (fabs (am5) > EPSILON); /* Position satellite ds plan orbite */ x0 = a8 * (c4 - e0); y0 = a8 * e1 * s4; r8 = a8 * r3; /* Position du satellite ds repere inertie celeste */ x1 = x0 * c11 + y0 * c12; y1 = x0 * c21 + y0 * c22; z1 = x0 * c31 + y0 * c32; /* Position satellite ds repere terrestre */ x_sat = x1 * c7 - y1 * s7; y_sat = x1 * s7 + y1 * c7; z_sat = z1; } static void satsta (void) { /* en entree : x_sat, y_sat, z_sat, x9, y9, z9 * pas_var * f1, v1, pvoie->r4, pvoie->r6 * en sortie : r_doppler, pvoie->r4, pvoie->r6, f9 * r5, e9, a9, l5, w5 */ double x5, y5, z5, x8, y8, z8, s5, c5, b5; x5 = x_sat - x9; y5 = y_sat - y9; z5 = z_sat - z9; r5 = sqrt (x5 * x5 + y5 * y5 + z5 * z5); /* distance du satellite */ /* parametres doppler */ if (pvoie->t_trajec > t9) r_doppler = (pvoie->r4 - 4.0 * pvoie->r6 + 3.0 * r5) / pas_var / 172800.0; else r_doppler = 0.0; pvoie->r4 = pvoie->r6; pvoie->r6 = r5; f9 = -f1 * 1e6 * r_doppler / CC - 1000.0 * v1; /* Position satellite ds repere station */ x8 = z5 * c9 - x5 * c8 * s9 - y5 * s8 * s9; y8 = y5 * c8 - x5 * s8; z8 = x5 * c8 * c9 + y5 * s8 * c9 + z5 * s9; /* Calcul elevation et azimut antenne */ s5 = z8 / r5; c5 = sqrt (1.0 - s5 * s5); e9 = atan (s5 / c5) / P0; /* elevation */ w5 = -atan2 (y_sat, x_sat) / P0; /* longitude projection du satellite */ if (w5 < 0.0) w5 += 360.0; a9 = atan2 (y8, x8) / P0; /* azimut */ if (a9 < 0.0) a9 += 360.0; b5 = z_sat / r8; l5 = b5 / sqrt (1.0 - b5 * b5); l5 = atan (l5) / P0; /* latitude projection du satellite */ } static void resimp_trajec (void) { /* impression des resultats trajecto */ int min, h, m; long dist, alt; double i_part, dp; min = round (modf (jjdeb + pvoie->t_trajec, &i_part) * 1440.0); m = min % 60; h = min / 60; dp = f9 / 1000.0; alt = (long) (r8 - R0 + 0.5); dist = (long) (r5 + 0.5); ligne_sat (h, m, round (a9), round (e9), dp, dist, alt, round (w5), round (l5), m9); } static void calpas (void) { /* en entree : e9 - e8 < 0 * en sortie : pas_var (pas augmente si satellite non visible) */ if ((e9 - e8) < -60.0) pas_var = t9 * 4.0; else if (r_doppler >= 0.) pas_var = t9 * 6.0; else if ((e9 - e8) < -30.0) pas_var = t9 * 2.0; else pas_var = t9; } static void calcul_page_trajec (int entete) { char s[81]; int cpt_lig = 0; int nb_lig = 0; pvoie->lignes = -1; load_param_satel (entete); load_param_station (); precal_trajec (); nb_lig = pvoie->finf.nbl; if (nb_lig > MAXLIGNES) nb_lig = MAXLIGNES; if (entete) nb_lig -= 5; else nb_lig -= 1; if (nb_lig <= 4) nb_lig = 4; /* Boucle de calcul */ do { calc1_trajec (); satpos (); satsta (); sprintf (s, "Traj : %s", strheure (julien_to_pc (jjdeb + pvoie->t_trajec))); aff_chaine (W_DEFL, 69, 3, s); if (e9 >= e8) { /* changement d'orbite ? */ if (k != k_prec) { orbite_sat (jjdeb + pvoie->t_trajec, k); k_prec = k; cpt_lig++; } /* satellite en visibilite */ resimp_trajec (); cpt_lig++; pas_var = t9; } else { /* satellite non visible */ if (t9 < 0.007) calpas (); /* pas de calcul < 10mn */ } pvoie->t_trajec += pas_var; if (trait_time > 15) { outln ("No visibility ...", 17); break; } } while (cpt_lig < nb_lig); aff_chaine (W_DEFL, 69, 3, " "); } static void ligne_sat (int h, int m, int az, int el, double dp, long dist, long alt, int lon, int lat, int ph) { sprintf (varx[0], "%02d", h); sprintf (varx[1], "%02d", m); sprintf (varx[2], "%3d", az); sprintf (varx[3], "%3d", el); sprintf (varx[4], "%4.1f", dp); sprintf (varx[5], "%5ld", dist); sprintf (varx[6], "%5ld", alt); sprintf (varx[7], "%3d", lon); sprintf (varx[8], "%3d", lat); sprintf (varx[9], "%3d", ph); texte (T_TRJ + 8); } static void entete_sat (char *satellite) { if (*(pvoie->finf.qra) == '?') var_cpy (0, qra_locator); else var_cpy (0, pvoie->finf.qra); var_cpy (1, satellite); texte (T_TRJ + 3); texte (T_TRJ + 4); texte (T_TRJ + 5); texte (T_TRJ + 6); } static void orbite_sat (double date_sat, long no) { ptmes->date = julien_to_pc (date_sat); sprintf (varx[0], "%5ld", no); texte (T_TRJ + 7); } void trajecto (void) { char c; int i, jour; FILE *fptr; switch (pvoie->niv3) { case 0: if ((i = selection_sat ()) == -1) break; fptr = ouvre_sat (); pvoie->enrcur = (long) sizeof (satel) * (long) i; fflush (fptr); if ((i < 0) || (pvoie->enrcur >= filelength (fileno (fptr)))) { ferme (fptr, 23); texte (T_ERR + 0); menu_sat (); } else { ferme (fptr, 24); texte (T_TRJ + 9); maj_niv (pvoie->niv1, pvoie->niv2, 2); } break; case 2: if (test_date (indd)) { sscanf (indd, "%d %d %d", &jour, &(pvoie->tdeb.mois), &(pvoie->tdeb.annee)); pvoie->tdeb.jour = (double) jour; if (pvoie->tdeb.annee < 80) pvoie->tdeb.annee += 2000; else if (pvoie->tdeb.annee < 100) pvoie->tdeb.annee += 1900; texte (T_TRJ + 10); maj_niv (pvoie->niv1, pvoie->niv2, 3); } else { texte (T_ERR + 0); texte (T_TRJ + 9); } break; case 3: if (test_heure (indd)) { sscanf (indd, "%d %d", &(pvoie->tdeb.heure), &(pvoie->tdeb.mn)); texte (T_TRJ + 11); /* prog_more(voiecur) ; */ aff_etat ('T'); pvoie->tdeb.sec = 0; if (min_ok (voiecur)) { aff_etat ('E'); send_buf (voiecur); } init_trajec (); calcul_page_trajec (1); texte (T_TRT + 11); maj_niv (pvoie->niv1, pvoie->niv2, 4); } else { texte (T_ERR + 0); texte (T_TRJ + 10); } break; case 4: c = toupper (*indd); if ((c == 'A') || (c == Non)) { incindd (); maj_niv (pvoie->niv1, 0, 0); menu_trajec (); } else { calcul_page_trajec (0); texte (T_TRT + 11); } break; default: fbb_error (ERR_NIVEAU, "COMP-TRAJ", pvoie->niv3); break; } } void menu_trajec (void) { int error = 0; char com[80]; limite_commande (); sup_ln (indd); while (*indd && (!ISGRAPH (*indd))) indd++; strn_cpy (70, com, indd); switch (toupper (*indd)) { case 'T': maj_niv (6, 1, 0); incindd (); trajecto (); break; case 'P': maj_niv (6, 2, 0); incindd (); param_satel (); break; case 'C': maj_niv (6, 3, 0); incindd (); carac_satel (); break; case 'M': if (droits (MODLABEL)) { maj_niv (6, 9, 0); incindd (); modif_satel (); } else { error = 1; } break; case 'B': maj_niv (N_MENU, 0, 0); sortie (); break; case 'F': maj_niv (0, 1, 0); incindd (); choix (); break; case '\0': prompt (pvoie->finf.flags, pvoie->niv1); break; default: if (!defaut ()) error = 1; break; } if (error) { cmd_err (indd); } } static void load_param_satel (int entete) { /* recupere caracteristiques satellite ds fichier * en sortie : i0, o0, e0, w0, a0, n0, q3, k0, f1, v1, * t9, g3, jjref, jjdeb */ satel bufsat; lit_sat (&bufsat); i0 = bufsat.i0; o0 = bufsat.o0; e0 = bufsat.e0; w0 = bufsat.w0; m0 = bufsat.m0; a0 = bufsat.a0; n0 = bufsat.n0; q3 = bufsat.q3; k0 = bufsat.k0; f1 = bufsat.f1; v1 = bufsat.v1; t9 = ((double) bufsat.pas) / 1440.0; if (a0 != 0.0) n0 = sqrt (G0 / (a0 * a0 * a0)); else if (n0 != 0.0) a0 = pow ((G0 / (n0 * n0)), 1. / 3.); /* date references orbitales */ g3 = bufsat.d3; jjref = julien (g3, 0, bufsat.y3, 0, 0, 0); /* date debut de calcul */ jjdeb = julien (pvoie->tdeb.jour, pvoie->tdeb.mois, pvoie->tdeb.annee, pvoie->tdeb.heure, pvoie->tdeb.mn, pvoie->tdeb.sec); if (entete) entete_sat (bufsat.dd); } static void load_param_station (void) { /* en sortie : l9, w9, e8, s9, c9, s8, c8, x9, y9, z9 */ double ll8, r9, l8; /* recuperer QRA locator ds fichier */ /* l9 = 43.657 ; w9 = -1.505 ; */ if (*(pvoie->finf.qra) == '?') lonlat (qra_locator, &w9, &l9); else lonlat (pvoie->finf.qra, &w9, &l9); h9 = 180.0; /* Altitude */ e8 = -5.0; /* Elevation minimale */ /* coord. station ds repere terrestre */ ll8 = l9 * P0; s9 = sin (ll8); c9 = cos (ll8); s8 = sin (-w9 * P0); c8 = cos (w9 * P0); r9 = R0 * (1.0 - F2 + F2 * cos (2.0 * ll8)) + h9 / 1000.0; l8 = atan ((1.0 - F) * (1.0 - F) * s9 / c9); x9 = r9 * cos (l8) * c8; y9 = r9 * cos (l8) * s8; z9 = r9 * sin (l8); } fbb-7.04j/src/trajovl.c0100644000175100017510000002532207726646105013037 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE TRAJECTOGRAPHIE (OVELAY) */ #include static void affiche_param (satel *); static void ecrit_sat (satel *); static void supprime_sat (void); static void vis_param (satel *); /* * CARACTERISTIQUES SATELLITE */ void carac_satel (void) { int i; FILE *fptr; satel bufsat; char satstr[80]; if ((i = selection_sat ()) == -1) return; fptr = ouvre_sat (); pvoie->enrcur = (long) sizeof (bufsat) * (long) i; fflush (fptr); if (pvoie->enrcur < filelength (fileno (fptr))) { fseek (fptr, pvoie->enrcur, 0); fread ((char *) &bufsat, sizeof (bufsat), 1, fptr); sprintf (satstr, "SAT\\%ld.SAT", bufsat.cat); if (!outfichs (d_disque (satstr))) { texte (T_TRJ + 12); } } ferme (fptr, 25); maj_niv (6, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } /* * SAISIE PARAMETRES SATELLITE */ void modif_satel (void) { char c; int i; satel bufsat; FILE *fptr; switch (pvoie->niv3) { case 0: if ((i = selection_sat ()) == -1) break; if (i < 0) { texte (T_ERR + 0); menu_sat (); } else { fptr = ouvre_sat (); pvoie->enrcur = (long) sizeof (bufsat) * (long) i; fflush (fptr); if (pvoie->enrcur < filelength (fileno (fptr))) { fseek (fptr, pvoie->enrcur, 0); fread ((char *) &bufsat, sizeof (bufsat), 1, fptr); vis_param (&bufsat); ptmes->date = bufsat.maj; pvoie->temp1 = 0; texte (T_TRJ + 13); var_cpy (0, bufsat.dd); texte (T_MBL + 30); } else { fflush (fptr); pvoie->enrcur = filelength (fileno (fptr)); pvoie->temp1 = 1; texte (T_QST + 4); } maj_niv (6, 9, 2); ferme (fptr, 25); } break; case 2: c = toupper (*indd); if (pvoie->temp1) { /* Creation */ if (c == Oui) { texte (T_TRJ + 14); maj_niv (6, 9, 3); } else if (c == Non) { maj_niv (6, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else { texte (T_ERR + 0); texte (T_QST + 4); } } else { /* Suppression */ if (c == Non) { texte (T_TRJ + 14); maj_niv (6, 9, 3); } else if (c == Oui) { /* Supprime le record */ supprime_sat (); maj_niv (6, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); } else { texte (T_ERR + 0); texte (T_QST + 1); } } break; case 3: lit_sat (&bufsat); i = 0; bufsat.maj = time (NULL); if (ISPRINT (*indd)) { while (ISGRAPH (*indd)) bufsat.dd[i++] = toupper (*indd++); bufsat.dd[i] = '\0'; } ecrit_sat (&bufsat); texte (T_TRJ + 15); maj_niv (6, 9, 4); break; case 4: lit_sat (&bufsat); if (ISGRAPH (*indd)) bufsat.k0 = atol (indd); ecrit_sat (&bufsat); texte (T_TRJ + 16); maj_niv (6, 9, 5); break; case 5: lit_sat (&bufsat); if (ISGRAPH (*indd)) bufsat.y3 = atoi (indd); ecrit_sat (&bufsat); texte (T_TRJ + 17); maj_niv (6, 9, 6); break; case 6: lit_sat (&bufsat); if (ISGRAPH (*indd)) bufsat.d3 = atof (indd); ecrit_sat (&bufsat); texte (T_TRJ + 18); maj_niv (6, 9, 7); break; case 7: lit_sat (&bufsat); if (ISGRAPH (*indd)) bufsat.m0 = atof (indd); ecrit_sat (&bufsat); texte (T_TRJ + 19); maj_niv (6, 9, 8); break; case 8: lit_sat (&bufsat); if (ISGRAPH (*indd)) bufsat.w0 = atof (indd); ecrit_sat (&bufsat); texte (T_TRJ + 20); maj_niv (6, 9, 9); break; case 9: lit_sat (&bufsat); if (ISGRAPH (*indd)) bufsat.o0 = atof (indd); ecrit_sat (&bufsat); texte (T_TRJ + 21); maj_niv (6, 9, 10); break; case 10: lit_sat (&bufsat); if (ISGRAPH (*indd)) bufsat.i0 = atof (indd); ecrit_sat (&bufsat); texte (T_TRJ + 22); maj_niv (6, 9, 11); break; case 11: lit_sat (&bufsat); if (ISGRAPH (*indd)) bufsat.e0 = atof (indd); ecrit_sat (&bufsat); texte (T_TRJ + 23); maj_niv (6, 9, 12); break; case 12: lit_sat (&bufsat); if (ISGRAPH (*indd)) { bufsat.n0 = atof (indd); bufsat.a0 = 0.0; } ecrit_sat (&bufsat); texte (T_TRJ + 24); maj_niv (6, 9, 13); break; case 13: lit_sat (&bufsat); if (ISGRAPH (*indd)) bufsat.q3 = atof (indd); ecrit_sat (&bufsat); texte (T_TRJ + 25); maj_niv (6, 9, 14); break; case 14: lit_sat (&bufsat); if (ISGRAPH (*indd)) bufsat.pas = atoi (indd); ecrit_sat (&bufsat); texte (T_TRJ + 26); maj_niv (6, 9, 15); break; case 15: lit_sat (&bufsat); if (ISGRAPH (*indd)) { bufsat.f1 = atof (indd); bufsat.v1 = 0.0; } ecrit_sat (&bufsat); texte (T_QST + 2); maj_niv (6, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); break; default: fbb_error (ERR_NIVEAU, "MODIF-SAT", pvoie->niv3); break; } } static void supprime_sat (void) { FILE *fptr; FILE *tptr; satel bufsat; char temp[128]; long pos = 0L; if ((tptr = fopen (temp_name (voiecur, temp), "wb")) == NULL) return; if ((fptr = fopen (d_disque ("SAT\\SATEL.DAT"), "rb")) != NULL) { while (fread ((char *) &bufsat, sizeof (satel), 1, fptr)) { if (pos != pvoie->enrcur) fwrite ((char *) &bufsat, sizeof (satel), 1, tptr); pos += (long) sizeof (satel); } ferme (fptr, 27); } ferme (tptr, 28); rename_temp (voiecur, d_disque ("SAT\\SATEL.DAT")); /* Le fichier est mis en place */ } static void ecrit_sat (satel * bufsat) { FILE *fptr; fptr = ouvre_sat (); fseek (fptr, pvoie->enrcur, 0); fwrite ((char *) bufsat, sizeof (*bufsat), 1, fptr); ferme (fptr, 27); } void param_satel (void) { int i; satel bufsat; FILE *fptr; switch (pvoie->niv3) { case 0: if ((i = selection_sat ()) == -1) break; else { fptr = ouvre_sat (); pvoie->enrcur = (long) sizeof (bufsat) * (long) i; fflush (fptr); if ((i < 0) || (pvoie->enrcur >= filelength (fileno (fptr)))) { ferme (fptr, 28); texte (T_ERR + 0); menu_sat (); } else { fseek (fptr, pvoie->enrcur, 0); fread ((char *) &bufsat, sizeof (bufsat), 1, fptr); ferme (fptr, 29); if (*(bufsat.dd)) { affiche_param (&bufsat); retour_menu (N_TRAJ); } else { texte (T_ERR + 3); menu_sat (); } } } break; default: fbb_error (ERR_NIVEAU, "PARAM-SAT", pvoie->niv3); break; } } static void affiche_param (satel * bufsat) { lit_sat (bufsat); vis_param (bufsat); } static void vis_param (satel * bufsat) { var_cpy (0, bufsat->dd); sprintf (varx[1], "%ld", bufsat->cat); texte (T_TRJ + 27); sprintf (varx[0], "%5ld", bufsat->k0); texte (T_TRJ + 28); sprintf (varx[0], "%5d", bufsat->y3); texte (T_TRJ + 29); sprintf (varx[0], "%14.8f", bufsat->d3); texte (T_TRJ + 30); sprintf (varx[0], "%14.8f", bufsat->m0); texte (T_TRJ + 31); sprintf (varx[0], "%14.8f", bufsat->w0); texte (T_TRJ + 32); sprintf (varx[0], "%14.8f", bufsat->o0); texte (T_TRJ + 33); sprintf (varx[0], "%14.8f", bufsat->i0); texte (T_TRJ + 34); sprintf (varx[0], "%14.8f", bufsat->e0); texte (T_TRJ + 35); sprintf (varx[0], "%14.8f", bufsat->n0); texte (T_TRJ + 36); sprintf (varx[0], "%14.8f", bufsat->q3); texte (T_TRJ + 37); sprintf (varx[0], "%5d", bufsat->pas); texte (T_TRJ + 38); } void lit_sat (satel * bufsat) { FILE *fptr; fptr = ouvre_sat (); fseek (fptr, pvoie->enrcur, 0); fread ((char *) bufsat, sizeof (*bufsat), 1, fptr); ferme (fptr, 26); } int test_date (char *ptr) { char *sptr = ptr; int j, m, a; struct tm *sdate; long temps = time (NULL); sdate = gmtime (&temps); if (!ISGRAPH (*ptr)) { sprintf (ptr, "%02d/%02d/%02d", sdate->tm_mday, sdate->tm_mon + 1, sdate->tm_year % 100); outln (ptr, strlen (ptr)); } if (!isdigit (*ptr)) return (FALSE); while (isdigit (*ptr)) ++ptr; if ((!*ptr) || (isalnum (*ptr))) return (FALSE); *ptr++ = ' '; if (!isdigit (*ptr)) return (FALSE); while (isdigit (*ptr)) ++ptr; if ((!*ptr) || (isalnum (*ptr))) return (FALSE); *ptr++ = ' '; if (!isdigit (*ptr)) return (FALSE); while (isdigit (*ptr)) ++ptr; if (!ISGRAPH (*ptr)) { sscanf (sptr, "%d %d %d", &j, &m, &a); if ((j < 1) || (j > 31)) return (FALSE); if ((m < 1) || (m > 12)) return (FALSE); if ((a > 99) && (a < 1980 || a > 2030)) return (FALSE); return (TRUE); } return (FALSE); } int test_heure (char *ptr) { char *sptr = ptr; int h, m; struct tm *sdate; long temps = time (NULL); sdate = gmtime (&temps); if (!ISGRAPH (*ptr)) { sprintf (ptr, "%02d:%02d", sdate->tm_hour, sdate->tm_min); outln (ptr, strlen (ptr)); } if (!isdigit (*ptr)) return (FALSE); while (isdigit (*ptr)) ++ptr; if ((!*ptr) || (isalnum (*ptr))) return (FALSE); *ptr++ = ' '; if (!isdigit (*ptr)) return (FALSE); while (isdigit (*ptr)) ++ptr; if (!ISGRAPH (*ptr)) { sscanf (sptr, "%d %d", &h, &m); if ((h < 0) || (h > 23)) return (FALSE); if ((m < 0) || (m > 59)) return (FALSE); return (TRUE); } return (FALSE); } void menu_sat (void) { int i = 0; satel bufsat; FILE *fptr; cr (); fptr = ouvre_sat (); while (fread ((char *) &bufsat, sizeof (bufsat), 1, fptr)) { sprintf (varx[0], "%3d", i++); sprintf (varx[1], "%-17s", bufsat.dd); texte (T_TRJ + 39); if ((i % 3) == 0) cr_cond (); } ferme (fptr, 30); if (i % 3) cr_cond (); texte (T_TRJ + 40); texte (T_QST + 5); } int selection_sat (void) { int i; switch (toupper (*indd)) { case '\0': texte (T_QST + 5); return (-1); case 'L': case 'W': menu_sat (); return (-1); case 'F': maj_niv (pvoie->niv1, 0, 0); prompt (pvoie->finf.flags, pvoie->niv1); return (-1); default: if (isdigit (*indd)) { i = atoi (indd); return (i); } texte (T_ERR + 0); texte (T_QST + 5); return (-1); } } void trajec (void) { switch (pvoie->niv2) { case 0: menu_trajec (); break; case 1: trajecto (); break; case 2: param_satel (); break; case 3: carac_satel (); break; case 9: modif_satel (); break; default: fbb_error (ERR_NIVEAU, "TRAJEC", pvoie->niv2); break; } } fbb-7.04j/src/variable.c0100644000175100017510000002707507726646105013152 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * VARIABLE.C * */ #include static char locbuf[600]; char *strdate (long temps) { static char cdate[19]; char jour[4]; struct tm *sdate; df ("strdate", 2); sdate = localtime (&temps); if (vlang == -1) *jour = '\0'; else { strncpy (jour, (langue[vlang]->plang[JOUR - 1]) + (sdate->tm_wday * 3), 3); jour[3] = '\0'; } sprintf (cdate, "%s %02d/%02d/%02d %02d:%02d", jour, sdate->tm_mday, sdate->tm_mon + 1, sdate->tm_year % 100, sdate->tm_hour, sdate->tm_min); ff (); return (cdate); } char *strdt (long temps) { struct tm *sdate; static char cdate[15]; df ("strdt", 2); sdate = localtime (&temps); sprintf (cdate, "%02d/%02d/%02d %02d:%02d", sdate->tm_mday, sdate->tm_mon + 1, sdate->tm_year % 100, sdate->tm_hour, sdate->tm_min); ff (); return (cdate); } static char *date_heure_fbb (long temps) { struct tm *sdate; static char cdate[15]; df ("data_heure_fbb", 2); sdate = localtime (&temps); sprintf (cdate, "%02d%02d/%02d%02d", sdate->tm_mon + 1, sdate->tm_mday, sdate->tm_hour, sdate->tm_min); ff (); return (cdate); } char *date_mbl (long temps) { struct tm *sdate; static char cdate[7]; df ("data_mbl", 2); sdate = localtime (&temps); sprintf (cdate, "%02d%02d%02d", sdate->tm_year % 100, sdate->tm_mon + 1, sdate->tm_mday); ff (); return (cdate); } char *heure_mbl (long temps) { struct tm *sdate; static char cdate[5]; df ("heure_mbl", 2); sdate = localtime (&temps); sprintf (cdate, "%02d%02d", sdate->tm_hour, sdate->tm_min); ff (); return (cdate); } static char *date_mbl_new (long temps) { char mois[4]; struct tm *sdate; static char cdate[7]; df ("date_mbl_new", 2); sdate = localtime (&temps); if (vlang == -1) *mois = '\0'; else { strncpy (mois, (langue[vlang]->plang[MOIS - 1]) + (sdate->tm_mon * 3), 3); mois[3] = '\0'; } sprintf (cdate, "%02d-%s", sdate->tm_mday, mois); ff (); return (cdate); } static char *annee_mbl (long temps) { struct tm *sdate; static char cdate[7]; df ("annee_mbl", 2); sdate = localtime (&temps); sprintf (cdate, "%02d", sdate->tm_year % 100); ff (); return (cdate); } char *datheure_mbl (long temps) { static char cdate[13]; df ("datheure_mbl", 2); sprintf (cdate, "%s %s", date_mbl_new (temps), strheure (temps)); ff (); return (cdate); } char *strheure (long temps) { struct tm *sdate; static char cdate[6]; df ("str_heure", 2); sdate = localtime (&temps); sprintf (cdate, "%02d:%02d", sdate->tm_hour, sdate->tm_min); ff (); return (cdate); } int jour (long temps) { struct tm *sdate; df ("jour", 2); sdate = localtime (&temps); ff (); return (sdate->tm_wday); } int nojour (long temps) { struct tm *sdate; df ("nojour", 2); sdate = localtime (&temps); ff (); return (sdate->tm_mday); } int heure (long temps) { struct tm *sdate; df ("heure", 2); sdate = localtime (&temps); ff (); return (sdate->tm_hour); } int gmt_heure (long temps) { struct tm *sdate; df ("heure", 2); sdate = gmtime (&temps); ff (); return (sdate->tm_hour); } int minute (long temps) { struct tm *sdate; df ("minute", 2); sdate = localtime (&temps); ff (); return (sdate->tm_min); } static int check_fwd (char *bbs, int *nbbul, int *nbpriv, int *nbkilo) { char maxfwd[NBBBS + 1]; char typfwd[NBBBS + 1]; char typdat[NBBBS + 1]; atfwd *mess; int nobbs; static unsigned task_ident = 0xffff; static atfwd smess; *nbbul = *nbpriv = *nbkilo = 0; nobbs = n_bbs (bbs); if (nobbs == 0) return (FALSE); if (task_ident != tid) { task_ident = tid; fwd_value (maxfwd, typfwd, typdat); if ((mess = attend_fwd (nobbs, maxfwd[nobbs], 0, typfwd[nobbs], typdat[nobbs])) != NULL) { smess = *mess; } else { memset (&smess, 0, sizeof (atfwd)); } } *nbpriv = smess.nbpriv; *nbbul = smess.nbbul; *nbkilo = smess.nbkb; return (TRUE); } char *variable (char var) { int nb; long t_cnx; char *ptr = locbuf; df ("variable", 1); *ptr = '\0'; switch (var) { case '$': *ptr++ = '$'; *ptr = '\0'; break; /* Variables redfinies */ case '0': n_cpy (80, ptr, varx[0]); break; case '1': n_cpy (80, ptr, varx[1]); break; case '2': n_cpy (80, ptr, varx[2]); break; case '3': n_cpy (80, ptr, varx[3]); break; case '4': n_cpy (80, ptr, varx[4]); break; case '5': n_cpy (80, ptr, varx[5]); break; case '6': n_cpy (80, ptr, varx[6]); break; case '7': n_cpy (80, ptr, varx[7]); break; case '8': n_cpy (80, ptr, varx[8]); break; case '9': n_cpy (80, ptr, varx[9]); break; /* Variable prdfinies */ case 'A': sprintf (ptr, "%-6s", bbs_via (ptmes->bbsv)); break; case 'a': strcpy (ptr, annee_mbl (time (NULL))); break; case 'B': *ptr++ = '\a'; *ptr = '\0'; break; case 'b': strcpy (ptr, pvoie->finf.zip); break; case 'C': ltoa (nomess + 1, ptr, 10); break; case 'c': strcpy (ptr, my_city); break; case 'D': strcpy (ptr, date_mbl (time (NULL))); break; case 'd': strcpy (ptr, date_mbl_new (time (NULL))); break; case 'E': strcpy (ptr, version ()); break; case 'e': strcpy (ptr, pvoie->finf.ville); break; case 'F': itoa (p_port[no_port (voiecur)].min_fwd, ptr, 10); break; case 'f': strcpy (ptr, pvoie->appendf); break; case 'G': sprintf (ptr, "%-6s", ptmes->desti); break; case 'g': itoa (nbgate (), ptr, 10); break; case 'H': strcpy (ptr, strheure (time (NULL))); break; case 'h': strcpy (ptr, pvoie->finf.home); break; case 'I': if (*(pvoie->finf.prenom)) strcpy (ptr, pvoie->finf.prenom); else strcpy (ptr, "???"); break; case 'i': strcpy (ptr, date_heure_fbb (ptmes->date)); break; case 'J': strcpy (ptr, date_mbl (ptmes->date)); break; case 'j': strcpy (ptr, date_mbl_new (ptmes->date)); break; case 'K': strcpy (ptr, strheure (ptmes->date)); break; case 'k': strcpy (ptr, k_var ()); break; case 'L': ltoa (nomess, ptr, 10); break; case 'l': if (*pvoie->finf.filtre) strcpy (ptr, pvoie->finf.filtre); else { *ptr++ = '*'; *ptr = '\0'; } break; case 'M': sprintf (ptr, "%-6ld", ptmes->numero); break; case 'm': strcpy (ptr, p_port[no_port (voiecur)].freq); break; case 'N': ltoa (nbmess, ptr, 10); break; case 'n': sprintf (ptr, "%5ld", ptmes->taille); break; case 'O': strcpy (ptr, mycall); break; case 'o': itoa (myssid, ptr, 10); break; case 'P': sprintf (ptr, "%-6s", ptmes->exped); break; case 'p': if (PAG (pvoie->finf.flags)) ltoa (pvoie->finf.nbl, ptr, 10); else { ptr[0] = ptr[1] = '-'; ptr[2] = '\0'; } break; case 'Q': list_new (ptr); break; case 'q': ltoa (1000L * (long) pvoie->finf.on_base, ptr, 10); break; case 'R': strcpy (ptr, ptmes->bid); break; case 'r': *ptr++ = (*ptmes->bbsf) ? ' ' : 'L'; *ptr = '\0'; break; case 'S': strcpy (ptr, ptmes->titre); break; case 's': *ptr++ = ptmes->status; *ptr = '\0'; break; case 'T': strcpy (ptr, strheure (time (NULL))); break; case 't': *ptr++ = ptmes->type; *ptr = '\0'; break; case 'U': strcpy (ptr, pvoie->sta.indicatif.call); break; case 'u': *ptr++ = (pvoie->vdisk == 8) ? 'P' : pvoie->vdisk + 'A'; *ptr = '\0'; break; case 'V': strcpy (ptr, my_name); break; case 'v': strcpy (ptr, ptmes->bbsv); break; case 'W': *ptr++ = '\r'; *ptr = '\0'; break; case 'w': *ptr++ = '\033'; *ptr = '\0'; break; case 'X': strcpy (ptr, date_mbl (pvoie->finf.hcon)); break; case 'x': strcpy (ptr, date_mbl_new (pvoie->finf.hcon)); break; case 'Y': strcpy (ptr, strheure (pvoie->finf.hcon)); break; case 'y': strcpy (ptr, annee_mbl (ptmes->date)); break; case 'Z': ltoa (pvoie->finf.lastmes, ptr, 10); break; case 'z': strcpy (ptr, my_zip); break; case '*': nb = actif (1); itoa (nb, ptr, 10); break; case '=': itoa (virt_canal (voiecur), ptr, 10); break; case '!': itoa (no_port (voiecur), ptr, 10); break; case '^': itoa (nbport (), ptr, 10); break; case '?': strcpy (ptr, qra_locator); break; case '%': who (ptr); break; case ':': t_cnx = time (NULL) - pvoie->debut; if (t_cnx < 60) sprintf (ptr, "%2lds", t_cnx); else sprintf (ptr, "%ldmn %02lds", t_cnx / 60, t_cnx % 60); break; case '.': if (pvoie->tmach < 60) sprintf (ptr, "%2lds", pvoie->tmach); else sprintf (ptr, "%ldmn %02lds", pvoie->tmach / 60, pvoie->tmach % 60); break; default: sprintf (ptr, "$%c", var); break; } ff (); return (locbuf); } char *alt_variable (char var) { int nbbul, nbpriv, nbkilo; char *ptr = locbuf; Wps *wps; df ("alt_variable", 1); *ptr = '\0'; switch (var) { case '%': *ptr++ = '%'; *ptr = '\0'; break; /* Variable prdfinies */ case 'A': sprintf (ptr, "%s", bbs_via (ptmes->bbsv)); break; case 'C': sprintf (ptr, "%-3u", ptmes->nblu); break; case 'd': itoa (pvoie->finf.download, ptr, 10); break; case 'E': strcpy (ptr, os ()); break; case 'e': strcpy (ptr, date ()); break; case 'G': sprintf (ptr, "%s", ptmes->desti); break; case 'I': /* Get the name from WP */ wps = wp_find(ptmes->exped, 0); if ((wps) && (*wps->name) && (*wps->name != '?')) strcpy (ptr, wps->name); else strcpy (ptr, "???"); break; case 'i': strcpy (ptr, date_heure_fbb (ptmes->datesd)); break; case 'J': strcpy (ptr, date_mbl (ptmes->datesd)); break; case 'j': strcpy (ptr, date_mbl_new (ptmes->datesd)); break; case 'K': strcpy (ptr, strheure (ptmes->datesd)); break; case 'k': check_fwd (pvoie->sta.indicatif.call, &nbbul, &nbpriv, &nbkilo); itoa (nbkilo, ptr, 10); break; case 'l': check_fwd (pvoie->sta.indicatif.call, &nbbul, &nbpriv, &nbkilo); itoa (nbpriv + nbbul, ptr, 10); break; case 'M': sprintf (ptr, "%ld", ptmes->numero); break; case 'm': itoa (P_MODM (voiecur) ? max_mod : max_yapp, ptr, 10); break; case 'N': sprintf (ptr, "%ld", ptmes->numero % 0x10000L); break; case 'n': sprintf (ptr, "%ld", ptmes->taille); break; case 'O': strcpy (ptr, admin); break; case 'P': sprintf (ptr, "%s", ptmes->exped); break; case 'R': strcpy (ptr, mypath); break; case 'r': *ptr++ = (ptmes->bin) ? 'D' : ' '; *ptr = '\0'; break; case 'T': strcpy (ptr, cur_theme (voiecur)); break; case 't': itoa (nbull_theme (voiecur), ptr, 10); break; case 'X': itoa (pvoie->ncur->nbmess, ptr, 10); break; case 'x': itoa (pvoie->ncur->nbnew, ptr, 10); break; case 'y': strcpy (ptr, annee_mbl (ptmes->datesd)); break; default: sprintf (ptr, "%%%c", var); break; } ff (); return (locbuf); } fbb-7.04j/src/warning.c0100644000175100017510000001126207726646105013021 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* Module gerant les messages "warning" */ /* * Demande de message warning : * * 1 - PingPong * 2 - Route inconnue * 3 - NTS inconnu * */ void dde_warning (int type) { pvoie->warning |= type; } void tst_warning (bullist * ptmes) { char wtexte[256]; char nom[128]; unsigned warning = pvoie->warning; while (warning) { if (warning & W_PPG) { #ifdef ENGLISH sprintf (wtexte, "Duplicate reverse forward of # %ld to %s, route to %s", ptmes->numero, ptmes->desti, ptmes->bbsv ); if (w_mask & W_PINGPONG) mess_warning (admin, "*** PING-PONG ***", wtexte); #else sprintf (wtexte, "Presentation en retour du # %ld a %s, routage vers %s", ptmes->numero, ptmes->desti, ptmes->bbsv ); if (w_mask & W_PINGPONG) mess_warning (admin, "*** PING-PONG ***", wtexte); #endif warning &= ~(W_PPG); } else if (warning & W_ROU) { #ifdef ENGLISH sprintf (wtexte, "Unknown route to %s. \rMessage #%ld written by %s received %s \r", ptmes->bbsv, ptmes->numero, ptmes->exped, strdate (time (NULL)) ); if (w_mask & W_NO_ROUTE) mess_warning (admin, "*** UNKNOWN ROUTE *** ", wtexte); #else sprintf (wtexte, "Acheminement vers %s inconnu.\rMessage %ld demande par %s recu le %s\r", ptmes->bbsv, ptmes->numero, ptmes->exped, strdate (time (NULL)) ); if (w_mask & W_NO_ROUTE) mess_warning (admin, "*** ACHEMINEMENT INCONNU ***", wtexte); #endif warning &= ~(W_ROU); } else if (warning & W_NTS) { #ifdef ENGLISH sprintf (wtexte, "Unknown NTS %s. \rMessage #%ld written by %s received %s\r", ptmes->desti, ptmes->numero, ptmes->exped, strdate (time (NULL)) ); if (w_mask & W_NO_NTS) mess_warning (admin, "*** UNKNOWN NTS ***", wtexte); #else sprintf (wtexte, "NTS %s inconnu.\rMessage %ld demande par %s recu le %s \r", ptmes->desti, ptmes->numero, ptmes->exped, strdate (time (NULL)) ); if (w_mask & W_NO_NTS) mess_warning (admin, "*** NTS INCONNU ***", wtexte); #endif warning &= ~(W_NTS); } else if (warning & W_ASC) { mess_name (MESSDIR, ptmes->numero, nom); #ifdef ENGLISH sprintf (wtexte, "Ascii file %s not found \r", nom ); if (w_mask & W_MESSAGE) mess_warning (admin, "*** ASCII FILE NOT FOUND ***", wtexte); #else sprintf (wtexte, "Fichier ascii %s pas trouve\r", nom ); if (w_mask & W_MESSAGE) mess_warning (admin, "*** ERREUR FICHIER ASCII ***", wtexte); #endif warning &= ~(W_ASC); } else if (warning & W_BIN) { mess_name (MBINDIR, ptmes->numero, nom); #ifdef ENGLISH sprintf (wtexte, "Binary file %s not found \r", nom ); if (w_mask & W_MESSAGE) mess_warning (admin, "*** BIN FILE NOT FOUND ***", wtexte); #else sprintf (wtexte, "Fichier binaire %s pas trouve\r", nom ); if (w_mask & W_MESSAGE) mess_warning (admin, "*** ERREUR FICHIER BIN ***", wtexte); #endif warning &= ~(W_BIN); } } pvoie->warning = 0; } void mess_warning (char *w_desti, char *w_titre, char *w_texte) { int nb, sav_voie = voiecur, sav_lang = vlang; if (voiecur == MWARNING) return; /* Deja en warning */ deb_io (); selvoie (MWARNING); if (FOR (svoie[sav_voie]->mode)) pvoie->mode |= F_FOR; entete_saisie (); ini_champs (voiecur); strn_cpy (6, ptmes->desti, w_desti); strcpy (ptmes->exped, mycall); ptmes->type = 'P'; swapp_bbs (ptmes); reacheminement (); strn_cpy (60, ptmes->titre, w_titre); pvoie->mode = F_FOR; nb = strlen (w_texte); w_texte[nb] = '\032'; get_mess_fwd ('\0', w_texte, nb + 1, 2); selvoie (sav_voie); vlang = sav_lang; fin_io (); } fbb-7.04j/src/watchdog.c0100644000175100017510000001021407726646105013150 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * WATCHDOG.C * */ #include static int watch_option = 0; #ifdef __WINDOWS__ #ifdef __WIN32__ static HANDLE watchfd; #else static int watchfd; #endif #endif /* WINDOWS */ /*************************************** * Specifie un port pour le watchdog : * 0 = rien * 1 = lpt1 * 2 = lpt2 * etc... * 81 = com1 * 82 = coim2 * etc... ****************************************/ void init_watchdog (int val) { #ifdef __WINDOWS__ char str[80]; DCB dcb; int error; if (val == 0) return; if (val > 80) wsprintf (str, "LPT%d", val - 80); else wsprintf (str, "COM%d", val); #ifdef __WIN32__ watchfd = CreateFile (str, GENERIC_READ | GENERIC_WRITE, 0, // exclusive access NULL, // no security attrs OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL); if (watchfd == INVALID_HANDLE_VALUE) return; #else watchfd = OpenComm (str, 64, 64); if (watchfd < 0) { /* Erreur ouverture COM */ char title[80]; wsprintf (title, "Error Watchdog %d", val); ShowError (title, "OpenComm :", 0); return; } #endif if (val < 80) { memset ((char *) &dcb, '\0', sizeof (DCB)); wsprintf (str, "COM%d:9600,n,8,1", val); error = BuildCommDCB (str, &dcb); #ifdef __WIN32__ error = SetCommState (watchfd, &dcb); #else error = SetCommState (&dcb); #endif } watch_option = val; #endif } void end_watchdog (void) { #ifdef __WINDOWS__ int ret; if (!watch_option) { return; } #ifdef __WIN32__ if (watchfd != INVALID_HANDLE_VALUE) { // EscapeCommFunction (ptrcom->comfd, SETXON); if (!CloseHandle (watchfd)) { char title[80]; wsprintf (title, "Error watchdog %d", watch_option); ShowError (title, "CloseComm :", ret); } watchfd = INVALID_HANDLE_VALUE; } #else if (watchfd != -1) { if ((ret = CloseComm (watchfd)) < 0) { char title[80]; wsprintf (title, "Error watchdog %d", watch_option); ShowError (title, "CloseComm :", ret); } watchfd = -1; } #endif #endif watch_option = 0; } void watchdog (void) { #ifdef __WINDOWS__ time_t temps; static int car = 0; static time_t prev = 0; int nb; int err; if (!watch_option) { return; } temps = time (NULL); if (temps == prev) return; prev = temps; car = !car; #ifdef __WIN32__ { DWORD lpErrors = 0L; char title[80]; /* Get the first spurious error */ ClearCommError (watchfd, &lpErrors, NULL); ClearCommError (watchfd, &lpErrors, NULL); if (lpErrors & (CE_PTO | CE_IOE | CE_DNS)) { wsprintf (title, "Error watchdog %d", watch_option); ShowError (title, "Device not ready, watchdog disabled :", lpErrors); end_watchdog (); return; } } if (!WriteFile (watchfd, &car, 1, &nb, NULL)) { char title[80]; wsprintf (title, "Error watchdog %d", watch_option); ShowError (title, "WriteComm :", nb); return; } #else nb = WriteComm (watchfd, &car, 1); if (nb < 0) { char title[80]; while (err = GetCommError (watchfd, NULL)) { fbb_warning (9, "Send error : ", err); } wsprintf (title, "Error watchdog %d", watch_option); ShowError (title, "WriteComm :", nb); return; } #endif #endif } fbb-7.04j/src/wp_mess.c0100644000175100017510000001035407726646105013032 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Generation des messages WP vers le reseau. * * Les routes a generer sont definies dans INIT.SRV * */ #include static int copy_lines (int fd_orig, int fd_dest) { #define TAIBUF 5000 int nb_lus; char c; char *buffer; buffer = m_alloue (TAIBUF); nb_lus = read (fd_orig, buffer, TAIBUF); if (nb_lus > 0) write (fd_dest, buffer, nb_lus); if (nb_lus == TAIBUF) { /* Termine la ligne en cours */ do { if (read (fd_orig, &c, 1) > 0) { write (fd_dest, &c, 1); ++nb_lus; } else break; } while (c != '\n'); } m_libere (buffer, TAIBUF); return (nb_lus); } void send_wp_mess (void) { int fd_orig; int fd_dest; int sav_voie = voiecur; int sav_lang = vlang; int mess; char route[80]; char *ptr; char *scan; FILE *fptr; #ifndef R_OK #define R_OK 004 #define W_OK 002 #endif if (access (d_disque ("WP\\MESS.WP"), R_OK | W_OK) == -1) return; if (voiecur == MWARNING) return; /* Deja en warning */ if (*wp_line == '\0') { unlink (d_disque ("WP\\MESS.WP")); return; } if ((fd_orig = open (d_disque ("WP\\MESS.WP"), O_RDONLY | O_BINARY)) == EOF) { return; } /* On ouvre le fichier MAIL.IN */ fptr = fappend (MAILIN, "b"); if (fptr == NULL) return; selvoie (MWARNING); if (FOR (svoie[sav_voie]->mode)) pvoie->mode |= F_FOR; status (voiecur); mess = 0; for (;;) { #if defined(__WINDOWS__) || defined(__LINUX__) char txt[80]; #endif int nb; int fd; /* Boucle sur des messages de 5K Max */ if ((fd_dest = open ("TEMP.WP", O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IREAD | S_IWRITE)) == EOF) { close (fd_orig); break; } nb = copy_lines (fd_orig, fd_dest); close (fd_dest); #if defined(__WINDOWS__) || defined(__LINUX__) wsprintf (txt, "Preparing Message #%d", ++mess); InfoMessage (-1, txt, "WP-Messages"); #endif if (nb <= 0) { close (fd_orig); break; } scan = wp_line; while ((*scan) && !(ISGRAPH (*scan))) ++scan; ptr = route; while ((*scan) && (ISGRAPH (*scan))) *ptr++ = *scan++; *ptr++ = '\0'; /* On ouvre le fichier tout neuf pour le copier ... */ fd = open ("TEMP.WP", O_RDONLY | O_BINARY); while ((fd != -1) && (*route)) { #if defined(__WINDOWS__) || defined(__LINUX__) wsprintf (txt, "Creating Message #%d (%s)", mess, route); InfoMessage (-1, txt, NULL); #endif /* Genere le message via route ... */ fprintf (fptr, "#\r\nS%c WP @ %s < %s\r\nWP Update\r\n", find (bbs_via (route)) ? 'P' : 'B', route, mycall); fflush (fptr); /* On remet a zero pour la nouvelle copie ... */ lseek (fd, 0L, SEEK_SET); fflush (fptr); copy_fic (fd, fileno (fptr), NULL); fflush (fptr); fprintf (fptr, "\r\n/EX\r\n"); fflush (fptr); while ((*scan) && !(ISGRAPH (*scan))) ++scan; ptr = route; while ((*scan) && (ISGRAPH (*scan))) *ptr++ = *scan++; *ptr++ = '\0'; } close (fd); } /* On ferme le MAIL.IN */ fclose (fptr); #if defined(__WINDOWS__) || defined(__LINUX__) InfoMessage (-1, "Delete MESS.WP file", NULL); #endif unlink (d_disque ("WP\\MESS.WP")); unlink ("TEMP.WP"); selvoie (sav_voie); vlang = sav_lang; #if defined(__WINDOWS__) || defined(__LINUX__) InfoMessage (-1, NULL, NULL); #endif } fbb-7.04j/src/wpserv.c0100644000175100017510000003205107726646105012701 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * Serveur White Pages * * Do not overlay ! * */ #include #define LG_CACHE 20 #define MAX_UPD 10 static Wpr *wp_cache = NULL; static int pos_cache = 0; #define WP_TRACE #ifdef WP_TRACE static int deb_wp = 0; #endif void add_wp_trace (int val) { deb_wp = val; } int is_wpupdate (char *titre) { char str[10]; strn_cpy (9, str, titre); return (strcmp ("WP UPDATE", str) == 0); } void debug_wp (char *deb) { FILE *wp_fptr; if (!deb_wp) return; wp_fptr = fopen (d_disque ("WP\\WP.DBG"), "at"); if (!wp_fptr) return; fputs (deb, wp_fptr); fclose (wp_fptr); } static int wp_read (Wpr * rec) { static long wp_record = 0L; int retour; FILE *fptr; deb_io (); fptr = fopen (d_disque ("WP\\FBB.WP"), "rb"); if (fptr == NULL) { fin_io (); wp_record = 0L; return (0); } fseek (fptr, wp_record * sizeof (Wpr), SEEK_SET); retour = fread (rec, sizeof (Wpr), MAX_UPD, fptr); fclose (fptr); if (retour == MAX_UPD) { wp_record += (long) retour; } else { unlink (d_disque ("WP\\FBB.WP")); wp_record = 0L; } fin_io (); return (retour); } #ifdef WP_TRACE static void debug_wp_user (char *type, FILE * fptr, long record, Wps * rec, Wpr * ask) { char modif[80]; char seen[80]; if (!deb_wp) return; strcpy (modif, date_mbl (rec->last_modif)); strcpy (seen, date_mbl (rec->last_seen)); fprintf (fptr, "[%s] %-4ld: %s %s %-6s (%u) %s (source %c)\n", type, record, modif, seen, rec->callsign, rec->seen, (*rec->name) ? rec->name : "?", rec->changed ); fprintf (fptr, " [1] @%s Zip:%s Qth:%s\n", rec->first_homebbs, (*rec->first_zip) ? rec->first_zip : "?", (*rec->first_qth) ? rec->first_qth : "?" ); fprintf (fptr, " [2] @%s Zip:%s Qth:%s\n", rec->secnd_homebbs, (*rec->secnd_zip) ? rec->secnd_zip : "?", (*rec->secnd_qth) ? rec->secnd_qth : "?" ); fprintf (fptr, "Ask on %s source=%c local=%d :\n %s@%s Name:%s Zip:%s Qth:%s\n", date_mbl (ask->last), ask->source, ask->local, ask->callsign, ask->homebbs, ask->name, ask->zip, ask->qth ); } #endif static void wp_update (Wpr * rec) { Wps up_rec; char *ptr; FILE *fptr; int ok = 0; Wp wp; /* int cur_page; */ int maj; int upd; unsigned record; #ifdef WP_TRACE FILE *wp_fptr = NULL; Wps old_rec; #endif deb_io (); upd = maj = 0; fptr = fopen (d_disque ("WP\\WP.SYS"), "r+b"); if (fptr == NULL) { fptr = fopen (d_disque ("WP\\WP.SYS"), "w+b"); if (fptr == NULL) { /* remet_bloc(cur_page); */ fin_io (); return; } } record = search_wp_record (call2l (rec->callsign), USR_CALL, 0); if (record < 0xffff) ok = 1; if (ok) { #ifdef WP_TRACE #endif fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); fread (&up_rec, sizeof (Wps), 1, fptr); #ifdef WP_TRACE old_rec = up_rec; #endif if (rec->last >= up_rec.last_seen) { up_rec.last_seen = rec->last; /* Name */ if (*rec->name) { if ((*up_rec.name == '\0') || (rec->source == 'U')) { n_cpy (12, up_rec.name, rec->name); maj = 1; #ifdef WP_TRACE if (deb_wp) { if (wp_fptr == NULL) { wp_fptr = fopen (d_disque ("WP\\WP.DBG"), "at"); debug_wp_user ("OLD", wp_fptr, record, &old_rec, rec); } fprintf (wp_fptr, "Upd : Name = <%s>\n", rec->name); } #endif } } /* Home BBS */ if (*rec->homebbs) { if ((*rec->homebbs) && (strncmp (up_rec.secnd_homebbs, rec->homebbs, 40) != 0)) { strn_cpy (40, up_rec.secnd_homebbs, rec->homebbs); upd = 1; #ifdef WP_TRACE if (deb_wp) { if (wp_fptr == NULL) { wp_fptr = fopen (d_disque ("WP\\WP.DBG"), "at"); debug_wp_user ("OLD", wp_fptr, record, &old_rec, rec); } fprintf (wp_fptr, "2nd : New HomeBBS = <%s>\n", rec->homebbs); } #endif } if ((*up_rec.first_homebbs == '\0') || (rec->source == 'U') || (!strchr (up_rec.first_homebbs, '.') && strchr (rec->homebbs, '.'))) { strn_cpy (40, up_rec.first_homebbs, rec->homebbs); maj = 1; #ifdef WP_TRACE if (deb_wp) { if (wp_fptr == NULL) { wp_fptr = fopen (d_disque ("WP\\WP.DBG"), "at"); debug_wp_user ("OLD", wp_fptr, record, &old_rec, rec); } fprintf (wp_fptr, "1st : New HomeBBS = <%s>\n", rec->homebbs); } #endif } } /* ZIP */ if (*rec->zip) { ptr = rec->zip; while (*ptr) { /* Remplace les espaces par '_' */ if (isspace (*ptr)) *ptr = '_'; ++ptr; } if (strncmp (up_rec.secnd_zip, rec->zip, 8) != 0) { strn_cpy (8, up_rec.secnd_zip, rec->zip); upd = 1; #ifdef WP_TRACE if (deb_wp) { if (wp_fptr == NULL) { wp_fptr = fopen (d_disque ("WP\\WP.DBG"), "at"); debug_wp_user ("OLD", wp_fptr, record, &old_rec, rec); } fprintf (wp_fptr, "2nd : New Zip = <%s>\n", rec->zip); } #endif } if ((*up_rec.first_zip == '\0') || (rec->source == 'U')) { strn_cpy (8, up_rec.first_zip, rec->zip); maj = 1; #ifdef WP_TRACE if (deb_wp) { if (wp_fptr == NULL) { wp_fptr = fopen (d_disque ("WP\\WP.DBG"), "at"); debug_wp_user ("OLD", wp_fptr, record, &old_rec, rec); } fprintf (wp_fptr, "1st : New Zip = <%s>\n", rec->zip); } #endif } } /* QTH */ if (*rec->qth) { if (strncmp (up_rec.secnd_qth, rec->qth, 30) != 0) { n_cpy (30, up_rec.secnd_qth, rec->qth); upd = 1; #ifdef WP_TRACE if (deb_wp) { if (wp_fptr == NULL) { wp_fptr = fopen (d_disque ("WP\\WP.DBG"), "at"); debug_wp_user ("OLD", wp_fptr, record, &old_rec, rec); } fprintf (wp_fptr, "2nd : New Qth = <%s>\n", rec->qth); } #endif } if ((*up_rec.first_qth == '\0') || (rec->source == 'U')) { n_cpy (30, up_rec.first_qth, rec->qth); maj = 1; #ifdef WP_TRACE if (deb_wp) { if (wp_fptr == NULL) { wp_fptr = fopen (d_disque ("WP\\WP.DBG"), "at"); debug_wp_user ("OLD", wp_fptr, record, &old_rec, rec); } fprintf (wp_fptr, "1st : New Qth = <%s>\n", rec->qth); } #endif } } /* Mise a jour de la base */ if (maj || upd) { if ((up_rec.changed != 'U') && !rec->local) up_rec.changed = rec->source; up_rec.last_modif = rec->last; #ifdef WP_TRACE if (deb_wp) { if (wp_fptr == NULL) { wp_fptr = fopen (d_disque ("WP\\WP.DBG"), "at"); } fprintf (wp_fptr, "1st = %d 2nd = %d\n", maj, upd); debug_wp_user ("WRT", wp_fptr, record, &up_rec, rec); } #endif } else { #ifdef WP_TRACE if (deb_wp >= 3) { if (wp_fptr == NULL) { wp_fptr = fopen (d_disque ("WP\\WP.DBG"), "at"); } fprintf (wp_fptr, "WP not updated, no difference with WP database\n"); debug_wp_user ("TST", wp_fptr, record, &up_rec, rec); } #endif } /* Mise a jour de la date de derniere modif */ ++up_rec.seen; fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); fwrite (&up_rec, sizeof (Wps), 1, fptr); /* if (upd || maj) up_rec.secnd_date = time(NULL); */ if (maj) { wp.callsign = call2l (rec->callsign); wp.home = call2l (bbs_via (up_rec.first_homebbs)); write_wp (record, &wp); } } else { #ifdef WP_TRACE if (deb_wp >= 2) { if (wp_fptr == NULL) { wp_fptr = fopen (d_disque ("WP\\WP.DBG"), "at"); } fprintf (wp_fptr, "WP not updated, information on %s is older\n", date_mbl (rec->last)); debug_wp_user ("TST", wp_fptr, record, &up_rec, rec); } #endif } } else { fflush (fptr); record = (unsigned) (filelength (fileno (fptr)) / (long) sizeof (Wps)); memset (&up_rec, '\0', sizeof (Wps)); up_rec.free = 0; up_rec.changed = 0; up_rec.seen = 1; up_rec.last_modif = up_rec.last_seen = rec->last; strn_cpy (6, up_rec.callsign, rec->callsign); n_cpy (12, up_rec.name, rec->name); strn_cpy (40, up_rec.first_homebbs, rec->homebbs); strn_cpy (8, up_rec.first_zip, rec->zip); n_cpy (30, up_rec.first_qth, rec->qth); strn_cpy (40, up_rec.secnd_homebbs, rec->homebbs); strn_cpy (8, up_rec.secnd_zip, rec->zip); n_cpy (30, up_rec.secnd_qth, rec->qth); fseek (fptr, (long) record * sizeof (Wps), SEEK_SET); wp.callsign = call2l (rec->callsign); wp.home = call2l (bbs_via (rec->homebbs)); if (!rec->local) up_rec.changed = rec->source; fwrite (&up_rec, sizeof (Wps), 1, fptr); write_wp (record, &wp); #ifdef WP_TRACE if (deb_wp) { if (wp_fptr == NULL) { wp_fptr = fopen (d_disque ("WP\\WP.DBG"), "at"); } fprintf (wp_fptr, "Creates new record\n"); debug_wp_user ("CRT", wp_fptr, record, &up_rec, rec); } #endif } fclose (fptr); #ifdef WP_TRACE if (deb_wp) { if (wp_fptr) { fprintf (wp_fptr, "\n\n"); fclose (wp_fptr); } } #endif fin_io (); } int wp_server (void) { int nb; int i; int retour = 0; Wpr rec[MAX_UPD]; df ("wp_server", 0); aff_etat ('X'); if ((nb = wp_read (rec)) != 0) { for (i = 0; i < nb; i++) { wp_update (&rec[i]); } if (nb == MAX_UPD) retour = 1; } if (!retour) { dde_wp_serv = 0; } ff (); aff_msg_cons (); return (retour); } void ini_rec (Wpr * rec) { rec->local = 0; rec->last = time (NULL); rec->source = '\0'; *rec->homebbs = '\0'; *rec->callsign = '\0'; *rec->zip = '\0'; *rec->name = '\0'; *rec->qth = '\0'; } int is_serv (char *call) { serlist *lptr; lptr = tete_serv; while (lptr) { if (strcmp (lptr->nom_serveur, call) == 0) return (1); lptr = lptr->suiv; } return (0); } void wp_upd (Wpr * rec, int flush) { FILE *fptr; if ((!EMS_WPG_OK ()) || (wp_cache == NULL)) return; if (rec) { if (!rec->homebbs && !rec->name && !rec->zip && !rec->qth) return; if ((!find (rec->callsign)) || (is_serv (rec->callsign)) || (strcmp (rec->callsign, "SYSOP") == 0)) return; } deb_io (); if ((rec) && (pos_cache < LG_CACHE)) { wp_cache[pos_cache++] = *rec; } if ((pos_cache) && ((flush) || (pos_cache == LG_CACHE))) { fptr = fopen (d_disque ("WP\\FBB.WP"), "ab"); if (fptr == NULL) { fin_io (); return; } fwrite (wp_cache, sizeof (Wpr), pos_cache, fptr); fclose (fptr); dde_wp_serv = 1; pos_cache = 0; } fin_io (); } void exped_wp (char *exped, char *route) { Wpr rec; if (!EMS_WPG_OK ()) return; if (!find (exped)) return; ini_rec (&rec); rec.source = 'G'; strn_cpy (6, rec.callsign, exped); strn_cpy (40, rec.homebbs, route); if (addr_check (route)) wp_upd (&rec, 0); } void user_wp (info * finf) { Wpr rec; if (!EMS_WPG_OK ()) return; ini_rec (&rec); rec.source = 'U'; strn_cpy (6, rec.callsign, finf->indic.call); if (*finf->home) strn_cpy (40, rec.homebbs, extend_bbs (finf->home)); else strn_cpy (40, rec.homebbs, mypath); if (*finf->zip) strn_cpy (8, rec.zip, finf->zip); if (*finf->prenom != '?') n_cpy (12, rec.name, finf->prenom); if (*finf->ville) n_cpy (30, rec.qth, finf->ville); if (addr_check (rec.homebbs)) { wp_upd (&rec, 1); flush_wp_cache (); } } void header_wp (long date, char *home, char *qth, char *zip) { char st[80]; char *ptr; Wpr rec; if (!EMS_WPG_OK ()) return; ini_rec (&rec); rec.source = 'I'; rec.last = date; strn_cpy (40, rec.homebbs, home); n_cpy (30, rec.qth, qth); strn_cpy (8, rec.zip, zip); strn_cpy (40, st, home); ptr = strchr (st, '.'); if (ptr) *ptr = '\0'; strn_cpy (6, rec.callsign, st); if (addr_check (home)) wp_upd (&rec, 0); } void end_wp (void) { if (wp_cache) { m_libere (wp_cache, sizeof (Wpr) * LG_CACHE); wp_cache = NULL; } } void init_wp_cache (void) { wp_cache = (Wpr *) m_alloue (sizeof (Wpr) * LG_CACHE); pos_cache = 0; } void flush_wp_cache (void) { wp_upd (NULL, 1); } lcall call2l (char *callsign) { register char *ptr = callsign; register int c; lcall val = 0L; while ((c = (int) *ptr++) != 0) { if (c < 48) return (0xffffffffL); c -= 47; if (c > 10) { c -= 7; if (c > 36) { return (0xffffffffL); } else if (c < 11) { return (0xffffffffL); } } val *= 37; val += c; } return (val); } fbb-7.04j/src/xfbbd.c0100644000175100017510000007551407726646105012453 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* For main module */ #define PUBLIC #include #ifdef __ORB__ #include #endif #include /* Added Satoshi Yasuda for NLS */ #include #include #include #include #define NB_INIT_B 11 static int verbose = 0; static int init_phase = 1; static int info_canal = -1; static void sig_fct (int sig) { int pid, pstatus; sig &= 0xff; pid = wait (&pstatus); signal (sig, sig_fct); switch (sig) { case SIGHUP: /* reload system files */ if (verbose) fprintf (stderr, "Update system files\n"); init_buf_fwd (); init_buf_swap (); init_buf_rej (); init_bbs (); break; case SIGTERM: /* end of session */ if (verbose) fprintf (stderr, "Closing connections\n"); maintenance (); fbb_quit (1); break; case SIGBUS: /* end of session */ fprintf (stderr, "xfbbd : Bus error\n"); exit (5); break; case SIGSEGV: /* end of session */ fprintf (stderr, "xfbbd : Segmentation violation\n"); exit (5); break; } /* Other signals are ignored */ } static void xfbbd_init (void) { while (step_initialisations (init_phase) == 0) { /* Next step */ ++init_phase; }; } static char *XVersion (int dat) { static char prodVersion[80]; char sdate[30]; if (dat) sprintf (sdate, " (%s)", date ()); else *sdate = '\0'; sprintf (prodVersion, "%s%s", version (), sdate); return (prodVersion); } void banner (void) { fprintf (stderr, "*********************************************************\n" "* XFBB Linux daemon version %s PID=%d\n" "* Copyright F6FBB 1986-1999. All rights reserved.\n" "*\n" "* This software is in the public domain. It can be copied\n" "* or installed for any use abiding by the laws.\n" "*\n" "* F6FBB (Jean-Paul ROUBELAT) declines any responsibilty\n" "* in the use of XFBB software.\n" "*\n" "* This software is free of charge, but a 100 FF or 20 US$\n" "* (or more) contribution will be appreciated.\n" #ifdef PRE "*\n" "* This version is only for test purpose.\n" #endif "*********************************************************\n", XVersion (TRUE), getpid ()); } static int pactor_status[NBPORT]; void test_pactor(int force) { int port; int p_status; for (port = 1; port < NBPORT; port++) { if ((p_port[port].pvalid) && (p_port[port].stop == 0)) { if (!IS_PACTOR(port)) continue; p_status = 0; if (pactor_scan[port]) p_status |= PACTOR_SCAN; /* Connect monitoring */ if (ISS(port)) p_status |= PACTOR_ISS; if (ONLINE(port)) p_status |= PACTOR_ONLINE; if (force || (p_status != pactor_status[port])) { pactor_status[port] = p_status; #ifdef __ORB__ orb_pactor_status(port, p_status); #endif } } } } void process (void) { FbbMem (0); kernel (); test_pactor(0); } #ifdef __ORB__ extern int fbb_orb (char *service, int port); #endif int main (int ac, char **av) { int init_mode = 0; int orb = 1; int port = 3286; char *service = NULL; int i, ng; daemon_mode = 1; all_packets = 0; setlocale(LC_CTYPE, ""); /* Added Satoshi Yasuda for NLS */ for (i = 1; i < NSIG; i++) { if (i == SIGBUS || i == SIGSEGV || i == SIGALRM) continue; signal (i, sig_fct); } for (ng = 1; ng < ac; ng++) { if (strcmp (av[ng], "-h") == 0) { fprintf (stderr, "usage : xfbbd [-v] [-p port | -s service]\n"); return (0); } else if (strcmp (av[ng], "-V") == 0) { printf("%s\n", version()); return 0; } else if (strcmp (av[ng], "-v") == 0) { verbose = 1; } else if (strcmp (av[ng], "-a") == 0) { all_packets = 1; } else if (strcmp (av[ng], "-i") == 0) { init_mode = 1; } else if (strcmp (av[ng], "-p") == 0) { if ((ng + 1) != ac) port = atoi (av[ng + 1]); } else if (strcmp (av[ng], "-s") == 0) { if ((ng + 1) != ac) service = av[ng + 1]; } else if (strcmp (av[ng], "-n") == 0) { orb = 0; } } banner (); /* Initialisations */ xfbbd_init (); if (init_mode) { return (2); } #ifdef __ORB__ if (orb) fbb_orb (service, port); else { #endif fprintf (stderr, "xfbbd ready and running ...\n"); /* mainloop */ for (;;) { process (); if (is_idle) { usleep (10); } else { is_idle = 1; } } #ifdef __ORB__ } #endif return 1; } char *itoa (int val, char *buffer, int base) { sprintf (buffer, "%d", val); return buffer; } char *ltoa (long lval, char *buffer, int base) { sprintf (buffer, "%ld", lval); return buffer; } char *ultoa (unsigned long lval, char *buffer, int base) { sprintf (buffer, "%lu", lval); return buffer; } void InitText (char *text) { static char *initext[NB_INIT_B] = { "Reading INIT.SRV", "Reading Texts (%s)", "Ports configuration (%s)", "TNC configuration (%s)", "Servers & PG (%s)", "Loading BIDs (%s)", "Callsigns set-up (%s)", "Messages set-up (%s)", "WP set-up (%s)", "Forward set-up (%s)", "BBS set-up (%s)" }; if (!verbose) return; if (init_phase > NB_INIT_B) return; printf (initext[init_phase - 1], text); putchar ('\r'); fflush (stdout); } void InfoMessage (int temps, char *texte, char *titre) { static char def_titre[80]; if (!verbose) return; if (texte == NULL) return; if (titre == NULL) titre = def_titre; else strcpy (def_titre, titre); printf ("%s : %s\n", titre, texte); } #include void WinDebug (char *fmt,...) { va_list argptr; int cnt; if (!verbose) return; va_start (argptr, fmt); cnt = vprintf (fmt, argptr); va_end (argptr); } /* cmd : tableau des commandes a executer nb_cmd : nombre de commandes a executer mode : REPORT_MODE : attend un fichier log en retour NO_REPORT_MODE : pas de fichier log en retour log : nom du fichier de retour xdir : repertoire dans lequel doivent s'executer les commandes */ int call_nbdos (char **cmd, int nb_cmd, int mode, char *log, char *xdir, char *data) { /* Appel DOS */ int i; int ExitCode = 0; char *ptr; char file[256]; char buf[256]; char dir[256]; char arg[256]; /* semi-column is forbidden for security reasons */ if (log) sprintf (file, " %s 2>&1", back2slash (log)); else sprintf (file, " > 8; printf ("retour = %x\n", retour); if (ExitCode == 127) ExitCode = -1; printf ("ExitCode = %d\n", ExitCode); } return (ExitCode); } void CompressPosition (int mode, int val, long numero) { static long last_num = 0; if ((verbose) && (numero != last_num)) { last_num = numero; printf ("%s : msg %ld\n", (mode) ? "Compress" : "Decompress", numero); } } int filter (char *ligne, char *buffer, int len, char *data, char *xdir) { char deroute[80]; int retour; sprintf (deroute, "%sEXECUTE.xxx", MBINDIR); retour = call_nbdos (&ligne, 1, REPORT_MODE, deroute, xdir, data); if (retour != -1) { outfichs (deroute); } unlink (deroute); return (retour); } void sysop_call (char *texte) { } void window_write (int numero, char *data, int len, int color, int header) { #ifdef __ORB__ orb_write (numero, data, len, color, header); #endif } void WinMessage (int temps, char *text) { char str[256]; fd_set sock_read; struct timeval to; FD_ZERO (&sock_read); FD_SET (0, &sock_read); to.tv_sec = temps; to.tv_usec = 0; fprintf (stderr, "Message : %s\n", text); if (select (1, &sock_read, NULL, NULL, &to) > 0) read (0, str, sizeof (str)); } void win_status (char *txt) { } #ifdef __ORB__ static int old_priv; static int old_hold; static int old_total; void reset_msgs (void) { old_priv = -1; old_hold = -1; old_total = -1; } #endif void win_msg_cons (int priv, int hold) { #ifdef __ORB__ unsigned num_indic; ind_noeud *noeud; if (priv == -1) { noeud = insnoeud (cons_call.call, &num_indic); priv = noeud->nbnew; } if (old_priv != priv || old_hold != nb_hold || old_total != nbmess) { old_priv = priv; old_hold = nb_hold; old_total = nbmess; orb_nb_msg (priv, nb_hold, nbmess); } #endif } int fbb_list (int update) { #ifdef __ORB__ static char lcnx[MAXVOIES][80]; static int premier = 0; static int prec_con = 0; int nb_con = 0; int i; char buffer[80]; if ((premier) || (update)) { memset (lcnx, 0, NBVOIES * 80); premier = 0; } for (i = 0; i < NBVOIES; i++) { int ch; if (svoie[i]->sta.connect) { int ok = 0; int nobbs; struct tm *sdate; unsigned t_cnx; Forward *pfwd; char bbs[10]; char call[20]; int choix = 0; int fwd = 0; char fwd_char; ++nb_con; /* Test du forward */ ok = 0; *bbs = '\0'; pfwd = p_port[no_port (i)].listfwd; while (pfwd) { if ((svoie[i]->curfwd) && (pfwd->forward == i)) { nobbs = svoie[i]->bbsfwd; choix = (int) svoie[i]->cur_choix; strn_cpy (6, bbs, bbs_ptr + (nobbs - 1) * 7); ok = 1; fwd = 1; } pfwd = pfwd->suite; } if ((!ok) && (svoie[i]->mode & F_FOR) && (i != CONSOLE)) { fwd = 2; strcpy (bbs, svoie[i]->sta.indicatif.call); } strlwr (bbs); /* Affichage */ sdate = localtime (&(svoie[i]->debut)); t_cnx = (unsigned) (time (NULL) - svoie[i]->debut); if (i == 1) ch = 99; else ch = (i > 0) ? i - 1 : i; if (svoie[i]->sta.indicatif.num) sprintf (call, "%s-%d", svoie[i]->sta.indicatif.call, svoie[i]->sta.indicatif.num); else sprintf (call, "%s", svoie[i]->sta.indicatif.call); if (fwd == 1) fwd_char = '<'; else if (fwd == 2) fwd_char = '>'; else fwd_char = ' '; sprintf (buffer, "%c%02d %-9s %02d:%02d %02d:%02d %2d %3d %c%c%s", fwd_char, ch, call, sdate->tm_hour, sdate->tm_min, t_cnx / 3600, (t_cnx / 60) % 60, svoie[i]->sta.ret, svoie[i]->sta.ack, (choix < 2) ? ' ' : '0' + choix, (choix < 2) ? ' ' : '/', bbs ); } else { if (i == 1) ch = 99; else ch = (i > 0) ? i - 1 : i; sprintf (buffer, " %02d", ch); } if (strcmp (buffer, lcnx[i]) != 0) { orb_con_list (i, buffer); strcpy (lcnx[i], buffer); } } if (nb_con != prec_con) { prec_con = nb_con; orb_con_nb (nb_con); } return (nb_con); #else return (0); #endif } void FbbStatus (char *callsign, char *texte) { } void set_info_channel(int channel) { if (channel == -1) { user_status(-1); } else { info_canal = (channel > 0) ? channel+1 : channel; user_status(-1); user_status(info_canal); } } void user_status(int ch) { #ifdef __ORB__ int i; char str[256]; char call[80]; indicat *ind; static struct { char str[256]; char prenom[13]; char home[41]; stat_ch sta; int niv1, niv2, niv3, canal, nbmess, nbnew, paclen, memoc; unsigned flags; } prev; if (ch == -1) { memset(&prev, 0, sizeof(prev)); prev.niv1 = prev.niv2 = prev.niv3 = -1; prev.canal = prev.nbmess = prev.nbnew = -1; prev.paclen = prev.memoc = -1; prev.sta.ret = prev.sta.ack = -1; *prev.str = 0xff; *prev.prenom = 0xff; *prev.home = 0xff; return; } if (ch != info_canal) return; ind = &svoie[info_canal]->sta.indicatif; if (memcmp(ind, &prev.sta.indicatif, sizeof(indicat)) != 0) { prev.sta.indicatif = *ind; if (ind->num) sprintf(call, "%s-%d", ind->call, ind->num); else sprintf(call, "%s", ind->call); orb_info(ICall, call); *str = '\0'; for (i = 0; i < 2; i++) { ind = &svoie[info_canal]->sta.relais[i]; if (*(ind->call)) { if (ind->num) sprintf(call, "%s-%d", ind->call, ind->num); else sprintf(call, "%s", ind->call); if (i > 0) strcat(str, ","); strcat(str, call); } } ind = &svoie[info_canal]->sta.relais[i]; if (*(ind->call)) strcat(str, ",..."); orb_info(IDigis, str); } if (strcmp(prev.prenom, svoie[info_canal]->finf.prenom) != 0) { strcpy(prev.prenom, svoie[info_canal]->finf.prenom); orb_info(IName, svoie[info_canal]->finf.prenom); } if (strcmp(prev.home, svoie[info_canal]->finf.home) != 0) { strcpy(prev.home, svoie[info_canal]->finf.home); orb_info(IHome, svoie[info_canal]->finf.home); } if (info_canal != prev.canal) { prev.canal = info_canal; orb_info(IChan, itoa((info_canal > 0) ? info_canal - 1 : info_canal, str, 10)); orb_info(IPort, itoa(no_port(info_canal), str, 10)); } if ((svoie[info_canal]->niv1 != prev.niv1) || (svoie[info_canal]->niv2 != prev.niv2) || (svoie[info_canal]->niv3 != prev.niv3)) { prev.niv1 = svoie[info_canal]->niv1; prev.niv2 = svoie[info_canal]->niv2; prev.niv3 = svoie[info_canal]->niv3; sprintf(str, "%02d %02d %02d", svoie[info_canal]->niv1, svoie[info_canal]->niv2, svoie[info_canal]->niv3); orb_info(IN1N2N3, str); } if (svoie[info_canal]->finf.flags != prev.flags) { prev.flags = svoie[info_canal]->finf.flags; orb_info(IFlags, strflags(&svoie[info_canal]->finf)); } if (svoie[info_canal]->paclen != prev.paclen) { prev.paclen = svoie[info_canal]->paclen; orb_info(IPaclen, itoa(svoie[info_canal]->paclen, str, 10)); } if (svoie[info_canal]->sta.stat != prev.sta.stat) { prev.sta.stat = svoie[info_canal]->sta.stat; orb_info(IStatus, stat_voie(info_canal)); } if (svoie[info_canal]->memoc != prev.memoc) { prev.memoc = svoie[info_canal]->memoc; orb_info(IMem, itoa(svoie[info_canal]->memoc, str, 10)); } if (svoie[info_canal]->sta.ack != prev.sta.ack) { prev.sta.ack = svoie[info_canal]->sta.ack; orb_info(IBuf, itoa(svoie[info_canal]->sta.ack, str, 10)); } if (svoie[info_canal]->sta.ret != prev.sta.ret) { prev.sta.ret = svoie[info_canal]->sta.ret; orb_info(IRet, itoa(svoie[info_canal]->sta.ret, str, 10)); } if (svoie[info_canal]->ncur) { if (svoie[info_canal]->ncur->nbmess != prev.nbmess) { prev.nbmess = svoie[info_canal]->ncur->nbmess; orb_info(IPerso, itoa(svoie[info_canal]->ncur->nbmess, str, 10)); } if (svoie[info_canal]->ncur->nbnew != prev.nbnew) { prev.nbnew = svoie[info_canal]->ncur->nbnew; orb_info(IUnread, itoa(svoie[info_canal]->ncur->nbnew, str, 10)); } } else { orb_info(IPerso, "0"); orb_info(IUnread, "0"); } if (svoie[info_canal]->niv1 == N_YAPP) yapp_str(info_canal, str); else if (svoie[info_canal]->niv1 == N_BIN) abin_str(info_canal, str); else if (svoie[info_canal]->niv1 == N_XFWD) xfwd_str(info_canal, str); else if (svoie[info_canal]->niv1 == N_FORW) ffwd_str(info_canal, str); else *str = '\0'; if (strcmp(str, prev.str) != 0) { strcpy(prev.str, str); orb_info(IYapp, str); } orb_info(0, NULL); #endif } void maj_menu_options (void) { #ifdef __ORB__ orb_options(); #endif } void CloseFbbWindow (int numero) { #ifdef __ORB__ if (numero == CONSOLE) { if (v_tell) { selvoie (v_tell); pvoie->seq = v_tell = 0; retour_mbl (); /*maj_niv (pvoie->sniv1, pvoie->sniv2, pvoie->sniv3); prompt (pvoie->finf.flags, pvoie->niv1); */ selvoie (CONSOLE); maj_niv (0, 0, 0); pvoie->sta.connect = FALSE; } orb_disc (); } #endif } int xfbb_edit (void) { return 1; } int end_xfbb_edit (void) { return 1; } int call_dll (char *cmd, int mode, char *buffer, int len, char *data) { return 1; } static FILE *p_fptr = NULL; static int p_pos = 0; void RequestPendingForward(char *datafile) { p_pos = 0; p_fptr = fopen(datafile, "w"); if (p_fptr) { fwd_encours(); fclose(p_fptr); } } void AddPendingLine (char *call, int priv, int bull, int kb) { if (p_fptr == NULL) return; if (*call) fprintf(p_fptr, "%02d %s %d %d %d\n", p_pos++, call, priv, bull, kb); else fprintf(p_fptr, "%02d\n", p_pos++); } char *StartForward(int numbbs) { static char str[80]; char ifwd[NBBBS][7]; char bbs[8]; int retour; int port_fwd; ch_bbs (1, ifwd); if (numbbs < 0 || numbbs >= NBBBS || *ifwd[numbbs] == '\0') { sprintf(str, "Unknown BBS nb %d", numbbs); return str; } strn_cpy(6, bbs, ifwd[numbbs]); retour = val_fwd(bbs, &port_fwd, 1); if (retour < 0) { switch (retour) { case -1 : sprintf(str, "No forwarding channel on port %d", port_fwd); break; case -2: sprintf(str, "No port affected to %s", bbs); break; case -3 : sprintf(str, "Unknown BBS %s", bbs); break; case -4 : sprintf(str, "BBS %s already connected", bbs); break; default : sprintf(str, "Unknown error code %d", retour); break; } } else { sprintf(str, "Starting forward to %s on port %d", bbs, port_fwd); } return str; } char *StopForward(int numbbs) { static char str[80]; char ifwd[NBBBS][7]; char bbs[8]; int port_fwd; ch_bbs (1, ifwd); if (numbbs < 0 || numbbs >= NBBBS || *ifwd[numbbs] == '\0') { sprintf(str, "Unknown BBS nb %d", numbbs); return str; } strn_cpy(6, bbs, ifwd[numbbs]); port_fwd = dec_fwd(bbs); if (port_fwd < 0) { switch (port_fwd) { case -1 : sprintf(str, "BBS %s is not forwarding", bbs); break; case -2 : sprintf(str, "Unknown BBS %s", bbs); break; default : sprintf(str, "Unknown error code %d", port_fwd); break; } } else { sprintf(str, "Stopping forward with %s on port %d", bbs, port_fwd); } return str; } void window_connect (int numero) { } void ShowError (char *titre, char *info, int lig) { printf ("%s : %s %d\n", titre, info, lig); } void fbb_quit (unsigned retour) { sortie_prg (); exit (retour); } void WinMSleep (unsigned milliseconds) { usleep (milliseconds * 1000); } void WinSleep (unsigned seconds) { sleep (seconds); } int sel_option (char *texte, int *val) { char str[256]; for (;;) { fprintf (stderr, "%s (Y/N) ? ", texte); fflush (stdout); read (0, str, sizeof (str)); if ((*str == 'Y') || (*str == 'y')) { *val = 'y'; break; } if ((*str == 'N') || (*str == 'n')) break; } return (*val == 'y'); } void aff_traite (int voie, int val) { } void bipper (void) { if (!bip) return; } void music (int stat) { int i, j; int pid; static int pid_fils = 0; if (stat) { t_tell = 1000; pid = fork (); if (pid == 0) { /* fils */ for (j = 0; j < 5; j++) { if (!play ("syscall.wav")) { int fd; char c = '\a'; fd = open ("/dev/console", O_WRONLY); if (fd > 0) { for (i = 0; i < 10; i++) { write (fd, &c, 1); usleep (200000); } close (fd); } } sleep (10); } exit (0); } else pid_fils = pid; } else { if (pid_fils) kill (pid_fils, SIGKILL); pid_fils = 0; t_tell = -1; } } void SpoolLine (int voie, int attr, char *data, int lg) { } void window_init (void) { } void set_win_colors (void) { } void window_disconnect (int numero) { } void disconnect_channel (int channel, int immediate) { int ch = (channel > 0) ? channel+1 : channel; if ((svoie[ch]->sta.connect) && (ch) && (ch < NBVOIES)) { if (immediate) force_deconnexion (ch, 1); else deconnexion (ch, 1); } } void sysop_end (void) { } void FbbMem (int update) { static long old_avail = 0; static time_t old_time = 0; static int old_getd = 0; static long old_nbmess = -1L; static long old_temp = -1L; static long old_gMem = -1L; static long old_us = 0xffffffffL; int chg = 0; char texte[80]; int gMem = nb_ems_pages (); long us = mem_alloue; time_t new_time = time (NULL); if (update) { old_avail = 0; old_time = 0; old_getd = 0; old_nbmess = -1L; old_temp = -1L; old_gMem = -1; old_us = 0xffffffffL; } if (operationnel == -1) return; /* Mise a jour toutes les secondes */ if (old_time == new_time) return; old_time = new_time; if (us < 0L) us = 0L; if (us != old_us) { old_us = us; chg = 1; } if (gMem != old_gMem) { old_gMem = gMem; chg = 1; } /* Test disque toutes les 10 secondes */ if (old_getd == 0) { struct statfs dfree; if (statfs (DATADIR, &dfree) == 0) { sys_disk = dfree.f_bavail * (dfree.f_bsize / 1024L); if (sys_disk != old_avail) { old_avail = sys_disk; chg = 1; } } if (statfs (MBINDIR, &dfree) == 0) { tmp_disk = dfree.f_bavail * (dfree.f_bsize / 1024L); if (tmp_disk != old_avail && tmp_disk != old_temp) { old_temp = tmp_disk; chg = 1; } } else { tmp_disk = sys_disk; } old_getd = 10; } else --old_getd; #ifdef __ORB__ if (chg) { orb_status (old_us, old_gMem, old_avail, old_temp); } #endif if (nbmess != old_nbmess) { sprintf (texte, ": %ld", nbmess); old_nbmess = nbmess; } } void DisplayResync (int port, int nb) { static int tot_resync = 0; if (nb) { if (nb == 1) { printf ("Resynchro port %d (total = %d)\n", port, ++tot_resync); } } else { printf ("Port %d OK\n", port); } } int connect_tell (void) { char s[256]; if ((!svoie[CONSOLE]->sta.connect) && (svoie[v_tell]->sta.connect)) { console_on (); #ifdef ENGLISH sprintf (s, "*** Talking with %s (%s) ", svoie[v_tell]->sta.indicatif.call, svoie[v_tell]->finf.prenom); #else sprintf (s, "*** Convers. avec %s (%s)", svoie[v_tell]->sta.indicatif.call, svoie[v_tell]->finf.prenom); #endif selvoie (CONSOLE); pvoie->sta.connect = 16; pvoie->deconnect = FALSE; pvoie->ret = 0; pvoie->sid = 0; pvoie->pack = 0; pvoie->read_only = 0; pvoie->vdisk = 2; pvoie->xferok = 1; pvoie->msg_held = 0; pvoie->mess_recu = 1; pvoie->mbl = 0; init_timout (CONSOLE); pvoie->temp3 = 0; pvoie->nb_err = 0; pvoie->finf.lang = langue[0]->numlang; init_langue (voiecur); maj_niv (N_MBL, 9, 2); outln (s, strlen (s)); selvoie (v_tell); init_langue (voiecur); maj_niv (N_MBL, 9, 2); texte (T_MBL + 15); return 1; } return 0; } void RequestMsgsList(char *datafile) { p_pos = 0; p_fptr = fopen(datafile, "w"); if (p_fptr) { FbbRequestMessageList(); fclose(p_fptr); } } void AddMessageList (char *number) { if (p_fptr == NULL) return; fprintf(p_fptr, "%s\n", number); } char *GetMsgInfo(char *number, int *nLen) { static char buf[1024]; int nNum = 1; int nPos = 0; bullist rec; int i; if (GetMsgInfos (&rec, atol(number))) { nPos += sprintf(buf+nPos, "%d %c\n", nNum++, rec.type); nPos += sprintf(buf+nPos, "%d %c\n", nNum++, rec.status); nPos += sprintf(buf+nPos, "%d %ld\n", nNum++, rec.numero); nPos += sprintf(buf+nPos, "%d %ld\n", nNum++, rec.taille); nPos += sprintf(buf+nPos, "%d %ld\n", nNum++, rec.date); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.bbsf); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.bbsv); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.exped); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.desti); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.bid); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.titre); nPos += sprintf(buf+nPos, "%d %d\n", nNum++, rec.bin); nPos += sprintf(buf+nPos, "%d %u\n", nNum++, rec.nblu); nPos += sprintf(buf+nPos, "%d %ld\n", nNum++, rec.theme); nPos += sprintf(buf+nPos, "%d %ld\n", nNum++, rec.datesd); nPos += sprintf(buf+nPos, "%d %ld\n", nNum++, rec.datech); nPos += sprintf(buf+nPos, "%d", nNum++); for (i = 0 ; i < NBMASK ; i++) nPos += sprintf(buf+nPos, " %02x", rec.fbbs[i] & 0xff); nPos += sprintf(buf+nPos, "\n"); nPos += sprintf(buf+nPos, "%d", nNum++); for (i = 0 ; i < NBMASK ; i++) nPos += sprintf(buf+nPos, " %02x", rec.forw[i] & 0xff); nPos += sprintf(buf+nPos, "\n"); } *nLen = nPos; return buf; } int PutMsgInfo(char *number, char *buf, int nLen) { char *ptr; int nNum; bullist rec; int i; int fwd[NBMASK]; long NumMess = atol(number); if (!GetMsgInfos (&rec, NumMess)) return 0; ptr = strtok(buf, "\n"); while (ptr) { nNum = atoi(ptr); while (isdigit(*ptr)) ++ptr; while (isspace(*ptr)) ++ptr; switch (nNum) { case 1: rec.type = *ptr; break; case 2: rec.status = *ptr; break; case 3: rec.numero = atol(ptr); break; case 4: rec.taille = atol(ptr); break; case 5: rec.date = atol(ptr); break; case 6: strn_cpy(40, rec.bbsf, ptr); break; case 7: strn_cpy(40, rec.bbsv, ptr); break; case 8: strn_cpy(6, rec.exped, ptr); break; case 9: strn_cpy(6, rec.desti, ptr); break; case 10: strn_cpy(12, rec.bid, ptr); break; case 11: n_cpy(60, rec.titre, ptr); break; case 12: rec.bin = (*ptr == '0') ? '\0' : '\1'; break; case 13: rec.nblu = atoi(ptr); break; case 14: rec.theme = atol(ptr); break; case 15: rec.datesd = atol(ptr); break; case 16: rec.datech = atol(ptr); break; case 17: sscanf(ptr, "%x %x %x %x %x %x %x %x", &fwd[0], &fwd[1], &fwd[2], &fwd[3], &fwd[4], &fwd[5], &fwd[6], &fwd[7]); for (i = 0 ; i < NBMASK ; i++) rec.fbbs[i] = (char) fwd[i]; break; case 18: sscanf(ptr, "%x %x %x %x %x %x %x %x", &fwd[0], &fwd[1], &fwd[2], &fwd[3], &fwd[4], &fwd[5], &fwd[6], &fwd[7]); for (i = 0 ; i < NBMASK ; i++) rec.forw[i] = (char) fwd[i]; break; } ptr = strtok(NULL, "\n"); } SetMsgInfo(&rec, NumMess); return 1; } void RequestUsersList(char *datafile) { p_pos = 0; p_fptr = fopen(datafile, "w"); if (p_fptr) { FbbRequestUserList(); fclose(p_fptr); } } void AddUserList (char *callsign) { if (p_fptr == NULL) return; fprintf(p_fptr, "%s\n", callsign); } void AddUserLang (char *lang) { if (p_fptr == NULL) return; fprintf(p_fptr, "%d %s\n", p_pos++, lang); } char *GetUserInfo(char *call, int *nLen) { static char buf[1024]; int nNum = 1; int nPos = 0; info rec; int i; if (GetUserInfos (call, &rec)) { nPos += sprintf(buf+nPos, "%d %s-%d\n", nNum++, rec.indic.call, rec.indic.num); for (i = 0 ; i < 8 ; i++) nPos += sprintf(buf+nPos, "%d %s-%d\n", nNum++, rec.relai[i].call, rec.relai[i].num); nPos += sprintf(buf+nPos, "%d %ld\n", nNum++, rec.lastmes); nPos += sprintf(buf+nPos, "%d %ld\n", nNum++, rec.nbcon); nPos += sprintf(buf+nPos, "%d %ld\n", nNum++, rec.hcon); nPos += sprintf(buf+nPos, "%d %ld\n", nNum++, rec.lastyap); nPos += sprintf(buf+nPos, "%d %u\n", nNum++, rec.flags); nPos += sprintf(buf+nPos, "%d %u\n", nNum++, rec.on_base); nPos += sprintf(buf+nPos, "%d %u\n", nNum++, rec.nbl); nPos += sprintf(buf+nPos, "%d %u\n", nNum++, rec.lang); nPos += sprintf(buf+nPos, "%d %ld\n", nNum++, rec.newbanner); nPos += sprintf(buf+nPos, "%d %u\n", nNum++, rec.download); nPos += sprintf(buf+nPos, "%d %d\n", nNum++, rec.theme); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.nom); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.prenom); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.adres); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.ville); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.teld); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.telp); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.home); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.qra); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.priv); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.filtre); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.pass); nPos += sprintf(buf+nPos, "%d %s\n", nNum++, rec.zip); } *nLen = nPos; return buf; } int PutUserInfo(char *call, char *buf, int nLen) { int nNum; info rec; char *ptr; if (!GetUserInfos (call, &rec)) return 0; ptr = strtok(buf, "\n"); while (ptr) { nNum = atoi(ptr); while (isdigit(*ptr)) ++ptr; while (isspace(*ptr)) ++ptr; switch (nNum) { case 11: rec.lastmes = atol(ptr); break; case 12: rec.hcon = atol(ptr); break; case 13: rec.lastyap = atol(ptr); break; case 14: rec.flags = atoi(ptr); break; case 15: rec.on_base = atoi(ptr); break; case 16: rec.nbl = atoi(ptr); break; case 17: rec.lang = atoi(ptr); break; case 18: rec.newbanner = atol(ptr); break; case 19: rec.download = atoi(ptr); break; case 20: rec.theme = atoi(ptr); break; case 21: n_cpy(17, rec.nom, ptr); break; case 22: n_cpy(12, rec.prenom, ptr); break; case 23: n_cpy(60, rec.adres, ptr); break; case 24: n_cpy(30, rec.ville, ptr); break; case 25: n_cpy(12, rec.teld, ptr); break; case 26: n_cpy(12, rec.telp, ptr); break; case 27: n_cpy(40, rec.home, ptr); break; case 28: strn_cpy(6, rec.qra, ptr); break; case 29: n_cpy(12, rec.priv, ptr); break; case 30: n_cpy(6, rec.filtre, ptr); break; case 31: strn_cpy(12, rec.pass, ptr); break; case 32: n_cpy(8, rec.zip, ptr); break; } ptr = strtok(NULL, "\n"); } SetUserInfos(call, &rec); return 1; } int DelUserInfo(char *call) { info rec; FILE *fptr; ind_noeud *noeud; noeud = cher_noeud(call); if (noeud == NULL) return 0; fptr = ouvre_nomenc() ; fseek(fptr, (long)noeud->coord * ((long) sizeof(info)), 0) ; fread((char *) &rec, (int) sizeof(info), 1, fptr) ; *(rec.indic.call) = '\0'; fseek(fptr, (long)noeud->coord * ((long) sizeof(info)), 0) ; fwrite((char *) &rec, (int) sizeof(info), 1, fptr) ; ferme(fptr, 40) ; noeud->coord = 0xffff; return 1; } int NewUserInfo(char *call) { info rec; indicat callsign; unsigned num_indic; FILE *fptr; ind_noeud *noeud; n_cpy(6, callsign.call, call); callsign.num = 0; noeud = insnoeud(callsign.call, &num_indic); if (noeud->coord != 0xffff) return 0; init_info(&rec, &callsign); noeud->coord = rinfo++; noeud->val = 1; fptr = ouvre_nomenc() ; fseek(fptr, (long)noeud->coord * ((long) sizeof(info)), 0) ; fwrite((char *) &rec, (int) sizeof(info), 1, fptr) ; ferme(fptr, 40) ; return 1; } void CmdCHO(int port, int val) { if (IS_PACTOR(port) && (ONLINE(port))) { // Tue l'eventuel timer en cours del_timer(p_port[port].t_iss); p_port[port].t_iss = NULL; if (val) { tor_stop(p_port[port].pr_voie); } else { tor_start(p_port[port].pr_voie); } } } void CmdScan(int port, int val) { char cmde[80]; /* Start/Stop scanning */ wsprintf(cmde, "PTCTRX SCAN %d", val); ptctrx(0, cmde); } fbb-7.04j/src/xfwd.c0100644000175100017510000004035707726646105012333 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include /* * Module XForwarding */ static void wrbuf (void); static int import_xfwd (char *nom_fich); static int chk_xfwd (XInfo * xinfo); static int merge_xfwd (XInfo * xinfo); #if defined(__WINDOWS__) || defined(__LINUX__) char *xfwd_str (int voie, char *s) { #define XMODLEN 44 static char stdesc[10][11] = { "RcvSXnb ", "SndBIDList", "WaitSS ", "RcvData ", " ", "SndSXnb ", "WaitSYnb ", "RcvBIDList", "SendData ", "WaitPrompt" }; char taille[40]; int niv = svoie[voie]->niv3; *s = '\0'; if ((niv >= 0) && (niv < 10)) { if (svoie[voie]->tailm) sprintf (taille, "/%ld", svoie[voie]->tailm); else *taille = '\0'; sprintf (s, "XFwd:%s %ld%s", stdesc[niv], svoie[voie]->enrcur, taille); } return (s); } #endif /* niv2 = 0 -> Appelle pour forwarder */ /* Niv2 = 1 -> Connexion du distant */ void xfwd (void) { int i; int res; int nb; char s[80]; char asc_file[128]; char tmp_file[128]; mess_noeud *lptr; /* Les BS ne sont pas autorises en binaire ... */ set_bs (voiecur, FALSE); switch (pvoie->niv3) { case 0: /* Recoit la commande SX */ if (pvoie->Xfwd == NULL) pvoie->Xfwd = (XInfo *) m_alloue (sizeof (XInfo)); memset (pvoie->Xfwd, 0, sizeof (XInfo)); sscanf (indd, "%s %d", s, &pvoie->Xfwd->nb_bid); if (stricmp (s, "SX") != 0) { if (toupper (*s) == 'S') { /* Forward standard */ maj_niv (N_FORW, 3, 0); fwd (); return; } else { pvoie->deconnect = 6; return; } } set_bs (voiecur, TRUE); pvoie->Xfwd->r_bid = 0; ch_niv3 (1); break; case 1: /* Lit la liste des BIDs */ n_cpy (12, pvoie->Xfwd->bid[pvoie->Xfwd->r_bid], sup_ln (indd)); /* Marque le flag d'acceptation pour le BID donne */ strcpy (ptmes->bid, pvoie->Xfwd->bid[pvoie->Xfwd->r_bid]); res = deja_recu (ptmes, 1, &i); if ((res == 1) || (res == 4)) pvoie->Xfwd->ok_bid[pvoie->Xfwd->r_bid] = 1; else pvoie->Xfwd->ok_bid[pvoie->Xfwd->r_bid] = 0; if (++pvoie->Xfwd->r_bid == pvoie->Xfwd->nb_bid) { /* Les Bid ont ete recus ... On envoie la reponse */ nb = 0; for (i = 0; i < pvoie->Xfwd->nb_bid; i++) if (!pvoie->Xfwd->ok_bid[i]) ++nb; sprintf (s, "SY %d", nb); outsln (s, strlen (s)); if (nb) { for (i = 0; i < pvoie->Xfwd->nb_bid; i++) if (!pvoie->Xfwd->ok_bid[i]) outsln (pvoie->Xfwd->bid[i], strlen (pvoie->Xfwd->bid[i])); pvoie->Xfwd->r_bid = 0; ch_niv3 (2); } else { if (pvoie->niv2 == 0) { texte (T_MBL + 42); ch_niv3 (0); } else retour_mbl (); } } break; case 2: /* Recoit le SS Size */ if ((*indd++ == 'S') && (*indd++ == 'S')) { incindd (); set_binary (voiecur, N_BIN); pvoie->tailm = 0L; pvoie->enrcur = 0L; pvoie->checksum = 0; pvoie->size_trans = 0L; pvoie->time_trans = time (NULL); pvoie->Xfwd->chck = 0; nb = sscanf (indd, "%ld %u", &pvoie->tailm, &pvoie->Xfwd->chck); pvoie->Xfwd->ok_chck = (std_header & 2048) ? 0 : (nb == 2); /* Supprime un eventuel fichier temporaire */ temp_name (voiecur, tmp_file); unlink (tmp_file); ch_niv3 (3); } break; case 3: /* Recoit le fichier des messages binaires */ wrbuf (); if (pvoie->enrcur == pvoie->tailm) { status (voiecur); if (std_header & 2048) pvoie->Xfwd->ok_chck = 0; if (pvoie->Xfwd->ok_chck && (pvoie->Xfwd->chck != pvoie->checksum)) { /* Checksum error... File is not accepted... Disconnect */ libere (voiecur); err_new_fwd (1, 1); temp_name (voiecur, tmp_file); unlink (tmp_file); return; } /* Le fichier est recu ... Decompression des messages */ write_mess_temp (O_BINARY, voiecur); set_binary (voiecur, 0); basic_lzhuf (DECODE, temp_name (voiecur, tmp_file), xfwd_name (voiecur, asc_file)); import_xfwd (asc_file); unlink (tmp_file); unlink (asc_file); pvoie->tailm = pvoie->enrcur = 0L; if (pvoie->niv2 == 0) { texte (T_MBL + 42); ch_niv3 (0); } else retour_mbl (); /* Import des messages */ } break; case 5: /* Envoie la commande SX */ if (pvoie->Xfwd == NULL) pvoie->Xfwd = (XInfo *) m_alloue (sizeof (XInfo)); memset (pvoie->Xfwd, 0, sizeof (XInfo)); if (pvoie->niv2 == 1) appel_rev_fwd (TRUE); /* Cree la liste des messages */ nb = chk_xfwd (pvoie->Xfwd); pvoie->Xfwd->r_bid = 0; if (nb) { sprintf (s, "SX %d", nb); outsln (s, strlen (s)); for (i = 0; i < nb; i++) { sprintf (s, "%s", pvoie->Xfwd->bid[i]); outsln (s, strlen (s)); } ch_niv3 (6); } else { if (pvoie->niv2 == 0) { /* Passe en reverse */ if (pvoie->rev_mode) { texte (T_MBL + 42); ch_niv3 (0); } else pvoie->deconnect = 6; } else { texte (T_MBL + 47); pvoie->deconnect = 6; } } break; case 6: /* Recoit le SY */ pvoie->Xfwd->ls_bid = 0; sscanf (indd, "%s %d", s, &pvoie->Xfwd->ls_bid); if (stricmp (s, "SY") != 0) pvoie->deconnect = 6; if (pvoie->Xfwd->ls_bid) ch_niv3 (7); else ch_niv3 (9); break; case 7: /* Recoit la liste des BIDs */ sup_ln (indd); for (i = 0; i < pvoie->Xfwd->nb_bid; i++) { if ((!pvoie->Xfwd->ok_bid[i]) && (strcmp (pvoie->Xfwd->bid[i], indd) == 0)) { pvoie->Xfwd->ok_bid[i] = 1; break; } } if (++pvoie->Xfwd->r_bid == pvoie->Xfwd->ls_bid) { long lg; /* Cree le Merge et envoie le fichier compresse */ merge_xfwd (pvoie->Xfwd); pvoie->checksum = 0; lg = basic_lzhuf (ENCODE, xfwd_name (voiecur, asc_file), temp_name (voiecur, pvoie->sr_fic)); unlink (asc_file); if (std_header & 2048) sprintf (s, "SS %ld", lg); else sprintf (s, "SS %ld %u", lg, pvoie->checksum); outsln (s, strlen (s)); /* Force l'envoi du paquet ... */ send_buf (voiecur); pvoie->tailm = pvoie->enrcur = 0L; pvoie->size_trans = 0L; pvoie->xferok = 1; pvoie->type_yapp = 4; pvoie->tailm = file_size (pvoie->sr_fic); set_binary (voiecur, 1); ch_niv3 (8); xfwd (); } break; case 8: /* Envoie le fichier compresse */ if (senddata (1) == 1) { aff_etat ('E'); send_buf (voiecur); unlink (pvoie->sr_fic); set_binary (voiecur, 0); ch_niv3 (9); } break; case 9: /* Si reception SID ... Attendre le prompt suivant... */ if (*indd == '[') { /* SID recu... Attend le prompt ! */ ch_niv3 (10); break; } /* Attend le prompt */ if (att_prompt ()) { pvoie->tailm = pvoie->enrcur = 0L; /* Marquer les fichiers forwardes */ if (pvoie->Xfwd) { for (nb = 0; nb < MAX_X; nb++) { /* Uniquement les messages envoyes */ if (pvoie->Xfwd->ok_bid == 0) continue; /* Recuperer les infos du message */ if ((lptr = findmess (pvoie->Xfwd->numero[nb])) == NULL) continue; ouvre_dir (); read_dir (lptr->noenr, ptmes); ferme_dir (); sprintf (s, "F %ld V:%s [%ld]", ptmes->numero, pvoie->sta.indicatif.call, ptmes->taille); fbb_log (voiecur, 'M', s); mark_fwd (voiecur, 0); } } ch_niv3 (5); xfwd (); } break; case 10: /* Si reception SID ... Attendre le prompt suivant... */ if (att_prompt ()) ch_niv3 (9); break; default: /* Erreur */ break; } } static void wrbuf (void) { int ncars; int nbcar = nb_trait; obuf *msgtemp; char *ptcur; char *ptr; pvoie->enrcur += (long) nbcar; pvoie->size_trans += (long) nbcar; if ((msgtemp = pvoie->msgtete) != NULL) { while (msgtemp->suiv) msgtemp = msgtemp->suiv; } else { msgtemp = (obuf *) m_alloue (sizeof (obuf)); pvoie->msgtete = msgtemp; msgtemp->nb_car = msgtemp->no_car = 0; msgtemp->suiv = NULL; } ncars = msgtemp->nb_car; ptcur = msgtemp->buffer + ncars; ptr = data; while (nbcar--) { ++pvoie->memoc; pvoie->checksum += *ptr; *ptcur++ = *ptr++; if (++ncars == 250) { msgtemp->nb_car = ncars; msgtemp->suiv = (obuf *) m_alloue (sizeof (obuf)); msgtemp = msgtemp->suiv; msgtemp->nb_car = msgtemp->no_car = ncars = 0; msgtemp->suiv = NULL; ptcur = msgtemp->buffer; } } msgtemp->nb_car = ncars; if (pvoie->memoc > MAXMEM) { write_mess_temp (O_BINARY, voiecur); } } static void rd_champ (char *ligne, char *champ, int len) { /* Saute le mot-cle */ while ((*ligne) && (!isspace (*ligne))) ++ligne; /* Saute les espaces */ while ((*ligne) && (isspace (*ligne))) ++ligne; /* Copie la valeur */ while (len--) { if (*ligne) *champ++ = *ligne++; else break; } *champ = '\0'; } static int read_xfwd_header (FILE * fptr) { int champs = 0; char *ptr; char ligne[81]; ini_champs (voiecur); for (;;) { if (fgets (ligne, 80, fptr) == 0) return (-1); sup_ln (ligne); if ((*ligne == '\0') || (*ligne == ' ')) { /* Fin du bloc */ break; } else if (strnicmp ("FROM:", ligne, 5) == 0) { champs |= 1; if ((ptr = strchr (ligne, '@')) != NULL) { int i; *ptr++ = '\0'; for (i = 0; i < 6; i++) { if (!isalnum (*ptr)) break; ptmes->bbsf[i] = toupper (*ptr); ptr++; } ptmes->bbsf[i] = '\0'; } rd_champ (ligne, ptmes->exped, 6); } else if (strnicmp ("TO:", ligne, 3) == 0) { champs |= 2; if ((ptr = strchr (ligne, '@')) != NULL) { *ptr++ = '\0'; n_cpy (40, ptmes->bbsv, ptr); } rd_champ (ligne, ptmes->desti, 6); } else if (strnicmp ("SUBJECT:", ligne, 8) == 0) { /* champs |= 4; Sujet non obligatoire */ rd_champ (ligne, ptmes->titre, 50); } else if (strnicmp ("X-MSGTYPE:", ligne, 10) == 0) { /* champs |= 8; Type non obligatoire */ rd_champ (ligne, &ptmes->type, 1); } else if (strnicmp ("X-BID:", ligne, 6) == 0) { /* champs |= 0x10; BID non obligatoire... */ rd_champ (ligne, ptmes->bid, 12); } } if (ptmes->type == ' ') { if ((find (ptmes->desti)) || (is_serv (ptmes->desti))) { ptmes->type = 'P'; } else { ptmes->type = 'B'; } } ptmes->status = 'N'; if (*ptmes->bbsv) { if ((ptmes->type == 'P') && (!find (ptmes->desti)) && (!find (bbs_via (ptmes->bbsv)))) ptmes->type = 'B'; if ((*ptmes->bbsv) && (!find (bbs_via (ptmes->bbsv)))) ptmes->status = '$'; } swapp_bbs (ptmes); if ((*ptmes->bbsv == '\0') && (ptmes->type == 'P')) { pvoie->m_ack = 1; } if (!addr_check (ptmes->bbsv)) { return (-2); } reacheminement (); if ((*ptmes->bbsv == '\0') && (ptmes->type == 'A')) { ptmes->type = 'P'; } entete_saisie (); return (champs); } static int import_xfwd (char *nom_fich) { int retour; int test; int recu; int msg = 1; int res; FILE *fptr; char ligne[256]; char bbsf[10]; char bbsv[50]; retour = 1; aff_etat ('I'); if ((fptr = fopen (nom_fich, "rt")) != NULL) { while (1) { /* Lire header + taches swap, etc... */ res = read_xfwd_header (fptr); if (res == -1) { /* Fin de fichier */ break; } else if (res == 0) { /* Ligne vide avant les propositions */ continue; } *bbsf = '\0'; if (*ptmes->bbsv) sprintf (bbsv, "@%s", ptmes->bbsv); else *bbsv = '\0'; sprintf (ligne, "XFWD T:%c Fm:%s%s To:%s%s Id:%s\r", (ptmes->type) ? ptmes->type : '?', ptmes->exped, bbsf, ptmes->desti, bbsv, (*ptmes->bid) ? ptmes->bid : "None"); aff_bas (voiecur, W_RCVT, ligne, strlen (ligne)); if (res != 0x3) { sprintf (ligne, "Error header = %d\r", res); aff_bas (voiecur, W_SNDT, ligne, strlen (ligne)); /* Fin de fichier ou Erreur : Le message n'est pas importe... */ retour = 0; msg = 0; } else { /* Test reject */ recu = deja_recu (ptmes, 1, &test); if ((recu == 1) || (recu == 4)) { sprintf (ligne, "Message rejected\r"); aff_bas (voiecur, W_SNDT, ligne, strlen (ligne)); msg = 0; } } while (1) { if (fgets (ligne, 80, fptr) == 0) { /* Error ... Fichier non fini */ break; } lf_to_cr (ligne); if (get_mess_fwd ('X', ligne, strlen (ligne), (msg) ? 2 : 3)) { /* Message enregistre */ msg = 1; break; } } } if (fptr) ferme (fptr, 7); } return (retour); } static int wr_xfwd_mess (FILE * fptr, bullist * pbul) { char last_char; char *ptr; FILE *fptm; char header[256]; char bbsf[10]; char bbsv[50]; fprintf (fptr, "From: %s\n", pbul->exped); if (*pbul->bbsv) fprintf (fptr, "To: %s@%s\n", pbul->desti, pbul->bbsv); else fprintf (fptr, "To: %s\n", pbul->desti); fprintf (fptr, "Subject: %s\n", pbul->titre); fprintf (fptr, "X-msgtype: %c\n", pbul->type); fprintf (fptr, "X-BID: %s\n\n", pbul->bid); *bbsf = '\0'; if (*ptmes->bbsv) sprintf (bbsv, "@%s", pbul->bbsv); else *bbsv = '\0'; sprintf (header, "XFWD #:%ld T:%c Fm:%s%s To:%s%s Id:%s\r", pbul->numero, pbul->type, pbul->exped, bbsf, pbul->desti, bbsv, pbul->bid); aff_bas (voiecur, W_SNDT, header, strlen (header)); /* Header */ make_header (pbul, header); entete_mess_fwd (pbul, header); /* Msg_header contient le header complet avec des \r */ ptr = msg_header; while (*ptr) { if (*ptr == '\r') *ptr = '\n'; ++ptr; } fputs (msg_header, fptr); fflush (fptr); /* Ajouter le texte du message */ mess_name (MESSDIR, pbul->numero, pvoie->sr_fic); if ((fptm = ouvre_mess (O_TEXT, pbul->numero, '\0')) == NULL) return (0); fflush (fptr); fflush (fptm); copy_fic (fileno (fptm), fileno (fptr), &last_char); fclose (fptm); if (last_char != '\n') fputc ('\n', fptr); fputs ("/EX\n", fptr); return (1); } static int merge_xfwd (XInfo * xinfo) { int nb; char asc_file[128]; bullist lbul; FILE *fptr; mess_noeud *lptr; fptr = fopen (xfwd_name (voiecur, asc_file), "wt"); if (fptr == NULL) return (0); for (nb = 0; nb < xinfo->nb_bid; nb++) { if (!xinfo->ok_bid[nb]) continue; /* Recuperer les infos du message */ if ((lptr = findmess (xinfo->numero[nb])) == NULL) return (0); ouvre_dir (); read_dir (lptr->noenr, &lbul); ferme_dir (); if (!wr_xfwd_mess (fptr, &lbul)) { fclose (fptr); return (0); } } fclose (fptr); return (1); } int not_in_xfwd_mess (long numero, int voie) { int nb = 0; for (nb = 0; nb < svoie[voie]->Xfwd->nb_bid; nb++) { if (svoie[voie]->Xfwd->numero[nb] == numero) return (FALSE); } return (TRUE); } static int chk_xfwd (XInfo * xinfo) { int nb; int nb_dupes = 0; int chk_dupes; int no_more = 0; long max_tfwd = 1024L * (long) p_port[no_port (voiecur)].maxbloc; long tail_tmess = 0L; nb = 0; pvoie->Xfwd->nb_bid = 0; chk_dupes = ((pvoie->typfwd & FWD_DUPES) == 0); while (nb < MAX_X) { if (tail_tmess > max_tfwd) break; for (;;) { if (!mess_suiv (voiecur)) { if ((nb_dupes) && (chk_dupes)) { pvoie->nb_egal -= nb_dupes; nb_dupes = 0; chk_dupes = 0; continue; } else { no_more = 1; break; } } break; } if (no_more) break; if (std_header & 16) { if (*ptmes->bbsv == '\0') { strcpy (ptmes->bbsv, mypath); } } if (*(ptmes->bbsv) == '\0') { strcpy (ptmes->bbsv, pvoie->sta.indicatif.call); } if ((*(ptmes->exped)) && (*(ptmes->bbsv)) && (*(ptmes->desti)) && (*(ptmes->bid)) && (ISGRAPH (ptmes->type))) { xinfo->numero[nb] = ptmes->numero; n_cpy (12, xinfo->bid[nb], ptmes->bid); tail_tmess += ptmes->taille; ++pvoie->Xfwd->nb_bid; ++nb; } else mark_fwd (voiecur, 0); } pvoie->nb_egal -= nb_dupes; return (pvoie->Xfwd->nb_bid); } fbb-7.04j/src/xmodem.c0100644000175100017510000007374307726646105012661 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE X, Y, ZMODEM */ #include #include #ifdef __LINUX__ #include #include #include #include #endif #ifdef __WINDOWS__ char *xmodem_str (int voie, char *s) { #define XMODLEN 44 static char stdesc[10][11] = { "SendInit ", "SendData ", "SendData ", "SendEof ", "RcvInit ", "RcvLabel ", "RcvData ", "RcvEnd ", "XmodmAbort", "ZsInit " }; static char xmod_name[4][5] = {"Xmod", "Xm1K", "Ymod", "Zmod"}; char taille[40]; int n; int niv = svoie[voie]->niv3; long offset = svoie[voie]->enrcur; if (offset < 0L) offset = 0L; *s = '\0'; if ((niv >= 0) && (niv < 10)) { if (svoie[voie]->tailm) { sprintf (taille, "/%ld", svoie[voie]->tailm); } else { *taille = '\0'; } sprintf (s, "%s:%s %s %ld%s", xmod_name[svoie[voie]->type_yapp], stdesc[niv], svoie[voie]->appendf, offset, taille); } return (s); } #else static void aff_xmodem (int ok) { #define XMODLEN 44 static char stdesc[10][11] = { "SendInit ", "SendData ", "SendData ", "SendEof ", "RcvInit ", "RcvLabel ", "RcvData ", "RcvEnd ", "XmodmAbort", "ZsInit " }; static char xmod_name[4][5] = {"Xmod", "Xm1K", "Ymod", "Zmod"}; char s[80]; char taille[40]; int n; int niv = pvoie->niv3; long offset = pvoie->enrcur; if (offset < 0L) offset = 0L; *s = '\0'; if (ok) { if ((niv >= 0) && (niv < 10)) { if (pvoie->tailm) { sprintf (taille, "/%ld", pvoie->tailm); } else { *taille = '\0'; } sprintf (s, "%s:%s %s %ld%s", xmod_name[pvoie->type_yapp], stdesc[niv], pvoie->appendf, offset, taille); } } for (n = strlen (s); n < XMODLEN; n++) s[n] = ' '; s[XMODLEN] = '\0'; aff_chaine (W_DEFL, 17, 3, s); } #endif void display_dsz_perf (int voie) { int save_voie; FILE *fptr; long lg_file; Ylist *temp; Ylist *yptr; char ligne[256]; selvoie (voie); cr (); pvoie->size_trans = 0L; fptr = fopen (svoie[voie]->ch_temp, "rt"); if (fptr == NULL) return; yptr = svoie[voie]->ytete; while (yptr) { char tmp1[80]; char tmp2[80]; char tmp3[80]; temp = yptr; strcpy (svoie[voie]->appendf, yptr->filename); fgets (ligne, sizeof (ligne), fptr); WinDebug ("Res -> %s\r\n", ligne); sscanf (ligne, "%s %s %s %s %s", tmp1, varx[0], tmp2, tmp3, varx[1]); lg_file = atol (varx[0]); pvoie->size_trans += lg_file; if (pvoie->kiss == -2) { save_voie = voiecur; selvoie (CONSOLE); texte (T_DOS + 5); selvoie (save_voie); } else texte (T_DOS + 5); yptr = yptr->next; m_libere (temp, sizeof (Ylist)); } svoie[voie]->ytete = NULL; fclose (fptr); unlink (svoie[voie]->ch_temp); sprintf (ligne, "%sDSZFIL.%d", MBINDIR, voiecur); unlink (ligne); } void xmodem_mode (int mode, int voie) { #ifdef __FBBDOS__ RSEGS rsegs; int port = no_port (voie); memset (&rsegs, 0, sizeof (RSEGS)); rsegs.DX = (int) p_port[port].ccom - 1; rsegs.AX = 0x0e00 | (mode & 0xff); int14real (&rsegs); #endif } static void zmodem_tx_on (int voie, int type, int lg) { #ifdef __FBBDOS__ RSEGS rsegs; int port = no_port (voie); memset (&rsegs, 0, sizeof (RSEGS)); rsegs.DX = (int) p_port[port].ccom - 1; rsegs.AX = 0x0e00 | ((type) ? 0x9 : 0x8); rsegs.CX = lg; int14real (&rsegs); #endif } void get_zrpos (int voie) { #ifdef __FBBDOS__ RSEGS rsegs; int port = no_port (voie); char str[80]; selvoie (voie); memset (&rsegs, 0, sizeof (RSEGS)); rsegs.DX = (int) p_port[port].ccom - 1; rsegs.AX = 0x0e0a; rsegs.BX = 0x00; int14real (&rsegs); svoie[voie]->enrcur = (((long) rsegs.BX) << 16) | (((long) rsegs.AX) & 0xffff); if (svoie[voie]->enrcur) { sprintf (str, "ZRPOS to %ld\r", svoie[voie]->enrcur); aff_bas (voie, W_RCVT, str, strlen (str)); } clear_outbuf (voie); svoie[voie]->stop = 0; ch_niv3 (XS_SEND); xmodem (); #endif } static char *ymodem_header (int voie, long date, int *lg) { static char ybuf[128]; char *ptr; int len = 0; memset (ybuf, 0, 128); strcpy (ybuf, svoie[voie]->appendf); ptr = ybuf; while (*ptr) { ++ptr; ++len; } ++ptr; ++len; sprintf (ptr, "%ld %lo ", svoie[voie]->tailm, date); *lg = strlen (ptr) + len + 1; return (ybuf); } void libere_ymodem (int voie, int display) { Ylist *yptr, *temp; yptr = svoie[voie]->ytete; while (yptr) { temp = yptr; if ((display) && (yptr->ok == 1)) { svoie[voie]->size_trans = temp->size_trans; svoie[voie]->time_trans = temp->time_trans; strcpy (svoie[voie]->appendf, temp->filename); display_perf (voie); } yptr = yptr->next; m_libere (temp, sizeof (Ylist)); } svoie[voie]->ytete = NULL; } static int ymodem_files (void) { int nb = 0; Ylist *yptr; struct stat bufstat; libere_ymodem (voiecur, 0); yptr = pvoie->ytete; strtok (indd, " \r"); indd[40] = '\0'; if ((indd = strtok (NULL, " \r")) == NULL) { texte (T_ERR + 20); retour_appel (); return (0); } do { if ((tst_point (indd)) && (stat (nom_yapp (), &bufstat) != -1) && ((bufstat.st_mode & S_IFREG) != 0)) { if (yptr) { yptr->next = (Ylist *) m_alloue (sizeof (Ylist)); yptr = yptr->next; } else { pvoie->ytete = yptr = (Ylist *) m_alloue (sizeof (Ylist)); } n_cpy (255, yptr->filename, pvoie->appendf); ++nb; } else texte (T_ERR + 11); } while ((indd = strtok (NULL, " \r")) != NULL); yptr = pvoie->ytete; if (yptr) { *pvoie->appendf = '\0'; while (yptr) { strcat (pvoie->appendf, yptr->filename); yptr = yptr->next; if (yptr) strcat (pvoie->appendf, " "); } texte (T_YAP + 0); aff_etat ('E'); send_buf (voiecur); sleep_ (1); } else { retour_appel (); } return (nb); } static void zmodem_init (void) { static char zrqinit[25] = "rz\r**\030B00000000000000\r\n\021"; md_no_echo (voiecur); outs (zrqinit, strlen (zrqinit)); ch_niv3 (ZS_FILE); } static int zmodem_tx (int voie) { int lg; int retour = 0; struct stat bufstat; Ylist *yptr; char *ptr; yptr = svoie[voie]->ytete; while ((yptr) && (yptr->ok)) yptr = yptr->next; while ((retour == 0) && (yptr)) { indd = yptr->filename; if ((tst_point (indd)) && (stat (nom_yapp (), &bufstat) != -1) && ((bufstat.st_mode & S_IFREG) != 0)) { while (!modem_vide (voie)) ; sleep_ (1); pvoie->enrcur = -1L; pvoie->tailm = file_size (pvoie->sr_fic); set_binary (voiecur, 1); pvoie->xferok = 1; pvoie->size_trans = 0L; pvoie->time_trans = 0L; prog_more (voie); ptr = ymodem_header (voie, bufstat.st_ctime, &lg); zmodem_tx_on (voie, (yptr->next != NULL), lg); outs (ptr, lg); svoie[voie]->stop = 0; ch_niv3 (XS_WAIT); retour = 1; } else { yptr->ok = -1; yptr = yptr->next; } } return (retour); } static int ymodem_tx (int voie) { int lg; int retour = 0; struct stat bufstat; Ylist *yptr; char *ptr; yptr = svoie[voie]->ytete; while ((yptr) && (yptr->ok)) yptr = yptr->next; while ((retour == 0) && (yptr)) { indd = yptr->filename; if ((tst_point (indd)) && (stat (nom_yapp (), &bufstat) != -1) && ((bufstat.st_mode & S_IFREG) != 0)) { while (!modem_vide (voie)) ; sleep_ (1); pvoie->enrcur = 0L; pvoie->tailm = file_size (pvoie->sr_fic); set_binary (voiecur, 1); pvoie->xferok = 1; pvoie->size_trans = 0L; pvoie->time_trans = 0L; prog_more (voie); ptr = ymodem_header (voie, bufstat.st_ctime, &lg); ymodem_tx_on (voie, (yptr->next != NULL)); outs (ptr, 128); if (senddata (1)) { ch_niv3 (XS_QUEUE); } else ch_niv3 (XS_SEND); retour = 1; } else { yptr->ok = -1; yptr = yptr->next; } } return (retour); } #ifdef __FBBDOS__ static int xmodem_tx (int voie) { int retour = 0; struct stat bufstat; char *ptr; strtok (indd, " \r"); if ((indd = strtok (NULL, " \r")) == NULL) { texte (T_ERR + 20); retour_appel (); } else if ((tst_point (indd)) && (stat (nom_yapp (), &bufstat) != -1) && ((bufstat.st_mode & S_IFREG) != 0)) { texte (T_YAP + 0); aff_etat ('E'); send_buf (voie); while (!modem_vide (voie)) ; sleep_ (1); pvoie->enrcur = 0L; if ((ptr = strtok (NULL, " \r")) != NULL) pvoie->enrcur = atol (ptr); pvoie->tailm = file_size (pvoie->sr_fic); set_binary (voiecur, 1); pvoie->xferok = 1; pvoie->size_trans = 0L; pvoie->time_trans = 0L; prog_more (voie); switch (pvoie->type_yapp) { case 0: xmodem_tx_on (voie); break; case 1: xmodem_tx_1k (voie); break; } if (senddata (1)) { ch_niv3 (XS_QUEUE); } else ch_niv3 (XS_SEND); retour = 1; } else { texte (T_ERR + 11); retour_appel (); } return (retour); } #endif static int xmodem_rx (int voie) { int fd; int retour = 0; struct stat bufstat; strtok (indd, " \r"); if (read_only ()) retour_appel (); else if ((indd = strtok (NULL, " \r")) == NULL) { texte (T_ERR + 20); retour_appel (); } else if ((tst_point (indd)) && (stat (nom_yapp (), &bufstat) == -1)) { fd = open (svoie[voie]->sr_fic, O_CREAT | O_WRONLY | O_TRUNC, S_IREAD | S_IWRITE); if (fd > 0) { close (fd); unlink (svoie[voie]->sr_fic); pvoie->ytete = (Ylist *) m_alloue (sizeof (Ylist)); n_cpy (255, pvoie->ytete->filename, pvoie->appendf); texte (T_YAP + 3); ch_niv3 (XR_LABL); del_temp (voie); pvoie->enrcur = 0L; pvoie->tailm = 0L; pvoie->size_trans = 0L; pvoie->time_trans = time (NULL); retour = 1; } else { texte (T_ERR + 30); retour_appel (); } } else { texte (T_ERR + 23); retour_appel (); } return (retour); } #define hex(d) ((d > '9') ? d-55 : d-48) static int gethex (void) { int val = 0; val = (int) (hex (*indd)) << 4; ++indd; val += (int) (hex (*indd)); ++indd; return (val); } static int ztyp_header (long *f) { long fl = 0L; int type = ZFERR; int i; while ((*indd) && (*indd != '*')) ++indd; if (*indd) { while (*indd == '*') ++indd; if (*indd == 24) ++indd; if (*indd == 'B') { ++indd; type = gethex (); for (i = 0; i < 4; i++) { fl <<= 8; fl += gethex (); } } } *f = fl; return (type); } #ifdef __LINUX__ void m_flush (int fd) { ioctl (fd, TCFLSH, TCOFLUSH); } void kill_rzsz (int voie) { if (svoie[voiecur]->rzsz_pid != -1) { kill (svoie[voie]->rzsz_pid, SIGTERM); } } static void sig_child (int sig) { int ret; int pid; int voie; int status; pid = wait (&status); ret = WEXITSTATUS (status); for (voie = 0; voie < NBVOIES; voie++) { if (svoie[voie]->rzsz_pid == pid) { svoie[voie]->rzsz_pid = -1; svoie[voie]->ask = 1; break; } } signal (SIGCHLD, sig_child); } int run_rzsz (int voie, char *cmde) { char *args[128]; struct termios tty; defcom *ptrcom = &p_com[(int)p_port[no_port (voie)].ccom]; int n; printf ("Commande = <%s>\n", cmde); set_binary (voie, 2); signal (SIGPIPE, SIG_IGN); signal (SIGCHLD, sig_child); /* Serial port in binary raw mode */ tcgetattr (ptrcom->comfd, &tty); tty.c_iflag &= ~(IGNBRK | IGNCR | INLCR | ICRNL | IUCLC | IXANY | IXON | IXOFF | INPCK | ISTRIP); tty.c_iflag |= (BRKINT | IGNPAR); tty.c_oflag &= ~OPOST; tty.c_lflag = ~(ICANON | ISIG | ECHO | ECHONL | ECHOE | ECHOK); tcsetattr (ptrcom->comfd, TCSANOW, &tty); /* pipe(svoie[voie]->to_xfbb); */ /* pipe(svoie[voie]->to_rzsz); */ switch (svoie[voie]->rzsz_pid = fork ()) { case -1: return (0); case 0: /* Child */ dup2 (ptrcom->comfd, 0); dup2 (ptrcom->comfd, 1); for (n = 1; n < NSIG; n++) signal (n, SIG_DFL); n = 0; args[n] = strtok (cmde, " "); while (args[n]) { if (n == 127) { args[n] = NULL; break; } args[++n] = strtok (NULL, " "); } (void) execvp (args[0], args); printf ("Exec %s failed\n", args[0]); exit (1); default: /* Parent */ break; } return (1); } #endif void xmodem (void) { long f; int ok = 1; int ncars; obuf *msgtemp; char *ptcur; char *ptr; Ylist *yptr; switch (pvoie->type_yapp) { case 0: var_cpy (0, "XMODEM"); break; case 1: var_cpy (0, "1K-XMODEM"); break; case 2: var_cpy (0, "YMODEM"); break; case 3: var_cpy (0, "ZMODEM"); break; } switch (pvoie->niv3) { case XS_EXTERN: /* Infos pour statistiques */ pvoie->time_trans = time (NULL) - pvoie->time_trans; pvoie->finf.download += (int) (pvoie->size_trans / 1024L); #ifdef __LINUX__ /* Attend le vidage de la queue */ set_binary (voiecur, 0); ioctl (p_com[(int)p_port[no_port (voiecur)].ccom].comfd, TCFLSH, 2); /* Reinitialise le port */ init_modem (no_port (voiecur)); clear_inbuf (voiecur); #else /* Reeinitialisation du modem */ #ifdef __WIN32__ { int val = 0; sta_drv (voiecur, SUSPCMD, &val); } #else init_modem (no_port (voiecur)); #endif #endif aff_header (voiecur); display_dsz_perf (voiecur); pvoie->finf.download += (int) (pvoie->size_trans / 1024L); retour_appel (); break; case XS_INIT: switch (pvoie->type_yapp) { case 0: case 1: #ifdef __LINUX__ if (BIOS (no_port (voiecur)) == P_LINUX) { if (ymodem_files ()) { /* Runs DSZ or equivalent */ char cmde[1024]; int ok_send = 0; if (pvoie->type_yapp == 0) sprintf (cmde, "fbb_zm sx "); else sprintf (cmde, "fbb_zm sx -k "); yptr = svoie[voiecur]->ytete; while (yptr) { strcat (cmde, " "); indd = yptr->filename; strcat (cmde, back2slash (nom_yapp ())); yptr = yptr->next; ok_send = 1; break; } /* Execute la commande en tache de fond */ ok = 0; if (ok_send) { pvoie->sta.ack = 0; /* Attend le vidage de la queue */ while (!modem_vide (voiecur)); sleep (1); if (run_rzsz (voiecur, cmde)) { pvoie->xferok = 1; pvoie->size_trans = 0L; pvoie->time_trans = 0L; prog_more (voiecur); ch_niv3 (XS_EXTERN); ok = 1; } } } } #endif #ifdef __WINDOWS__ if (BIOS (no_port (voiecur)) == P_WINDOWS) { #ifdef __WIN32__ if (ymodem_files ()) { /* Runs DSZ or equivalent */ char cmde[256]; int ok_send = 0; sprintf (pvoie->ch_temp, "%sDSZLOG.%d", MBIN, voiecur); if (pvoie->type_yapp == 0) sprintf (cmde, "sx -g %s", pvoie->ch_temp); else sprintf (cmde, "sx -k -g %s", pvoie->ch_temp); yptr = svoie[voiecur]->ytete; while (yptr) { strcat (cmde, " "); indd = yptr->filename; strcat (cmde, nom_yapp ()); yptr = yptr->next; ok_send = 1; break; /* Only 1 file with XModem */ } /* Execute la commande en tache de fond */ ok = 0; if (ok_send) { int val = 1; pvoie->sta.ack = 0; /* Attend le vidage de la queue */ while (!modem_vide (voiecur)); // sta_drv(voiecur, SUSPCMD, &val); // sleep(1); if (run_rzsz (voiecur, cmde) == 0) { pvoie->xferok = 1; pvoie->size_trans = 0L; pvoie->time_trans = 0L; prog_more (voiecur); /* pvoie->seq = 1; */ ch_niv3 (XS_EXTERN); ok = 1; } } } else ok = 0; #else if (ymodem_files ()) { /* Runs DSZ or equivalent */ char cmde[256]; int ok_send = 0; sprintf (pvoie->ch_temp, "%sDSZLOG.%d", MBIN, voiecur); if (pvoie->type_yapp == 0) wsprintf (cmde, "DSZ.PIF %s %x %d speed %ld handshake on sx", pvoie->ch_temp, p_com[com].cbase, p_com[com].irq, p_com[com].baud); else wsprintf (cmde, "DSZ.PIF %s %x %d speed %ld handshake on sx", pvoie->ch_temp, p_com[com].cbase, p_com[com].irq, p_com[com].baud); yptr = svoie[voiecur]->ytete; while (yptr) { strcat (cmde, " "); indd = yptr->filename; strcat (cmde, nom_yapp ()); yptr = yptr->next; ok_send = 1; break; /* Only 1 file with XModem */ } /* Execute la commande en tache de fond */ if (ok_send) { closecom_windows (p_port[no_port (voiecur)].ccom); pvoie->sta.ack = 0; win_execute (cmde); ch_niv3 (XS_EXTERN); ok = 1; } else ok = 0; } else ok = 0; #endif } #endif #ifdef __FBBDOS__ ok = xmodem_tx (voiecur); #endif break; case 2: if (ymodem_files ()) { #ifdef __LINUX__ if (BIOS (no_port (voiecur)) == P_LINUX) { /* Runs DSZ or equivalent */ char cmde[1024]; int ok_send = 0; sprintf (cmde, "fbb_zm sb -k "); yptr = svoie[voiecur]->ytete; while (yptr) { strcat (cmde, " "); indd = yptr->filename; strcat (cmde, back2slash (nom_yapp ())); yptr = yptr->next; ok_send = 1; } /* Execute la commande en tache de fond */ ok = 0; if (ok_send) { pvoie->sta.ack = 0; /* Attend le vidage de la queue */ while (!modem_vide (voiecur)); sleep (1); if (run_rzsz (voiecur, cmde)) { pvoie->xferok = 1; pvoie->size_trans = 0L; pvoie->time_trans = 0L; prog_more (voiecur); /* pvoie->seq = 1; */ ch_niv3 (XS_EXTERN); ok = 1; } } } #endif #ifdef __WINDOWS__ if (BIOS (no_port (voiecur)) == P_WINDOWS) { #ifdef __WIN32__ /* Runs DSZ or equivalent */ char cmde[256]; int ok_send = 0; sprintf (pvoie->ch_temp, "%sDSZLOG.%d", MBIN, voiecur); sprintf (cmde, "sb -k -g %s", pvoie->ch_temp); yptr = svoie[voiecur]->ytete; while (yptr) { strcat (cmde, " "); indd = yptr->filename; strcat (cmde, nom_yapp ()); yptr = yptr->next; ok_send = 1; break; /* 1 file with YModem */ } /* Execute la commande en tache de fond */ ok = 0; if (ok_send) { int val = 1; pvoie->sta.ack = 0; /* Attend le vidage de la queue */ while (!modem_vide (voiecur)); sta_drv (voiecur, SUSPCMD, &val); sleep (1); if (run_rzsz (voiecur, cmde) == 0) { pvoie->xferok = 1; pvoie->size_trans = 0L; pvoie->time_trans = 0L; prog_more (voiecur); /* pvoie->seq = 1; */ ch_niv3 (XS_EXTERN); ok = 1; } } #else /* Runs DSZ or equivalent */ char cmde[256]; int ok_send = 0; wsprintf (cmde, "DSZ.PIF %s %x %d speed %ld handshake on sb -k", pvoie->ch_temp, p_com[com].cbase, p_com[com].irq, p_com[com].baud); yptr = svoie[voiecur]->ytete; while (yptr) { strcat (cmde, " "); indd = yptr->filename; strcat (cmde, nom_yapp ()); yptr = yptr->next; ok_send = 1; break; /* 1 file with YModem */ } /* Execute la commande en tache de fond */ if (ok_send) { char env[256]; closecom_windows (p_port[no_port (voiecur)].ccom); pvoie->sta.ack = 0; win_execute (cmde); ch_niv3 (XS_EXTERN); ok = 1; } else ok = 0; #endif } #endif #ifdef __FBBDOS__ ok = ymodem_tx (voiecur); #endif } else ok = 0; break; case 3: /* ZModem */ if (ymodem_files ()) { #ifdef __LINUX__ if (BIOS (no_port (voiecur)) == P_LINUX) { /* Runs DSZ or equivalent */ char cmde[1024]; int ok_send = 0; sprintf (cmde, "fbb_zm sz "); yptr = svoie[voiecur]->ytete; while (yptr) { strcat (cmde, " "); indd = yptr->filename; strcat (cmde, back2slash (nom_yapp ())); yptr = yptr->next; ok_send = 1; } /* Execute la commande en tache de fond */ ok = 0; if (ok_send) { pvoie->sta.ack = 0; /* Attend le vidage de la queue */ while (!modem_vide (voiecur)); sleep (1); if (run_rzsz (voiecur, cmde)) { pvoie->xferok = 1; pvoie->size_trans = 0L; pvoie->time_trans = 0L; prog_more (voiecur); /* pvoie->seq = 1; */ ch_niv3 (XS_EXTERN); ok = 1; } } } #endif #ifdef __WINDOWS__ if (BIOS (no_port (voiecur)) == P_WINDOWS) { #ifdef __WIN32__ /* Runs DSZ or equivalent */ char cmde[1024]; int val; int ok_send = 0; sprintf (pvoie->ch_temp, "%sDSZLOG.%d", MBIN, voiecur); sprintf (cmde, "sz -g %s", pvoie->ch_temp); yptr = svoie[voiecur]->ytete; while (yptr) { strcat (cmde, " "); indd = yptr->filename; strcat (cmde, nom_yapp ()); yptr = yptr->next; ok_send = 1; } /* Execute la commande en tache de fond */ ok = 0; if (ok_send) { pvoie->sta.ack = 0; /* Attend le vidage de la queue */ while (!modem_vide (voiecur)); val = 1; sta_drv (voiecur, SUSPCMD, &val); sleep (1); if (run_rzsz (voiecur, cmde) == 0) { pvoie->xferok = 1; pvoie->size_trans = 0L; pvoie->time_trans = 0L; prog_more (voiecur); /* pvoie->seq = 1; */ ch_niv3 (XS_EXTERN); ok = 1; } } #else /* Runs DSZ or equivalent */ char cmde[256]; char env[128]; char fil[128]; int ok_send = 0; FILE *fptr; sprintf (pvoie->ch_temp, "%sDSZLOG.%d", MBIN, voiecur); sprintf (env, "%sDSZFIL.%d", MBIN, voiecur); wsprintf (cmde, "DSZ.PIF %s %x %d speed %ld handshake on sz -b -m -rr @%s", pvoie->ch_temp, p_com[com].cbase, p_com[com].irq, p_com[com].baud, env); yptr = svoie[voiecur]->ytete; fptr = fopen (env, "wt"); if (fptr == NULL) { ok = 0; break; } while (yptr) { /* strcat(cmde, " "); indd = yptr->filename; strcat(cmde, nom_yapp()); */ indd = yptr->filename; fputs (nom_yapp (), fptr); fputc ('\n', fptr); yptr = yptr->next, ok_send = 1; } fclose (fptr); /* Execute la commande en tache de fond */ if (ok_send) { closecom_windows (p_port[no_port (voiecur)].ccom); pvoie->sta.ack = 0; win_execute (cmde); ch_niv3 (XS_EXTERN); ok = 1; } else ok = 0; #endif } #endif #ifdef __FBBDOS__ { zmodem_init (); ok = 1; } #endif } else ok = 0; break; } break; case ZS_FILE: switch (ztyp_header (&f)) { case ZRINIT: zmodem_tx (voiecur); break; case ZCOMM: zmodem_init (); break; case ZRQINIT: break; default: ch_niv3 (XM_ABORT); xmodem (); ok = 0; break; } break; case XS_SEND: #ifdef __FBBDOS__ if (senddata (1)) { ch_niv3 (XS_QUEUE); } #endif break; case XS_WAIT: break; case XS_QUEUE: break; case XS_END: xmodem_off (voiecur); set_binary (voiecur, 0); aff_header (voiecur); pvoie->time_trans = time (NULL) - pvoie->time_trans; pvoie->finf.download += (int) (pvoie->size_trans / 1024L); if ((pvoie->type_yapp == 2) || (pvoie->type_yapp == 3)) { yptr = svoie[voiecur]->ytete; while ((yptr) && (yptr->ok)) yptr = yptr->next; if (pvoie->type_yapp == 3) pvoie->size_trans = pvoie->enrcur; yptr->time_trans = pvoie->time_trans; yptr->size_trans = pvoie->size_trans; if (yptr) { yptr->ok = 1; yptr = yptr->next; } if (yptr) { switch (pvoie->type_yapp) { case 2: ch_niv3 (XS_INIT); ok = ymodem_tx (voiecur); break; case 3: ok = zmodem_tx (voiecur); break; } } else { libere_ymodem (voiecur, 1); retour_appel (); ok = 0; } } else { display_perf (voiecur); retour_appel (); ok = 0; } break; case XR_EXTERN: /* Infos pour statistiques */ pvoie->time_trans = time (NULL) - pvoie->time_trans; #ifdef __LINUX__ /* Attend le vidage de la queue */ set_binary (voiecur, 0); ioctl (p_com[(int)p_port[no_port (voiecur)].ccom].comfd, TCFLSH, 2); /* Reinitialise le port */ init_modem (no_port (voiecur)); clear_inbuf (voiecur); #else /* Reeinitialisation du modem */ #ifdef __WIN32__ { int val = 0; sta_drv (voiecur, SUSPCMD, &val); } #else init_modem (no_port (voiecur)); #endif #endif /* Appel du filtre... */ if (test_temp (voiecur)) { rename_temp (voiecur, pvoie->sr_fic); wr_dir (pvoie->sr_fic, pvoie->sta.indicatif.call); pvoie->time_trans = time (NULL) - pvoie->time_trans; } aff_header (voiecur); display_dsz_perf (voiecur); retour_appel (); break; case XR_INIT: ok = xmodem_rx (voiecur); break; case XR_LABL: while ((*indd) && (!ISPRINT (*indd))) ++indd; w_label (pvoie->sr_fic, sup_ln (indd)); n_cpy (LABEL_NOM - 1, pvoie->label, sup_ln (indd)); texte (T_YAP + 1); aff_etat ('E'); send_buf (voiecur); while (!modem_vide (voiecur)) ; #ifdef __LINUX__ if (BIOS (no_port (voiecur)) == P_LINUX) { char cmde[256]; char temp[256]; temp_name (voiecur, temp); sprintf (pvoie->ch_temp, "%sDSZLOG.%d", MBINDIR, voiecur); switch (pvoie->type_yapp) { case 0: case 1: sprintf (cmde, "fbb_zm rx %s", temp); break; case 2: sprintf (cmde, "fbb_zm rb %s", temp); break; case 3: sprintf (cmde, "fbb_zm rz %s", temp); break; } pvoie->sta.ack = 0; /* Attend le vidage de la queue */ while (!modem_vide (voiecur)); sleep (1); if (run_rzsz (voiecur, cmde)) { pvoie->xferok = 1; pvoie->size_trans = 0L; pvoie->time_trans = 0L; prog_more (voiecur); ch_niv3 (XR_EXTERN); ok = 1; } else retour_dos (); } #endif #ifdef __WINDOWS__ if (BIOS (no_port (voiecur)) == P_WINDOWS) { #ifdef __WIN32__ char cmde[256]; char temp[256]; int ok_send = 0; temp_name (voiecur, temp); sprintf (pvoie->ch_temp, "%sDSZLOG.%d", MBIN, voiecur); switch (pvoie->type_yapp) { case 0: case 1: wsprintf (cmde, "rx %s -g %s", temp, pvoie->ch_temp); break; case 2: wsprintf (cmde, "rb %s -g %s", temp, pvoie->ch_temp); break; case 3: wsprintf (cmde, "rz %s -g %s", temp, pvoie->ch_temp); break; } /* Execute la commande en tache de fond */ pvoie->sta.ack = 0; /* Attend le vidage de la queue */ while (!modem_vide (voiecur)); { int val = 1; sta_drv (voiecur, SUSPCMD, &val); sleep (1); if (run_rzsz (voiecur, cmde) == 0) { /* pvoie->xferok = 1; pvoie->size_trans = 0L; pvoie->time_trans = 0L; prog_more (voiecur); */ /* pvoie->seq = 1; */ ch_niv3 (XR_EXTERN); } } #else char cmde[256]; char temp[256]; int ok_send = 0; temp_name (voiecur, temp); sprintf (pvoie->ch_temp, "%sDSZLOG.%d", MBIN, voiecur); switch (pvoie->type_yapp) { case 0: case 1: wsprintf (cmde, "DSZ.PIF %s %x %d speed %ld handshake on rx %s", pvoie->ch_temp, p_com[com].cbase, p_com[com].irq, p_com[com].baud, temp); break; case 2: wsprintf (cmde, "DSZ.PIF %s %x %d speed %ld handshake on rb %s", pvoie->ch_temp, p_com[com].cbase, p_com[com].irq, p_com[com].baud, temp); break; case 3: wsprintf (cmde, "DSZ.PIF %s %x %d speed %ld handshake on rz %s", pvoie->ch_temp, p_com[com].cbase, p_com[com].irq, p_com[com].baud, temp); break; } /* Execute la commande en tache de fond */ closecom_windows (p_port[no_port (voiecur)].ccom); pvoie->sta.ack = 0; win_execute (cmde); ch_niv3 (XR_EXTERN); #endif } #endif #ifdef __FBBDOS__ { sleep_ (1); set_binary (voiecur, 1); pvoie->xferok = 0; prog_more (voiecur); xmodem_rx_on (voiecur); ch_niv3 (XR_RECV); } #endif break; case XR_RECV: pvoie->size_trans += (long) nb_trait; pvoie->enrcur += (long) nb_trait; if ((msgtemp = pvoie->msgtete) != NULL) { while (msgtemp->suiv) msgtemp = msgtemp->suiv; } else { msgtemp = (obuf *) m_alloue (sizeof (obuf)); pvoie->msgtete = msgtemp; msgtemp->nb_car = msgtemp->no_car = 0; msgtemp->suiv = NULL; } ncars = msgtemp->nb_car; ptcur = msgtemp->buffer + ncars; ptr = data; while (nb_trait--) { ++pvoie->memoc; *ptcur++ = *ptr++; if (++ncars == 250) { msgtemp->nb_car = ncars; msgtemp->suiv = (obuf *) m_alloue (sizeof (obuf)); msgtemp = msgtemp->suiv; msgtemp->nb_car = msgtemp->no_car = ncars = 0; msgtemp->suiv = NULL; ptcur = msgtemp->buffer; } } msgtemp->nb_car = ncars; if (pvoie->memoc > MAXMEM) { ok = write_mess_temp (O_BINARY, voiecur); } if (ok) { break; } /* Si erreur continue sur XR_END ! */ case XR_END: write_mess_temp (O_BINARY, voiecur); xmodem_off (voiecur); set_binary (voiecur, 0); if (test_temp (voiecur)) { rename_temp (voiecur, pvoie->sr_fic); wr_dir (pvoie->sr_fic, pvoie->sta.indicatif.call); pvoie->time_trans = time (NULL) - pvoie->time_trans; display_perf (voiecur); } else del_temp (voiecur); aff_header (voiecur); retour_appel (); ok = 0; break; case XM_ABORT: clear_outbuf (voiecur); xmodem_off (voiecur); set_binary (voiecur, 0); if (!pvoie->xferok) del_temp (voiecur); aff_header (voiecur); pvoie->finf.download += (int) (pvoie->size_trans / 1024L); retour_appel (); ok = 0; break; } #ifndef __WINDOWS__ aff_xmodem (ok); #endif } void modem (void) { switch (pvoie->niv2) { case 0: accueil_modem (); break; case 1: indic_modem (); break; case 2: passwd_modem (); break; case 3: passwd_change (); break; case 4: xmodem (); break; default: fbb_error (ERR_NIVEAU, "MODEM", pvoie->niv2); break; } } fbb-7.04j/src/yapp.c0100644000175100017510000007054207726646105012333 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /* * MODULE TRANSFERT BINAIRE PROTOCOLE YAPP */ #include typedef struct { char nom[FBB_NAMELENGTH+1]; char attr; unsigned date; long size; } Fichier; #include "yapp.h" char *nom_yapp (void); static int dir_ok (char *); static void ack1 (void); static void ack2 (void); static void ack3 (void); static void ack4 (void); static void ack5 (void); static void bin_hdr (char *, long); static void canwait (void); static void canrecd (void); static void change_label (void); static void fin_yapp (void); /* static void not_ready(char *); */ static void reprise_yapp (void); static void sendeof (void); static void sendinit (void); static void sendinit_retry (void); static void wrbuf (void); static void yapp_timer (void); static void yapp_xfer (void); static unsigned char etat[12][17] = { {AB, SH, SD, AB, AB, AB, AB, AB, SA, C, AB, S, DP, S1, AB, AB, AB}, {AB, SH, SD, AB, AB, AB, AB, AB, SA, C, AB, S, DP, S1, AB, AB, AB}, {AB, AB, SD, AB, AB, AB, AB, AB, RP, C, AB, AB, DP, AB, AB, AB, AB}, {AB, AB, AB, AB, AB, AB, AB, AB, AB, C, AB, AB, DP, AB, AB, AB, SD}, {AB, AB, AB, AB, AB, AB, AB, AB, AB, C, AB, AB, DP, AB, ST, AB, AB}, {SA, SA, SA, SA, SA, SA, SA, SA, SA, C, SA, SA, DP, SA, SA, SA, AB}, {AB, AB, AB, E1, AB, AB, AB, AB, AB, C, AB, AB, DP, AB, AB, AB, AB}, {AB, AB, AB, RH, E2, AB, AB, E4, AB, C, AB, AB, DP, AB, AB, AB, AB}, {AB, AB, AB, AB, AB, E6, E3, AB, AB, C, AB, AB, DP, AB, AB, AB, AB}, {SA, CW, CW, CW, CW, CW, CW, CW, CW, C, CW, CW, CW, CW, CW, CW, AB}, {SA, CW, CW, CW, CW, CW, CW, CW, CW, E5, SA, CW, DP, SA, CW, CW, AB}, {AB, SA, SA, SA, SA, SA, SA, SA, SA, C, SA, SA, SA, SA, SA, SA, AB} }; void display_perf (int voie) { int save_voie; ltoa (svoie[voie]->size_trans, varx[0], 10); if (svoie[voie]->time_trans == 0) svoie[voie]->time_trans = 1; ltoa (svoie[voie]->size_trans / svoie[voie]->time_trans, varx[1], 10); if (pvoie->kiss == -2) { save_voie = voiecur; selvoie (CONSOLE); texte (T_DOS + 5); selvoie (save_voie); } else texte (T_DOS + 5); } static void reprise_yapp (void) { int lg = 0xff & (int) *(indd + 1); if ((lg == 0) || (*(indd + 2) != 'R') || (*(indd + 3) != '\0')) { ch_niv2 (SA); fin_yapp (); } else { pvoie->type_yapp = 0; indd += 4; lg -= 2; pvoie->enrcur = atol (indd); /* Position in the file */ while (*indd) { --lg; ++indd; } if (lg > 1) { ++indd; --lg; if (*indd == 'C') pvoie->type_yapp = 1; /* Yapp checksum */ aff_yapp (voiecur); } time_yapp[voiecur] = -1; pvoie->time_trans = time (NULL); if (senddata (2)) { sendeof (); ch_niv2 (SE); } else ch_niv2 (SD); } } char *vir_path (char *nomfic) { int i; int len; char *nptr; char fn[256]; static char filename[256]; if (nomfic[1] == ':') { nptr = nomfic; } else { fn[0] = getdisk () + 'A'; fn[1] = ':'; strcpy (fn + 2, nomfic); nptr = slash2back(fn); } for (i = 0; i < NB_PATH; i++) { len = strlen (PATH[i]); /* Cherche l'unite virtuelle */ if ((len) && (strncmpi (PATH[i], nptr, len) == 0)) { /* Transforme le nom physique en nom virtuel */ filename[0] = i + 'A'; filename[1] = ':'; filename[2] = '\\'; strcpy (filename + 3, nptr + len); return (filename); } } /* Pas trouve d'unite virtuelle */ return (NULL); } void t_label (void) { FILE *fptr; Rlabel rlabel; long record_old = 0L; long record_new = 0L; struct stat st; char filename[82]; if ((fptr = fopen (d_disque ("YAPPLBL.DAT"), "r+b")) == NULL) return; while (fread (&rlabel, sizeof (Rlabel), 1, fptr)) { if (*rlabel.nomfic) { int vdisk; vdisk = rlabel.nomfic[0] - 'A'; strcpy (filename, PATH[vdisk]); strcat (filename, rlabel.nomfic + 3); if (stat (long_filename(NULL, filename), &st) == 0) { if (record_old != record_new) { fseek (fptr, record_new, 0); fwrite (&rlabel, sizeof (Rlabel), 1, fptr); } record_new += sizeof (Rlabel); } } record_old += sizeof (Rlabel); fseek (fptr, record_old, 0); } /* Cleans the rest of the file */ memset (&rlabel, 0, sizeof (Rlabel)); while (record_new < record_old) { fseek (fptr, record_new, 0); fwrite (&rlabel, sizeof (Rlabel), 1, fptr); record_new += sizeof (Rlabel); } fclose (fptr); } void w_label (char *nomfic, char *label) { int nouveau; long record = 0L; long record_free = -1L; FILE *fptr; Rlabel rlabel; bullist rmess; char *ptr = vir_path (nomfic); /* Pas de nom virtuel ... Pas de mise a jour ! */ if (ptr == NULL) return; if ((fptr = fopen (d_disque ("YAPPLBL.DAT"), "r+b")) == NULL) { if ((fptr = fopen (d_disque ("YAPPLBL.DAT"), "wb")) == NULL) return; fclose (fptr); if ((fptr = fopen (d_disque ("YAPPLBL.DAT"), "r+b")) == NULL) { return; } } nouveau = 1; while (fread (&rlabel, sizeof (Rlabel), 1, fptr)) { if (*(rlabel.nomfic) == '\0') record_free = record; else if (strncmp (ptr, rlabel.nomfic, LABEL_FIC - 1) == 0) { record_free = record; nouveau = 0; break; } record += (long) sizeof (Rlabel); } if (record_free >= 0L) fseek (fptr, record_free, 0); if (nouveau) { memset (&rlabel, 0, sizeof (Rlabel)); n_cpy (LABEL_NOM - 1, rlabel.label, label); n_cpy (LABEL_FIC - 1, rlabel.nomfic, ptr); n_cpy (LABEL_OWN - 1, rlabel.owner, pvoie->sta.indicatif.call); rlabel.date_creation = time (NULL); /* Next message number */ rlabel.index = ++nomess; /* Update the message number */ memset (&rmess, 0, sizeof (bullist)); rmess.numero = nomess; ouvre_dir (); write_dir (0, &rmess); ferme_dir (); } else { n_cpy (LABEL_NOM - 1, rlabel.label, label); } fwrite (&rlabel, sizeof (Rlabel), 1, fptr); fclose (fptr); } static void fin_yapp (void) #define DELAY_PROMPT 3 /* environ 3 secondes */ { pvoie->time_trans = time (NULL) - pvoie->time_trans; clear_inbuf (voiecur); time_yapp[voiecur] = DELAY_PROMPT; ch_niv2 (50); } void retour_niveau (void) { if (pvoie->temp1 == N_DOS) { maj_niv (9, 0, 0); } else { maj_niv (N_MBL, 0, 0); pvoie->mbl = 1; } } void retour_appel (void) { int save_voie; if (pvoie->kiss == -2) { pvoie->kiss = CONSOLE; save_voie = voiecur; /* Retour au gateway */ selvoie (pvoie->kiss); texte (T_GAT + 5); maj_niv (N_TELL, 0, 3); /* Remet la voie I/O en attente */ selvoie (save_voie); svoie[voiecur]->sta.connect = 17; maj_niv (0, 0, 0); #ifdef __FBBDOS__ trait (0, " "); #endif } else { retour_niveau (); retour_menu (pvoie->niv1); } } void yapp_message (int numero) { int save_voie; if (pvoie->kiss == -2) { save_voie = voiecur; selvoie (CONSOLE); texte (numero); aff_etat ('E'); send_buf (CONSOLE); selvoie (save_voie); } else { texte (numero); } } static void yapp_timer (void) { if ((pvoie->niv2 == S) || (pvoie->niv2 == S1)) time_yapp[voiecur] = 20; /* 20 s */ else time_yapp[voiecur] = 120; /* 120 s */ } static void sendinit (void) { int nb; unsigned char buf[20]; /* cprintf("Sendinit\r\n") ; */ pvoie->send_count = 0; buf[0] = ENQ; buf[1] = 1; nb = 2; outs (buf, nb); } void cancel (char *texte) { int nb = strlen (texte); unsigned char buf[257]; buf[0] = CAN; buf[1] = nb; strcpy (buf + 2, texte); outs (buf, nb + 2); ch_niv2 (CW); fin_yapp (); } /* static void not_ready(char *texte) { int nb = strlen(texte) ; unsigned char buf[257] ; buf[0] = NAK ; buf[1] = nb ; strcpy(buf + 2, texte) ; outs(buf, nb + 2) ; } */ static void sendeof (void) { unsigned char buf[2]; buf[0] = ETX; buf[1] = 1; outs (buf, 2); } void sendeot (unsigned char chck) { unsigned char buf[2]; buf[0] = EOT; buf[1] = chck; outs (buf, 2); } static void sendinit_retry (void) { unsigned char buf[2]; if (++pvoie->send_count > 6) { cancel ("Retry count excessive\r"); } else { buf[0] = ENQ; buf[1] = 1; outs (buf, 2); } } long file_size (char *fichier) { struct stat statbuf; if (stat (fichier, &statbuf) != -1) return (statbuf.st_size); return (0L); } static void bin_hdr (char *filename, long filesize) { int nb = 0; int fd; unsigned char buf[257]; unsigned char *ptr = buf; union { unsigned long ytime; struct ftime ftime; } fdir; *ptr++ = SOH; ++ptr; strcpy (ptr, filename); while (*ptr++) ++nb; ++nb; sprintf (ptr, "%7ld", filesize); while (*ptr++) ++nb; ++nb; if (pvoie->type_yapp) { /* Yapp Checksum ? */ if ((fd = open (pvoie->sr_fic, O_RDONLY)) != -1) { getftime (fd, &(fdir.ftime)); sprintf (ptr, "%08lX", fdir.ytime); while (*ptr++) ++nb; ++nb; close (fd); } } buf[1] = nb; outs (buf, nb + 2); } static void sendhdr (char *header) { pvoie->tailm = file_size (pvoie->sr_fic); bin_hdr (header, pvoie->tailm); } static void compute_CRC (int ch, int *crc) { int hibit; int shift; for (shift = 0x80; shift; shift >>= 1) { hibit = *crc & 0x8000; *crc <<= 1; *crc |= (ch & shift ? 1 : 0); if (hibit) *crc ^= 0x1021; } } int senddata (unsigned int type) { int fd, mode, retour = 0, nb = 0; int i; int lg_buf = 250; uchar checksum; uchar *uptr; uchar buf[300]; /* * Type = 0 : Ascii * 1 : Binaire * 2 : YAPP */ if (type == 0) mode = O_TEXT; else mode = O_BINARY; if ((fd = open (pvoie->sr_fic, mode | O_RDONLY)) != -1) { pvoie->sr_mem = 1; lseek (fd, pvoie->enrcur, 0); if (type == 2) aff_yapp (voiecur); while (1) { nb = read (fd, buf + 2, lg_buf); if (nb > 0) { pvoie->size_trans += (long) nb; if (type == 2) { buf[0] = STX; buf[1] = (nb == 256) ? 0 : nb; if (pvoie->type_yapp) { uptr = buf + 2; checksum = 0; for (i = 0; i < nb; i++) checksum += *uptr++; *uptr = checksum; outs (buf, nb + 3); } else { outs (buf, nb + 2); } } else { uptr = buf + 2; if (pvoie->type_yapp == 4) { for (i = 0; i < nb; i++) { compute_CRC ((int) *uptr, (int *) &pvoie->checksum); ++uptr; } } outs (buf + 2, nb); } if (pvoie->memoc >= MAXMEM) break; } /* if (eof (fd)) { pvoie->sr_mem = 0; retour = 1; break; } */ else /* EOF or error */ { pvoie->sr_mem = 0; retour = 1; break; } } pvoie->enrcur = tell (fd); close (fd); } else retour = 1; return (retour); } static void ack1 (void) { unsigned char buf[2]; buf[0] = ACK; buf[1] = 1; outs (buf, 2); pvoie->time_trans = time (NULL); ch_niv2 (RH); } static void ack2 (void) { int i; int nbcar = 0xff & (int) data[1]; unsigned char buf[2]; /* decoder le header */ while (*indd++) ; pvoie->tailm = atol (indd); while (*indd++) --nbcar; --nbcar; if (nbcar) { /* teste Yapp Chck */ for (i = 0; i < 4; i++) { if (!isxdigit (*indd)) break; ++indd; } pvoie->type_yapp = (i == 4); aff_yapp (voiecur); } buf[0] = ACK; if (pvoie->type_yapp) { buf[1] = ACK; } else { buf[1] = 2; } outs (buf, 2); pvoie->time_trans = time (NULL); ch_niv2 (RD); } static void ack3 (void) { unsigned char buf[2]; /* le fichier est valide */ buf[0] = ACK; buf[1] = 3; pvoie->xferok = 2; /* pvoie->time_trans = time(NULL) - pvoie->time_trans; */ write_mess_temp (O_BINARY, voiecur); if (test_temp (voiecur)) { rename_temp (voiecur, pvoie->sr_fic); /* Le fichier est mis en place */ wr_dir (pvoie->sr_fic, pvoie->sta.indicatif.call); } outs (buf, 2); ch_niv2 (RH); } static void ack4 (void) { unsigned char buf[2]; buf[0] = ACK; buf[1] = 4; outs (buf, 2); fin_yapp (); } static void ack5 (void) { unsigned char buf[2]; buf[0] = ACK; buf[1] = 5; outs (buf, 2); ch_niv2 (CW); } /* static int write_fich(char *fichier, char *texte, int nbcar) { FILE * fd ; if (fd = fopen(fichier, "ab")) { fwrite(texte, nbcar, 1, fd) ; fclose(fd) ; return(1) ; } return(0) ; } */ /* static int write_temp(char *texte, int nbcar) { FILE * fd ; char temp[128]; if (fd = fopen(temp_name(voiecur, temp), "ab")) { fwrite(texte, nbcar, 1, fd) ; fclose(fd) ; return(1) ; } return(0) ; } */ void wrbuf (void) { uchar checksum = 0; int i; int ncars; int ok = 1; int nbcar = (data[1]) ? data[1] & 0xff : 256; uchar *uptr; obuf *msgtemp; char *ptcur; char *ptr; if (pvoie->type_yapp) { uptr = data + 2; for (i = 0; i < nbcar; i++) checksum += *uptr++; if (*uptr != checksum) { cancel ("Checksum error\r"); return; } } #if 0 /* if (write_fich(pvoie->sr_fic, data + 2, nbcar)) { */ if (write_temp (data + 2, nbcar)) { pvoie->enrcur += (long) nbcar; /* cprintf("Recoit paquet de %d octets - Nbtrait = %d\r\n", (int) data[1] & 0xff, nb_trait) ; */ ch_niv2 (RD); } else { cancel ("File write error\r"); } #else pvoie->enrcur += (long) nbcar; pvoie->size_trans += (long) nbcar; if ((msgtemp = pvoie->msgtete) != NULL) { while (msgtemp->suiv) msgtemp = msgtemp->suiv; } else { msgtemp = (obuf *) m_alloue (sizeof (obuf)); pvoie->msgtete = msgtemp; msgtemp->nb_car = msgtemp->no_car = 0; msgtemp->suiv = NULL; } ncars = msgtemp->nb_car; ptcur = msgtemp->buffer + ncars; ptr = data + 2; while (nbcar--) { ++pvoie->memoc; *ptcur++ = *ptr++; if (++ncars == 250) { msgtemp->nb_car = ncars; msgtemp->suiv = (obuf *) m_alloue (sizeof (obuf)); msgtemp = msgtemp->suiv; msgtemp->nb_car = msgtemp->no_car = ncars = 0; msgtemp->suiv = NULL; ptcur = msgtemp->buffer; } } msgtemp->nb_car = ncars; if (pvoie->memoc > MAXMEM) { ok = write_mess_temp (O_BINARY, voiecur); } if (ok) { /* cprintf("Recoit paquet de %d octets - Nbtrait = %d\r\n", (int) data[1] & 0xff, nb_trait) ; */ ch_niv2 (RD); } else { cancel ("File write error\r"); } #endif } static void canwait (void) { } static void canrecd (void) { unsigned char buf[2]; clear_outbuf (voiecur); buf[0] = ACK; buf[1] = 5; outs (buf, 2); fin_yapp (); } void out_txt (void) { int lg = 0xff & (int) data[1]; if (lg && !svoie[CONSOLE]->sta.connect) { aff_header (voiecur); aff_bas (voiecur, W_RCVT, data + 2, lg); } } static void yapp_xfer (void) { int old_niv2 = pvoie->niv2; pvoie->lignes = -1; /* Pas de pagination */ ch_niv2 (etat[pvoie->niv2][ptype]); yapp_timer (); switch (pvoie->niv2) { case SA: pvoie->finf.download += (int) (pvoie->size_trans / 1024L); fin_yapp (); break; case S: sendinit (); break; case S1: sendinit_retry (); break; case SH: sendhdr (pvoie->appendf); break; case SD: time_yapp[voiecur] = -1; if (pvoie->kiss == -2) init_timout (CONSOLE); if (senddata (2)) { sendeof (); ch_niv2 (SE); } break; case SE: sendeof (); break; case ST: sendeot (1); break; case CW: canwait (); break; case C: canrecd (); break; case E1: ack1 (); break; case E2: ack2 (); break; case E3: ack3 (); break; case E4: ack4 (); break; case E5: ack5 (); break; case E6: wrbuf (); break; case AB: cancel ("Abort\r"); break; case RP: reprise_yapp (); break; case DP: out_txt (); ch_niv2 (old_niv2); break; case RH: break; default: cancel ("Protocol error\r"); break; } aff_yapp (voiecur); } int dir_ok (char *masque) { int n; char temp[80]; #ifdef __LINUX__ static char chaine[] = "\\*"; #else static char chaine[] = "\\*.*"; #endif strcpy (temp, tot_path (ch_slash (masque), pvoie->dos_path)); n = strlen (temp); if ((n > 3) && (temp[n - 1] == '\\')) temp[n - 1] = '\0'; if (is_dir (temp)) { if (temp[n - 1] == '\\') temp[n - 1] = '\0'; strcat (temp, chaine); } if (findfirst (temp, &(pvoie->dirblk), FA_DIREC)) { texte (T_DOS + 2); return (FALSE); } if (*pvoie->dirblk.ff_name == '.') { findnext (&(pvoie->dirblk)); if (findnext (&(pvoie->dirblk))) { texte (T_DOS + 2); return (FALSE); } } return (TRUE); } static int dir_new_suite (void) { Rlabel rlabel; FILE *fptr; int aff = 0; int lg; char *ptr; char *scan; char cur_dir[80]; pvoie->sr_mem = pvoie->seq = FALSE; /* sprintf(cur_dir, "%c:%s", pvoie->vdisk, pvoie->dos_path); */ if ((fptr = fopen (d_disque ("YAPPLBL.DAT"), "rb")) == NULL) return (2); for (; pvoie->vdisk < 9; ++pvoie->vdisk) { if (*PATH[pvoie->vdisk] == '\0') continue; if ((pvoie->vdisk == 8) && (*pvoie->finf.priv == '\0')) continue; if ((pvoie->temp1 == N_YAPP) && (strncmp (YAPPDIR, PATH[pvoie->vdisk], strlen (PATH[pvoie->vdisk])) != 0)) if (pvoie->temp1 == N_YAPP) { ptr = back2slash(PATH[pvoie->vdisk]); if (strncmp (YAPPDIR, ptr, strlen(ptr)) != 0) continue; } sprintf (cur_dir, "%c:%s", pvoie->vdisk + 'A', pvoie->dos_path); lg = strlen (cur_dir); fseek (fptr, pvoie->enrcur, 0); while (fread (&rlabel, sizeof (Rlabel), 1, fptr)) { int ok = 1; if (rlabel.date_creation < pvoie->noenr_menu) ok = 0; else if (strncmp (rlabel.nomfic, cur_dir, lg) != 0) ok = 0; if ((ok) && (findfirst (tot_path (rlabel.nomfic, pvoie->dos_path), &(pvoie->dirblk), 0) == 0)) { ptr = strrchr (rlabel.nomfic, '\\'); if (ptr == NULL) continue; *ptr = '\0'; scan = rlabel.nomfic; ptr = scan + lg - 1; *scan++ = (pvoie->vdisk == 8) ? 'P' : pvoie->vdisk + 'A'; ++scan; if (strlen (ptr) > 1) { while ((*scan++ = *ptr++) != '\0'); } else *(scan + 1) = '\0'; if (strcmp (rlabel.nomfic, pvoie->appendf) != 0) { strcpy (pvoie->appendf, rlabel.nomfic); cr (); if (pvoie->temp1 == N_YAPP) { out ("YAPP:", 5); out (pvoie->appendf + 2, strlen (pvoie->appendf) - 2); } else { out (pvoie->appendf, strlen (pvoie->appendf)); } cr (); /* outln (":", 1); */ } sprintf (varx[0], "%-20s", pvoie->dirblk.ff_name); if ((pvoie->dirblk.ff_attrib & FA_DIREC) != 0) { var_cpy (1, " "); } else { sprintf (varx[1], "%7ld", pvoie->dirblk.ff_fsize); } var_cpy (2, dir_date (pvoie->dirblk.ff_fdate)); *varx[3] = *varx[4] = '\0'; n_cpy (LABEL_NOM, varx[4], rlabel.label); out (" ", 2); texte (T_YAP + 4); aff = 1; } if (pvoie->memoc >= MAXMEM) { pvoie->sr_mem = TRUE; pvoie->enrcur = ftell (fptr); fclose (fptr); return (0); } } strcpy (pvoie->dos_path, "\\"); pvoie->enrcur = 0; } fclose (fptr); if (!aff) return (2); return (1); } int dir_new (void) { int fin = 0; switch (pvoie->niv3) { case 0: pvoie->temp3 = pvoie->vdisk; pvoie->cmd_new = 1; pvoie->vdisk = 0; pvoie->noenr_menu = pvoie->finf.lastyap; pvoie->enrcur = 0; *pvoie->appendf = '\0'; strcpy (pvoie->dos_path, "\\"); switch (dir_new_suite ()) { case 2: texte (T_DOS + 2); case 1: fin = 1; break; case 0: ch_niv3 (1); break; } break; case 1: if (dir_new_suite () != 0) fin = 1; break; } if (fin) { pvoie->vdisk = pvoie->temp3; retour_dos (); pvoie->temp3 = 0; pvoie->cmd_new = 0; } pvoie->l_yapp = time (NULL); return (1); } static void aff_liste_labels (Fichier * fichier, char *path, int n) { char *ptr; char *lptr; FILE *fptr; Rlabel rlabel; int i; char chemin[80]; char *path_ptr = vir_path (path); /* for (i = 0; i < n; i++) printf("Fichier={%s} Path={%s} n=%d\n", fichier[i].nom, path, n); */ if (path_ptr) { if ((fptr = fopen (d_disque ("YAPPLBL.DAT"), "rb")) != NULL) { while (fread (&rlabel, sizeof (Rlabel), 1, fptr)) { ptr = rlabel.nomfic; n_cpy (79, chemin, ptr); lptr = strrchr (chemin, '\\'); if (lptr == NULL) continue; *(lptr + 1) = '\0'; lptr = strrchr (ptr, '\\'); ++lptr; if (strcmpi (path_ptr, chemin) != 0) continue; for (i = 0; i < n; i++) { if (strcmpi (fichier[i].nom, lptr) == 0) { sprintf (varx[0], "%-20s", fichier[i].nom); if ((fichier[i].attr & FA_DIREC) != 0) { var_cpy (1, " "); } else { sprintf (varx[1], "%7ld", fichier[i].size); } var_cpy (2, dir_date (fichier[i].date)); *varx[3] = *varx[4] = '\0'; n_cpy (LABEL_NOM, varx[4], rlabel.label); texte (T_YAP + 4); fichier[i].nom[0] = '\0'; break; } } } fclose (fptr); } } /* Affiche les fichiers non labelises */ for (i = 0; i < n; i++) { if (*fichier[i].nom) { sprintf (varx[0], "%-20s", fichier[i].nom); if ((fichier[i].attr & FA_DIREC) != 0) { var_cpy (1, " "); } else { sprintf (varx[1], "%7ld", fichier[i].size); } var_cpy (2, dir_date (fichier[i].date)); *varx[3] = *varx[4] = '\0'; texte (T_YAP + 4); } } } #define MAX_FILES 1000 int dir_yapp (char *masque) { int aff = 0; int n; char temp[128]; char *ptr; Fichier *fichier; fichier = (Fichier *) m_alloue (MAX_FILES * sizeof (Fichier)); strcpy (temp, tot_path (ch_slash (masque), pvoie->dos_path)); n = strlen (temp); if ((n > 3) && (temp[n - 1] == '\\')) temp[n - 1] = '\0'; if (is_dir (temp)) { strcat (temp, "\\"); } else { ptr = strrchr (temp, '\\'); if (ptr) *++ptr = '\0'; } if ((*masque == '\0') || (dir_ok (masque))) { n = 0; while (1) { strcpy (fichier[n].nom, pvoie->dirblk.ff_name); fichier[n].size = pvoie->dirblk.ff_fsize; fichier[n].date = pvoie->dirblk.ff_fdate; fichier[n].attr = pvoie->dirblk.ff_attrib; aff = 1; if (++n == MAX_FILES) break; if (findnext (&(pvoie->dirblk))) break; } #ifdef __LINUX__ ptr = slash2back (temp); #else ptr = temp; #endif aff_liste_labels (fichier, ptr, n); if (!aff) texte (T_DOS + 2); } m_libere (fichier, MAX_FILES * sizeof (Fichier)); return (0); } void yapp (void) { char ptr[256]; char *scan; switch (pvoie->niv2) { case 40: scan = get_nextparam(); if (scan) strcpy (ptr, scan); else #ifdef __LINUX__ strcpy (ptr, "*"); #else strcpy (ptr, "*.*"); #endif dir_suite (ptr); retour_dir ((YAPPDIR[1] == ':') ? (YAPPDIR[0] - 'A') : getdisk ()); break; case 42: scan = get_nextparam(); if (scan) strcpy (ptr, scan); else #ifdef __LINUX__ strcpy (ptr, "*"); #else strcpy (ptr, "*.*"); #endif dir_yapp (ptr); retour_dir ((YAPPDIR[1] == ':') ? (YAPPDIR[0] - 'A') : getdisk ()); break; case 43: maj_niv (9, 12, 0); dir_new (); break; case 50: set_binary (voiecur, 0); if (!pvoie->xferok) del_temp (voiecur); else if (pvoie->xferok == 2) { /* ltoa(pvoie->enrcur, varx[0], 10) ; texte(T_DOS + 5) ; */ display_perf (voiecur); } aff_yapp (voiecur); pvoie->xferok = 1; aff_header (voiecur); retour_appel (); break; case 51: var_cpy (0, "YAPP"); new_label (); pvoie->tailm = pvoie->enrcur = 0L; pvoie->size_trans = 0L; ch_niv2 (R); texte (T_YAP + 1); set_binary (voiecur, 1); pvoie->xferok = 0; del_temp (voiecur); yapp_timer (); aff_yapp (voiecur); break; case 52: change_label (); retour_appel (); break; default: yapp_xfer (); break; } } char *nom_yapp (void) { char fichier[MAXPATH], dr[MAXDIR], di[MAXDIR], fi[MAXFILE], ex[MAXEXT]; teste_espace (); n_cpy (80, fichier, indd); if (!tst_point (fichier)) *pvoie->sr_fic = '\0'; else { #ifdef __LINUX__ strcpy (pvoie->sr_fic, slash2back (tot_path (ch_slash (fichier), pvoie->dos_path))); #else strcpy (pvoie->sr_fic, tot_path (ch_slash (fichier), pvoie->dos_path)); #endif fnsplit (fichier, dr, di, fi, ex); strcpy (pvoie->appendf, fi); strcat (pvoie->appendf, ex); } return (pvoie->sr_fic); } static void change_label (void) { char *ptr; ptr = get_nextparam(); if (ptr) { w_label (pvoie->sr_fic, ptr); cr(); dir_yapp(pvoie->appendf); } } void new_label (void) { while ((*indd) && (!ISPRINT (*indd))) ++indd; w_label (pvoie->sr_fic, sup_ln (indd)); n_cpy (LABEL_NOM - 1, pvoie->label, sup_ln (indd)); } int menu_yapp (void) { struct stat bufstat; char buf[80]; int ok = 1; int c, fd; if (ISGRAPH (*(indd + 1))) return (0); if (pvoie->temp1 != N_DOS) strcpy (pvoie->dos_path, "\\"); var_cpy (0, "YAPP"); limite_commande (); // strupr (sup_ln (indd - 1)); n_cpy (78, buf, indd); c = *indd++; switch (toupper(c)) { case 'D': if ((voiecur == CONSOLE) || ((!P_YAPP (voiecur)) && (!SYS (pvoie->finf.flags)))) { /* ok = 0; */ yapp_message (T_YAP + 2); retour_appel (); break; } #ifdef MULTI if (ymodem_files ()) { ch_niv2 (S); if (pvoie->kiss != -2) texte (T_YAP + 0); pvoie->tailm = pvoie->enrcur = 0L; pvoie->size_trans = 0L; set_binary (voiecur, 1); pvoie->xferok = 1; pvoie->type_yapp = 1; sendinit (); yapp_timer (); aff_yapp (voiecur); } #else if ((tst_point (indd)) && (stat (nom_yapp (), &bufstat) != -1) && ((bufstat.st_mode & S_IFREG) != 0)) { ch_niv2 (S); if (pvoie->kiss != -2) texte (T_YAP + 0); pvoie->tailm = pvoie->enrcur = 0L; pvoie->size_trans = 0L; set_binary (voiecur, 1); pvoie->xferok = 1; pvoie->type_yapp = 1; sendinit (); yapp_timer (); aff_yapp (voiecur); } else { /* ok = 0; */ yapp_message (T_ERR + 11); retour_appel (); } #endif break; case 'U': if (!is_room ()) { outln ("*** Disk full !", 15); retour_appel (); break; } if ((voiecur == CONSOLE) || ((!P_YAPP (voiecur)) && (!SYS (pvoie->finf.flags)))) { yapp_message (T_YAP + 2); /* ok = 0; */ retour_appel (); break; } if (read_only ()) { retour_appel (); } else if (!isspace (*indd)) { /* ok = 0; */ yapp_message (T_ERR + 20); retour_appel (); } else { if ((tst_point (indd)) && (stat (nom_yapp (), &bufstat) == -1)) { /* fd = creat (pvoie->sr_fic, S_IREAD | S_IWRITE); */ fd = open (pvoie->sr_fic, O_CREAT | O_WRONLY | O_TRUNC, S_IREAD | S_IWRITE); if (fd > 0) { close (fd); unlink (pvoie->sr_fic); if (pvoie->kiss != -2) { yapp_message (T_YAP + 3); ch_niv2 (51); } else { pvoie->tailm = pvoie->enrcur = 0L; pvoie->size_trans = 0L; ch_niv2 (R); set_binary (voiecur, 1); pvoie->xferok = 0; pvoie->type_yapp = 0; yapp_timer (); aff_yapp (voiecur); } } else { /* ok = 0; */ yapp_message (T_ERR + 30); retour_appel (); } } else { /* ok = 0; */ yapp_message (T_ERR + 23); retour_appel (); } } break; case 'W': ch_niv2 (40); pvoie->noenr_menu = 0L; yapp (); break; case 'N': ch_niv2 (43); pvoie->noenr_menu = pvoie->finf.lastyap; yapp (); pvoie->l_yapp = time (NULL); break; case 'I': ch_niv2 (42); pvoie->noenr_menu = 0L; yapp (); break; case 'L': teste_espace(); if (droits (MODLABEL)) { if (*indd == '\0') { texte (T_ERR + 20); retour_appel (); } else if (!aut_ecr (indd, 0)) { retour_appel (); } else { if (stat (nom_yapp (), &bufstat) != 0) { texte (T_ERR + 11); retour_appel (); } else { texte (T_YAP + 3); ch_niv2 (52); } } } else { /* retour_niveau(); cmd_err(indd - 2) ; */ ok = 0; } break; case 'Z': strcpy (pvoie->appendf, indd); nom_yapp (); if (aut_dir (pvoie->sr_fic, pvoie->sta.indicatif.call)) { if (stat (pvoie->sr_fic, &bufstat) != -1) { if (unlink (pvoie->sr_fic) == 0) texte (T_DOS + 10); else texte (T_ERR + 23); retour_appel (); } else { texte (T_ERR + 11); retour_appel (); } } else { texte (T_ERR + 23); /* ok = 0; */ retour_niveau (); } break; default: /* retour_niveau(); cmd_err(indd - 2) ; */ --indd; ok = 0; break; } if (ok) fbb_log (voiecur, 'Y', buf); return (ok); } fbb-7.04j/src/xfbbC.c0100644000175100017510000003400007726646105012373 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /********************************************** * * * xfbbC : Client for xfbbd BBS daemon version * * * **********************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "terminal.h" #define CONSOLE 0 #define MONITOR 1 #define ALLCHAN 2 static char *usage = "Usage: xfbbC [-c | -m channel] [-d] [-f] [-h hostname] [-p port] [-i mycall] [-w password]\n" "-c : console connection\n" "-d file : download remote configuration file\n" "-f : data filtering. Control characters are discarded\n" "-h address : hostname address of the xfbbd server\n" "-i mycall : callsign used for connection\n" "-m channel : displays a connected channel (0 = all channels)\n" "-p port : IP port number (default 3286)\n" "-r : don't use curses\n" "-l : display remote directory\n" "-s svc_nb : request service number\n" "-u file : upload configuration file\n" "-w password: password of the callsign as defined in passwd.sys\n" "\nEnvironment variables :\n" "\tXFBBC_HOST : hostname (default localhost)\n" "\tXFBBC_PORT : socket port (default 3286)\n" "\tXFBBC_CALL : my callsign\n" "\tXFBBC_PASS : password string of passwd.sys in xfbbd\n\n"; void makekey (char *cle, char *pass, char *buffer); static int open_connection (char *tcp_addr, int tcp_port, int mask) { int sock; struct sockaddr_in sock_addr; struct hostent *phe; if ((sock = socket (AF_INET, SOCK_STREAM, 0)) < 0) { perror ("socket_r"); return (0); } if ((phe = gethostbyname (tcp_addr)) == NULL) { perror ("gethostbyname"); return (-1); } sock_addr.sin_family = AF_INET; sock_addr.sin_port = htons (tcp_port); memcpy ((char *) &sock_addr.sin_addr, phe->h_addr, phe->h_length); if (connect (sock, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) == -1) { perror ("connect"); close (sock); return (-1); } return (sock); } static int do_filter (char *ptr, int len) { char *scan = ptr; int lg = 0; while (len) { if ((*ptr == '\n') || isprint (*ptr)) scan[lg++] = *ptr; ++ptr; --len; } return (lg); } static int send_file(int sock, char *filename) { int fd; int nb; char buffer[1024]; buffer[0] = ORB_REQUEST; buffer[1] = 3; fd = open(filename, O_RDONLY); if (fd == -1) { buffer[2] = 0; buffer[3] = 0; write(sock, buffer, 4); return errno; } for (;;) { nb = read(fd, buffer+4, 1000); if (nb < 0) nb = 0; buffer[2] = nb % 256; buffer[3] = nb >> 8; write(sock, buffer, nb+4); printf("%d data sent\n", nb); if (nb == 0) break; } close(fd); return 0; } int main (int ac, char *av[]) { char host[80]; char pass[256]; char key[256]; char mycall[80]; char filename[256]; char arg[256]; char buffer[1024]; char *ptr; int len; int s; int nb; int console; int service; int transfer; int filelen = 0; int filetotal; int channel; int sock; int mask = 0; int debug = 0; int filter = 0; int use_curses = 1; int port; int mode; fprintf (stderr, "\nClient application for xfbbd v3.2 ( help : xfbbC -? )\n\n"); if ((ptr = getenv ("XFBBC_HOST"))) strcpy (host, ptr); else strcpy (host, "localhost"); if ((ptr = getenv ("XFBBC_PORT"))) port = atoi (ptr); else port = 3286; if ((ptr = getenv ("XFBBC_PASS"))) strcpy (pass, ptr); else strcpy (pass, "password"); if ((ptr = getenv ("XFBBC_CALL"))) strcpy (mycall, ptr); else strcpy (mycall, "nocall"); console = 0; channel = 0; mask = ORB_MONITOR; transfer = 0; service = 0; while ((s = getopt (ac, av, "cfd:h:i:l:m:p:rs:u:w:?")) != -1) { switch (s) { case 'h': strcpy (host, optarg); break; case 'd': strcpy (filename, optarg); transfer = SVC_RECV; mask = 0; break; case 'u': strcpy (filename, optarg); transfer = SVC_SEND; mask = 0; break; case 'l': strcpy (filename, optarg); transfer = SVC_DIR; mask = 0; break; case 'f': filter = 1;; break; case 'p': port = atoi (optarg); break; case 'w': strcpy (pass, optarg); break; case 'i': strcpy (mycall, optarg); break; case 'c': console = 1; mask = ORB_CONSOLE; break; case 'm': channel = atoi (optarg); mask = ORB_CHANNEL; break; case 'r': use_curses = 0; break; case 's': service = atoi (optarg); break; case ':': fprintf (stderr, "xfbbC: option needs an argument\n"); return 1; case '?': fprintf (stderr, usage); return 1; } } if (debug && !transfer) { /* if -d option, ask all services */ mask |= (ORB_MSGS | ORB_STATUS | ORB_NBCNX | ORB_LISTCNX); } fprintf(stderr, "Connecting %s ... ", host); fflush(stdout); sock = open_connection (host, port, mask); if (sock == -1) { fprintf (stderr, "Cannot connect xfbbd\n"); return 0; } fprintf (stderr, " Ok\n"); sprintf (buffer, "%d %d %s\n", mask, channel, mycall); write (sock, buffer, strlen (buffer)); fprintf (stderr, "Authentication in progress ... "); fflush (stderr); nb = read (sock, buffer, 20); if (nb <= 0) { fprintf (stderr, "Connection closed. Terminating\n"); return (0); } buffer[nb] = '\0'; sscanf (buffer, "%s", key); fprintf (stderr, " Ok\n"); makekey (key, pass, buffer); strcat (buffer, "\n"); write (sock, buffer, strlen (buffer)); mode = 0; if (mask & ORB_CONSOLE) { mode = 1; fprintf (stderr, "Console connection ...\n\n"); } if (mask & ORB_CHANNEL) fprintf (stderr, "Monitoring channel %d ...\n\n", channel); if (mask & ORB_MONITOR) fprintf (stderr, "Monitoring all ports ...\n\n"); if (transfer) { len = strlen(filename); switch(transfer) { case SVC_DIR: fprintf (stderr, "Requesting directory %s ...\n\n", filename); buffer[0] = ORB_REQUEST; buffer[1] = SVC_DIR; buffer[2] = len; buffer[3] = 0; strcpy(buffer+4, filename); write(sock, buffer, len+4); break; case SVC_RECV: fprintf (stderr, "Requesting file %s ...\n\n", filename); buffer[0] = ORB_REQUEST; buffer[1] = SVC_RECV; buffer[2] = len; buffer[3] = 0; strcpy(buffer+4, filename); write(sock, buffer, len+4); break; case SVC_SEND: fprintf (stderr, "Sending file %s ...\n\n", filename); buffer[0] = ORB_REQUEST; buffer[1] = SVC_SEND; buffer[2] = len; buffer[3] = 0; strcpy(buffer+4, filename); write(sock, buffer, len+4); send_file(sock, filename); break; } filename[0] = '\0'; filelen = 0; } else if (service) { switch(service) { case SVC_FWD: strcpy(buffer+4, "LIST"); len = 4; fprintf (stderr, "Requesting Pending Forward ...\n\n"); buffer[0] = ORB_REQUEST; buffer[1] = SVC_FWD; buffer[2] = len; buffer[3] = 0; write(sock, buffer, len+4); break; case SVC_DISC: sprintf(buffer+4, "01 F6FBB-1 0"); len = strlen(buffer+4); fprintf (stderr, "Requesting Disconnection ...\n\n"); buffer[0] = ORB_REQUEST; buffer[1] = SVC_DISC; buffer[2] = len; buffer[3] = 0; write(sock, buffer, len+4); break; } } else { sprintf(buffer, " xfbbC V3.01 - Callsign : %s - Remote host : %s", mycall, host); #ifdef USE_NCURSES if (use_curses) init_terminal(mode, buffer); else #endif fprintf (stderr, "%s\n", buffer); } for (;;) { fd_set sock_read; FD_ZERO (&sock_read); FD_SET (STDIN_FILENO, &sock_read); FD_SET (sock, &sock_read); /* Wait for I/O event */ if (select (sock + 1, &sock_read, NULL, NULL, NULL) == -1) { perror ("select"); break; } if (FD_ISSET (STDIN_FILENO, &sock_read)) { #ifdef USE_NCURSES if (use_curses) nb = read_terminal(buffer, sizeof(buffer)); else { #endif nb = read (STDIN_FILENO, buffer, sizeof (buffer)); if (nb == -1) { perror ("read"); break; } #ifdef USE_NCURSES } #endif nb = write (sock, buffer, nb); if (nb == -1) { perror ("read"); break; } } if (FD_ISSET (sock, &sock_read)) { unsigned char header[4]; unsigned int service; unsigned int command; unsigned int len; unsigned int total; char *ptr; /* Read header first. Be sure the 4 bytes are read */ for (total = 0; total < 4;) { nb = read (sock, header + total, 4 - total); if (nb == -1) { perror ("read"); break; } if (nb == 0) { printf ("Connection closed. Terminating\n"); #ifdef USE_NCURSES if (use_curses) end_terminal(); #endif return (0); } total += nb; } service = (unsigned int) header[0]; command = (unsigned int) header[1]; len = ((unsigned int) header[3] << 8) + (unsigned int) header[2]; /* printf("\nservice=%d command=%d len=%d : ", service, command, len); fflush(stdout);*/ /* Read the data following the header. Be sure all bytes are read */ for (total = 0; total < len;) { nb = read (sock, buffer + total, len - total); if (nb == -1) { perror ("read"); break; } if (nb == 0) { printf ("Connection closed. Terminating\n"); #ifdef USE_NCURSES if (use_curses) end_terminal(); #endif return (0); } total += nb; } if (total == 0) { return 0; /* end of transfer */ } else { /* decodes and displays the services */ switch (service) { case ORB_CONSOLE: case ORB_MONITOR: case ORB_CHANNEL: if (total > 3) { /* skip color and header information */ total -= 3; ptr = buffer + 3; if (filter) total = do_filter (ptr, total); #ifdef USE_NCURSES if (use_curses) write_terminal(ptr, total); else #endif write (1, ptr, total); } break; case ORB_MSGS: { int nbPriv, nbHeld, nbTotal; buffer[total] = '\0'; sscanf (buffer, "%d %d %d", &nbPriv, &nbHeld, &nbTotal); if (debug) printf ("Messages : Priv %d Held %d Total %d\n", nbPriv, nbHeld, nbTotal); } break; case ORB_STATUS: { int MemUsed, MemAvail, Disk1, Disk2; buffer[total] = '\0'; sscanf (buffer, "%d %d %d %d", &MemUsed, &MemAvail, &Disk1, &Disk2); if (debug) printf ("Status : LMemUsed %d GMemUsed %dk Disk1 %dk Disk2 %dk\n", MemUsed, MemAvail, Disk1, Disk2); } break; case ORB_NBCNX: buffer[total] = '\0'; if (debug) printf ("Nb Conn : %s\n", buffer); break; case ORB_LISTCNX: buffer[total] = '\0'; if (debug) printf ("ConnLine :%s\n", buffer); break; case ORB_DATA: switch (command) { case SVC_LIST: /* int i; printf("Implemented services :\n"); for (i = 0 ; i < total ; i++) printf(" %d : %s\n", buffer[i] & 0xff, service_name(buffer[i])); */ break; case SVC_DIR: buffer[total] = '\0'; if (filename[0] == '\0') { filelen = filetotal = 0; strcpy(filename, buffer); sscanf(buffer+strlen(filename)+1, "%d", &filetotal); } else { filelen += total; write(STDOUT_FILENO, buffer, total); } fprintf(stderr, "receiving directory %s %d/%d bytes\n", filename, filelen, filetotal); break; case SVC_RECV: buffer[total] = '\0'; if (filename[0] == '\0') { filelen = filetotal = 0; strcpy(filename, buffer); sscanf(buffer+strlen(filename)+1, "%d", &filetotal); } else { filelen += total; write(STDOUT_FILENO, buffer, total); } fprintf(stderr, "receiving file %s %d/%d bytes\n", filename, filelen, filetotal); break; case SVC_FWD: buffer[total] = '\0'; if (filename[0] == '\0') { filelen = filetotal = 0; *arg = '\0'; sscanf(buffer, "%s %s", filename, arg); sscanf(buffer+strlen(buffer)+1, "%d", &filetotal); if (*arg) fprintf(stderr, "%s : %s\n", filename, arg); } else { filelen += total; write(STDOUT_FILENO, buffer, total); } if (filetotal) fprintf(stderr, "receiving fwd list %s %d/%d bytes\n", filename, filelen, filetotal); break; } break; } } } } close (sock); #ifdef USE_NCURSES if (use_curses) end_terminal(); #endif printf ("Abnormal termination\n"); return (1); } #define PROTOTYPES 1 #include "global.h" #include "md5.h" void MD5String (unsigned char *dest, unsigned char *source) { int i; MD5_CTX context; unsigned char digest[16]; unsigned int len = strlen (source); MD5Init (&context); MD5Update (&context, source, len); MD5Final (digest, &context); *dest = '\0'; for (i = 0; i < 16; i++) { char tmp[5]; sprintf (tmp, "%02X", digest[i]); strcat (dest, tmp); } } void makekey (char *cle, char *pass, char *buffer) { char source[1024]; strcpy (source, cle); strcat (source, pass); MD5String (buffer, source); } fbb-7.04j/src/X11/0042755000175100017510000000000007726646105011564 5ustar abaabafbb-7.04j/src/X11/xfbbabtd.c0100644000175100017510000004077507726646105013514 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include static Widget about_dialog = NULL; static Widget copy_dialog = NULL; static Widget info_dialog = NULL; static Widget call_dialog = NULL; static int info_canal; static struct { char str[256]; char prenom[13]; char home[41]; stat_ch sta; int niv1, niv2, niv3, canal, nbmess, nbnew, paclen, memoc; unsigned flags; } prev; static Widget IYapp; static Widget ICall; static Widget IDigis; static Widget IName; static Widget IHome; static Widget IChannel; static Widget IPort; static Widget IN1N2N3; static Widget IFlags; static Widget IPaclen; static Widget IStatus; static Widget IMem; static Widget IBuf; static Widget IRet; static Widget IPerso; static Widget IUnread; static XmString StringCreate(char *text) { XmString xmstr; char *deb; if ((text == NULL) || (text[0] == '\0')) { return(XmStringCreateSimple("")); } xmstr = (XmString)NULL; deb = text; while (*text) { if (*text == '\n') { *text = '\0'; xmstr = XmStringConcat(xmstr, XmStringCreateSimple(deb)); xmstr = XmStringConcat(xmstr, XmStringSeparatorCreate()); *text++ = '\n'; deb = text; } else ++text; } if (*deb) { xmstr = XmStringConcat(xmstr, XmStringCreateSimple(deb)); } return(xmstr); } static char *XVersion(int dat) { static char prodVersion[80]; char sdate[30]; if (dat) sprintf(sdate, " (%s)", date()); else *sdate = '\0'; sprintf(prodVersion, "%s%s", version(), sdate) ; return(prodVersion); } static void OkCB(Widget w, XtPointer client_data, XtPointer call_data) { Widget *pw; pw = (Widget *)client_data; XtUnmanageChild(*pw); XtDestroyWidget(XtParent(*pw)); *pw = NULL;; } static void ApplyCB(Widget w, XtPointer client_data, XtPointer call_data) { Widget *pw; Widget wt; char *ptr; pw = (Widget *)client_data; /* wt = XmSelectionBoxGetChild(call_dialog, XmDIALOG_TEXT); */ wt = XmSelectionBoxGetChild(*pw, XmDIALOG_TEXT); ptr = XmTextGetString(wt); if (!set_callsign(ptr)) { char texte[80]; sprintf(texte, "%s is not a valid callsign !", ptr); MessageBox(60, texte, "Change callsign", MB_ICONEXCLAMATION|MB_OK); get_callsign(texte); XmTextSetString(wt, texte); } else { XtUnmanageChild(*pw); XtDestroyWidget(XtParent(*pw)); *pw = NULL;; } XtFree(ptr); } void CallsignDialog(Widget w, XtPointer client_data, XtPointer call_data) { char buffer[512]; Arg args[20] ; Cardinal n; if (call_dialog) { /* Dialog deja ouvert, on le passe devant */ XRaiseWindow(XtDisplay(call_dialog),XtWindow(XtParent(call_dialog))); return; } n = 0; XtSetArg(args[n], XmNautoUnmanage, FALSE);n++; XtSetArg(args[n], XmNmessageAlignment, XmALIGNMENT_CENTER);n++; call_dialog = XmCreatePromptDialog(toplevel, "callsign", args, n); XtManageChild(XmSelectionBoxGetChild(call_dialog, XmDIALOG_APPLY_BUTTON)); XtUnmanageChild(XmSelectionBoxGetChild(call_dialog, XmDIALOG_OK_BUTTON)); XtUnmanageChild(XmSelectionBoxGetChild(call_dialog, XmDIALOG_HELP_BUTTON)); XtAddCallback(call_dialog, XmNapplyCallback, ApplyCB, (XtPointer)&call_dialog); XtAddCallback(call_dialog, XmNcancelCallback, OkCB, (XtPointer)&call_dialog); get_callsign(buffer); XmTextSetString(XmSelectionBoxGetChild(call_dialog, XmDIALOG_TEXT), buffer); XtManageChild(call_dialog); } void AboutDialog(Widget w, XtPointer client_data, XtPointer call_data) { char buffer[512]; Arg args[20] ; Cardinal n; XmString string; if (about_dialog) { /* Dialog deja ouvert, on le passe devant */ XRaiseWindow(XtDisplay(about_dialog),XtWindow(XtParent(about_dialog))); return; } sprintf(buffer, "XFBB (Linux version)\n\nVersion %s\n\n" "Copyright 1986-1996. All rights reserved." #ifdef BETA "\n\n" "This version is only for test purpose.\n" "Do not distribute without the author's agreement." #endif "\n", XVersion(TRUE)); string = StringCreate(buffer); n = 0; XtSetArg(args[n], XmNautoUnmanage, FALSE);n++; XtSetArg(args[n], XmNmessageAlignment, XmALIGNMENT_CENTER);n++; XtSetArg(args[n], XmNmessageString, string);n++; about_dialog = XmCreateMessageDialog(toplevel, "about", args, n); XmStringFree(string); XtUnmanageChild(XmMessageBoxGetChild(about_dialog, XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild(XmMessageBoxGetChild(about_dialog, XmDIALOG_HELP_BUTTON)); XtAddCallback(about_dialog, XmNokCallback, OkCB, (XtPointer)&about_dialog); XtManageChild(about_dialog); } void CopyDialog(Widget w, XtPointer client_data, XtPointer call_data) { char buffer[1024]; Arg args[20] ; Cardinal n; XmString string; if (copy_dialog) { /* Dialog deja ouvert, on le passe devant */ XRaiseWindow(XtDisplay(copy_dialog),XtWindow(XtParent(copy_dialog))); return; } sprintf(buffer, "\n" " AX25 BBS software - XFBB version %s\n" " (C) F6FBB 1986-1996 (%s)\n\n" "This software is in the public domain. It can be copied or\n" "installed only for amateur use abiding by the laws.\n\n" "All commercial or professional use is prohibited.\n\n" "F6FBB (Jean-Paul ROUBELAT) declines any responsibilty\n" "in the use of XFBB software.\n\n" "This software is free of charge, but a 100 FF or 20 US $\n" "(or more) contribution will be appreciated.\n\n", XVersion(0), date() ) ; string = StringCreate(buffer); n = 0; XtSetArg(args[n], XmNautoUnmanage, FALSE);n++; XtSetArg(args[n], XmNmessageString, string);n++; copy_dialog = XmCreateMessageDialog(toplevel, "copyright", args, n); XmStringFree(string); XtUnmanageChild(XmMessageBoxGetChild(copy_dialog, XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild(XmMessageBoxGetChild(copy_dialog, XmDIALOG_HELP_BUTTON)); XtAddCallback(copy_dialog, XmNokCallback, OkCB, (XtPointer)©_dialog); XtManageChild(copy_dialog); } static void ShowCB(Widget w, XtPointer client_data, XtPointer call_data) { printf("ShowCB\n"); if (info_canal != -1) ShowFbbWindow(info_canal, toplevel); } static Widget CreateInfoLabel(Widget parent, char *name, char *val, uchar alig) { Arg args[10]; Cardinal n; /* XmString string; */ Widget w; n = 0; /* string = XmStringCreateSimple(val); XtSetArg(args[n], XmNlabelString, string);n++; */ XtSetArg(args[n], XmNalignment, alig);n++; XtSetArg(args[n], XmNmarginHeight, 0);n++; w = XmCreateLabel(parent, name, args, n); /* XmStringFree(string); */ XtManageChild(w); return(w); } void InfoDialog(Widget w, XtPointer client_data, XtPointer call_data) { Arg args[20] ; Cardinal n; Widget rc; int nb; /* Lecture du canal courant */ nb = GetChList(); if (nb != -1) info_canal = nb; if (info_dialog) { /* Dialog deja ouvert, on le passe devant */ XRaiseWindow(XtDisplay(info_dialog),XtWindow(XtParent(info_dialog))); return; } if (nb == -1) return; memset(&prev, 0xff, sizeof(prev)); n = 0; XtSetArg(args[n], XmNmarginHeight, 5);n++; XtSetArg(args[n], XmNmarginWidth, 5);n++; XtSetArg(args[n], XmNautoUnmanage, FALSE);n++; info_dialog = XmCreateFormDialog(toplevel, "infos", args, n); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 20);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 40);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(info_dialog, "show", args, n); XtAddCallback(w, XmNactivateCallback, ShowCB , 0); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 60);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 80);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(info_dialog, "close", args, n); XtAddCallback(w, XmNactivateCallback, OkCB, (XtPointer)&info_dialog); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, w);n++; XtSetArg(args[n], XmNbottomOffset, 10);n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);n++; IYapp = XmCreateLabel(info_dialog, "info_label", args, n); XtManageChild(IYapp); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, IYapp);n++; XtSetArg(args[n], XmNpacking, XmPACK_COLUMN);n++; XtSetArg(args[n], XmNnumColumns, 2);n++; XtSetArg(args[n], XmNmarginHeight, 0);n++; XtSetArg(args[n], XmNisAligned, FALSE);n++; rc = XmCreateRowColumn(info_dialog, "rc_info", args, n); CreateInfoLabel(rc, "callsign", "Callsign :", XmALIGNMENT_END); CreateInfoLabel(rc, "digis", "Digis :", XmALIGNMENT_END); CreateInfoLabel(rc, "name", "Name :", XmALIGNMENT_END); CreateInfoLabel(rc, "home_bbs", "Home BBS :", XmALIGNMENT_END); CreateInfoLabel(rc, "l_separator", "", XmALIGNMENT_END); CreateInfoLabel(rc, "channel", "Channel :", XmALIGNMENT_END); CreateInfoLabel(rc, "port", "Port :", XmALIGNMENT_END); CreateInfoLabel(rc, "n1_n2_n3", "N1,N2,N3 :", XmALIGNMENT_END); CreateInfoLabel(rc, "flags", "Flags :", XmALIGNMENT_END); CreateInfoLabel(rc, "paclen", "Paclen :", XmALIGNMENT_END); CreateInfoLabel(rc, "status", "Status :", XmALIGNMENT_END); CreateInfoLabel(rc, "l_separator", "", XmALIGNMENT_END); CreateInfoLabel(rc, "mem_used", "Memory used :", XmALIGNMENT_END); CreateInfoLabel(rc, "buffers", "Buffers :", XmALIGNMENT_END); CreateInfoLabel(rc, "retries", "Retries :", XmALIGNMENT_END); CreateInfoLabel(rc, "l_separator", "", XmALIGNMENT_END); CreateInfoLabel(rc, "priv_msg", "Personnal messages :", XmALIGNMENT_END); CreateInfoLabel(rc, "unread_msg", "Unread messages :", XmALIGNMENT_END); ICall = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); IDigis = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); IName = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); IHome = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); CreateInfoLabel(rc, "r_separator", "", XmALIGNMENT_BEGINNING); IChannel = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); IPort = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); IN1N2N3 = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); IFlags = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); IPaclen = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); IStatus = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); CreateInfoLabel(rc, "r_separator", "", XmALIGNMENT_BEGINNING); IMem = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); IBuf = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); IRet = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); CreateInfoLabel(rc, "r_separator", "", XmALIGNMENT_BEGINNING); IPerso = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); IUnread = CreateInfoLabel(rc, "info_data", "", XmALIGNMENT_BEGINNING); XtManageChild(rc); DisplayInfoDialog(nb); XtManageChild(info_dialog); } static void InfoLabel(Widget w, char *txt) { XmString string; string = XmStringCreateSimple(txt); XtVaSetValues(w, XmNlabelString, string, NULL); XmStringFree(string); } void DisplayInfoDialog(int voie) { int i; char str[256]; char call[80]; indicat *ind; if ((info_dialog == NULL) || (voie != info_canal)) return; ind = &svoie[info_canal]->sta.indicatif; if (memcmp(ind, &prev.sta.indicatif, sizeof(indicat)) != 0) { prev.sta.indicatif = *ind; if (ind->num) sprintf(call, "%s-%d", ind->call, ind->num); else sprintf(call, "%s", ind->call); InfoLabel(ICall, call); *str = '\0'; for (i = 0 ; i < 2 ; i++) { ind = &svoie[info_canal]->sta.relais[i]; if (*(ind->call)) { if (ind->num) sprintf(call, "%s-%d", ind->call, ind->num); else sprintf(call, "%s", ind->call); if (i > 0) strcat(str, ","); strcat(str, call); } } ind = &svoie[info_canal]->sta.relais[i]; if (*(ind->call)) strcat(str, ",..."); InfoLabel(IDigis, str); } if (strcmp(prev.prenom, svoie[info_canal]->finf.prenom) != 0) { strcpy(prev.prenom, svoie[info_canal]->finf.prenom); InfoLabel(IName, svoie[info_canal]->finf.prenom); } if (strcmp(prev.home, svoie[info_canal]->finf.home) != 0) { strcpy(prev.home, svoie[info_canal]->finf.home); InfoLabel(IHome, svoie[info_canal]->finf.home); } if (info_canal != prev.canal) { prev.canal = info_canal; InfoLabel(IChannel, itoa((info_canal > 0) ? info_canal-1 : info_canal, str, 10)); InfoLabel(IPort, itoa(no_port(info_canal), str, 10)); } if ((svoie[info_canal]->niv1 != prev.niv1) || (svoie[info_canal]->niv2 != prev.niv2) || (svoie[info_canal]->niv3 != prev.niv3)) { prev.niv1 = svoie[info_canal]->niv1; prev.niv2 = svoie[info_canal]->niv2; prev.niv3 = svoie[info_canal]->niv3; sprintf(str, "%02d %02d %02d", svoie[info_canal]->niv1, svoie[info_canal]->niv2, svoie[info_canal]->niv3); InfoLabel(IN1N2N3, str); } if (svoie[info_canal]->finf.flags != prev.flags) { prev.flags = svoie[info_canal]->finf.flags; InfoLabel(IFlags, strflags(&svoie[info_canal]->finf)); } if (svoie[info_canal]->paclen != prev.paclen) { prev.paclen = svoie[info_canal]->paclen; InfoLabel(IPaclen, itoa(svoie[info_canal]->paclen, str, 10)); } if (svoie[info_canal]->sta.stat != prev.sta.stat) { prev.sta.stat = svoie[info_canal]->sta.stat; InfoLabel(IStatus, stat_voie(info_canal)); } if (svoie[info_canal]->memoc != prev.memoc) { prev.memoc = svoie[info_canal]->memoc; InfoLabel(IMem, itoa(svoie[info_canal]->memoc, str, 10)); } if (svoie[info_canal]->sta.ack != prev.sta.ack) { prev.sta.ack = svoie[info_canal]->sta.ack; InfoLabel(IBuf, itoa(svoie[info_canal]->sta.ack, str, 10)); } if (svoie[info_canal]->sta.ret != prev.sta.ret) { prev.sta.ret = svoie[info_canal]->sta.ret; InfoLabel(IRet, itoa(svoie[info_canal]->sta.ret, str, 10)); } if (svoie[info_canal]->ncur) { if (svoie[info_canal]->ncur->nbmess != prev.nbmess) { prev.nbmess = svoie[info_canal]->ncur->nbmess; InfoLabel(IPerso, itoa(svoie[info_canal]->ncur->nbmess, str, 10)); } if (svoie[info_canal]->ncur->nbnew != prev.nbnew) { prev.nbnew = svoie[info_canal]->ncur->nbnew; InfoLabel(IUnread, itoa(svoie[info_canal]->ncur->nbnew, str, 10)); } } else { InfoLabel(IPerso, ""); InfoLabel(IUnread, ""); } if (svoie[info_canal]->niv1 == N_YAPP) yapp_str(info_canal, str); #ifndef __LINUX__ else if (svoie[info_canal]->niv1 == N_MOD) xmodem_str(info_canal, str); #endif else if (svoie[info_canal]->niv1 == N_BIN) abin_str(info_canal, str); else if (svoie[info_canal]->niv1 == N_XFWD) xfwd_str(info_canal, str); else *str = '\0'; if (strcmp(str, prev.str) != 0) { strcpy(prev.str, str); InfoLabel(IYapp, str); } } fbb-7.04j/src/X11/xfbbcnsl.c0100755000175100017510000007341607726646105013542 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef struct { char text[82]; int pos_bis; long color; long color_bis; } Line; typedef struct { Widget drawing; Widget scroll; Widget frame; Widget edit; Widget line1; Widget line2; Widget line3; int premier; int nblignes; int scrollpos; int totlignes; int curligne; int curcol; Line *winbuf; } WinInfo; void HideFbbWindow(int numero, Widget parent); static WinInfo *cnsl[TOTVOIES]; static Display *display = NULL; static XFontStruct *fontinfo = NULL; static GC dgc = NULL; static long ColorVal[W_NCOL]; static int sysop_on = FALSE; static Widget CallDialog; #define NB_HISTO 20 static int histo_pos; static char history[NB_HISTO][82]; static void free_buffer(int numero); static void alloc_buffer(int numero, int nblig); #include void cursor_wait(void) { static Cursor lcursor = 0; if (lcursor == 0) { lcursor = XCreateFontCursor(display, XC_watch); } XDefineCursor(display, XtWindow(toplevel), lcursor); } void end_wait(void) { XUndefineCursor(display, XtWindow(toplevel)); } void resizeCB(Widget w, XtPointer data, XtPointer call) { Arg args[20] ; Cardinal n; Dimension val; int pos; WinInfo *info = (WinInfo *)data; n = 0; XtSetArg(args[n], XmNheight, &val);n++; XtGetValues(info->drawing, args, n); info->nblignes = val / (fontinfo->ascent + fontinfo->descent); if (info->premier == info->curligne) { pos = info->totlignes - info->nblignes; } else { int offset; offset = info->curligne - info->premier; if (offset < 0) offset += info->totlignes; if (offset > (info->totlignes - info->nblignes)) { offset = info->totlignes - info->nblignes; info->premier = info->curligne - offset; if (info->premier < 0) info->premier += info->totlignes; } pos = info->totlignes - info->nblignes - offset; if (pos < 0) pos += info->totlignes; } n = 0; XtSetArg(args[n], XmNpageIncrement, info->nblignes); n++; XtSetArg(args[n], XmNsliderSize, info->nblignes); n++; XtSetArg(args[n], XmNmaximum, info->totlignes); n++; XtSetArg(args[n], XmNvalue, pos); n++; XtSetValues(info->scroll, args, n); XClearArea(display, XtWindow(info->drawing),0, 0, 0, 0, TRUE); } void refreshCB(Widget w, XtPointer data, XtPointer call) { int height; int offset; int i; int pos; WinInfo *info = (WinInfo *)data; offset = fontinfo->ascent; height = fontinfo->ascent + fontinfo->descent; pos = info->premier - info->nblignes + 1; if (pos < 0) pos += info->totlignes; for (i = 0 ; i < info->nblignes ; i++) { char *ptr = info->winbuf[pos].text; if (info->winbuf[pos].pos_bis == 0) { XSetForeground(display, dgc, info->winbuf[pos].color); XDrawImageString(display, XtWindow(w), dgc, 5,offset + i * height, ptr, 80); } else { int largeur; /* 1ere couleur */ XSetForeground(display, dgc, info->winbuf[pos].color); XDrawImageString(display, XtWindow(w), dgc, 5,offset + i * height, ptr, info->winbuf[pos].pos_bis); largeur = XTextWidth(fontinfo, ptr, info->winbuf[pos].pos_bis); /* 2eme couleur */ ptr = info->winbuf[pos].text + info->winbuf[pos].pos_bis; XSetForeground(display, dgc, info->winbuf[pos].color_bis); XDrawImageString(display, XtWindow(w), dgc, 5 + largeur, offset + i * height, ptr, 80 - info->winbuf[pos].pos_bis); } ++pos; if (pos >= info->totlignes) pos = 0; } } void scrollCB(Widget w, XtPointer data, XtPointer call) { Arg args[20] ; Cardinal n; int val; int offset; WinInfo *info = (WinInfo *)data; n = 0; XtSetArg(args[n], XmNvalue, &val);n++; XtGetValues(w, args, n); offset = info->totlignes - (val + info->nblignes); info->premier = info->curligne - offset ; if (info->premier < 0) info->premier += info->totlignes; XClearArea(display, XtWindow(info->drawing),0, 0, 1, 1, TRUE); } void quitCB(Widget w, XtPointer data, XtPointer call) { } void scroll_window(WinInfo *info) { Arg args[20] ; Cardinal n; int pos; int modscroll = 1; if (info->premier == info->curligne) { /* debut de buffer (ligne courante) */ ++info->premier; if (info->premier == info->totlignes) info->premier = 0; modscroll = 0; } ++info->curligne; if (info->curligne == info->totlignes) info->curligne = 0; pos = info->curligne + info->nblignes - 1; if (pos > info->totlignes) pos -= info->totlignes; if (info->premier == pos) { /* fin de buffer */ ++info->premier; if (info->premier == info->totlignes) info->premier = 0; modscroll = 2; } if (modscroll != 1) { if (info->frame) { refreshCB(info->drawing, (XtPointer)info, NULL); /* XClearArea(display, XtWindow(info->drawing),0, 0, 1, 1, TRUE); */ /* XFlush(display); */ /* XSync(display,0); */ } } else if (info->frame) { /* mettre le scrollbar a jour */ int pos; int offset; offset = info->curligne - info->premier; if (offset < 0) offset += info->totlignes; pos = info->totlignes - info->nblignes - offset; if (pos < 0) pos += info->totlignes; n = 0; XtSetArg(args[n], XmNvalue, pos); n++; XtSetValues(info->scroll, args, n); } } static void x_write(char *data, int len, int color, int numero) { int pos; int cr; int i; int c; int reste = 1; char *ptr; long xcolor = ColorVal[color]; WinInfo *info = cnsl[numero]; if (info == NULL) return; pos = info->curcol; ptr = info->winbuf[info->curligne].text; cr = 0; if (info->frame) XSetForeground(display, dgc, xcolor); if ((pos) && (xcolor != info->winbuf[info->curligne].color)) { info->winbuf[info->curligne].color_bis = xcolor; info->winbuf[info->curligne].pos_bis = pos; } else info->winbuf[info->curligne].color = xcolor; for(i = 0 ; i < len ; i++) { c = *data++; if (c == '\n') continue; if (c == '\r') { int cpos; if (*data == '\n') { --len; ++data; } cpos = info->curligne + 1; if (cpos >= info->totlignes) cpos = 0; ptr = info->winbuf[cpos].text; ptr[80] = '\0'; memset(ptr, 0x20, 80); info->winbuf[cpos].color = xcolor; info->winbuf[cpos].pos_bis = 0; reste = 0; scroll_window(info); pos = 0; } else { reste = 1; ptr[pos] = c; ++pos; if (pos == 80) { int cpos; cpos = info->curligne + 1; if (cpos >= info->totlignes) cpos = 0; ptr = info->winbuf[cpos].text; ptr[80] = '\0'; memset(ptr, 0x20, 80); info->winbuf[cpos].color = xcolor; info->winbuf[cpos].pos_bis = 0; reste = 0; scroll_window(info); pos = 0; } } } info->curcol = pos; if ((info->frame) && (info->premier == info->curligne) && reste) { char *cptr = info->winbuf[info->curligne].text; int offset = fontinfo->ascent; int height = fontinfo->ascent + fontinfo->descent; XDrawImageString(display, XtWindow(info->drawing), dgc, 5, offset + (info->nblignes - 1) * height, cptr, 80); /* sleep(1); */ } } void window_write(int numero, char *data, int len, int color, int header) { if ((numero > 0) && (numero != MMONITOR) && ((numero != INEXPORT) || (aff_inexport))) { x_write(data, len, color, ALLCHAN); } if (!header) { x_write(data, len, color, numero); } } long dos2pixel(int couleur) { static int xcolor[16]; couleur &= 0xf; if (xcolor[couleur] == 0) { Colormap cmap; XColor color; unsigned long mask; int r, g, b; int val; unsigned long pixel; val = (couleur & 0x8) ? 0xff : 0x80; if (couleur == 7) r = g = b = 0xc0; else if (couleur == 8) r = g = b = 0x80; else { r = g = b = 0; if (couleur & 1) r = val; if (couleur & 2) g = val; if (couleur & 4) b = val; } cmap = DefaultColormap(display, DefaultScreen(display)); if (XAllocColorCells(display, cmap, FALSE, &mask, 0, &pixel, 1)) { color.pixel = pixel; color.red = r << 8; color.green = g << 8; color.blue = b << 8; color.flags = DoRed|DoGreen|DoBlue; XStoreColor(display, cmap, &color); xcolor[couleur] = pixel; } else printf("Cannot alloc color %x in colormap\n", couleur); } return(xcolor[couleur]); } void set_win_colors(void) { ColorVal[W_SNDT] = dos2pixel(SEND); ColorVal[W_RCVT] = dos2pixel(RECV); ColorVal[W_CHNI] = dos2pixel(INDIC); ColorVal[W_MONH] = dos2pixel(HEADER); ColorVal[W_MOND] = dos2pixel(UI); ColorVal[W_CNST] = dos2pixel(CONS); ColorVal[W_BACK] = dos2pixel(FOND_VOIE); ColorVal[W_STAT] = dos2pixel(STA); /* Couleur status */ ColorVal[W_DEFL] = dos2pixel(DEF); /* Couleur status */ /* ColorVal[W_VOIE] = dos2pixel(VOIE); Couleur voies */ ColorVal[W_VOIE] = dos2pixel(INDIC); /* Couleur voies */ /* Raffraichit les fenetres existantes for (int i = 0 ; i < TOTVOIES ; i++) { if (Visu->Display[i]) { Visu->Display[i]->SetBkgndColor(FbbApp->ColorVal[W_BACK]); Visu->Display[i]->Invalidate(); } } */ } void window_connect(int numero) { char buf[80]; WinInfo *info; if (cnsl[numero] == NULL) alloc_buffer(numero, 100); info= cnsl[numero]; if ((numero > 0) && (numero < MMONITOR)) { char ssid[20]; int num; num = (numero == INEXPORT) ? 99 : numero-1; if (svoie[numero]->sta.indicatif.num) sprintf(ssid, "-%d", svoie[numero]->sta.indicatif.num); else *ssid = '\0'; sprintf(buf, "Channel %d : %s%s", num, svoie[numero]->sta.indicatif.call, ssid); if (info->frame) { Arg args[1] ; XtSetArg(args[0], XmNtitle, buf); XtSetValues(info->frame, args, 1); } if (numero > 0) { sprintf(buf, "%d:%s%s", num, svoie[numero]->sta.indicatif.call, ssid); /* FbbApp->UpdateWindowMenu(numero, buf, 2); */ } } } void window_disconnect(int numero) { WinInfo *info= cnsl[numero]; if (info == NULL) return; if ((numero > 0) && (numero != MMONITOR)) { char buf[80]; int num; num = (numero == INEXPORT) ? 99 : numero-1; sprintf(buf, "Channel %d : None", num); if (info->frame) { Arg args[1]; XtSetArg(args[0], XmNtitle, buf); XtSetValues(info->frame, args, 1); } if (numero > 0) { sprintf(buf, "%d:None", num); /* FbbApp->UpdateWindowMenu(numero, buf, 2); */ } if (!info->frame) free_buffer(numero); } if (numero == CurrentSelection) CurrentSelection = -1; } void window_init(void) { int i; for (i = 0 ; i < TOTVOIES ; i++) { cnsl[i] = NULL; } display = XtDisplay(toplevel); /* Visu = new TVisus(); InitBuffers(); */ } int get_win_lig(int numero) { WinInfo *info = cnsl[numero]; if (info) return (info->nblignes); return(25); } static void free_buffer(int numero) { if (cnsl[numero]) { free(cnsl[numero]->winbuf); free(cnsl[numero]); cnsl[numero] = NULL; } } static void alloc_buffer(int numero, int nblig) { int i; if (cnsl[numero] == NULL) { WinInfo *info = (WinInfo *) calloc(sizeof(WinInfo), 1); if (info == NULL) { printf("cannot allocate buffer for channel %d\n", numero); exit(2); } info->winbuf = (Line *)calloc(sizeof(Line), nblig); info->totlignes = nblig; info->nblignes = 25; for (i = 0; i < nblig ; i++) { info->winbuf[i].text[80] = '\0'; memset(info->winbuf[i].text, 0x20, 80); info->winbuf[i].color = 0; info->winbuf[i].color_bis = 0; info->winbuf[i].pos_bis = 0; } cnsl[numero] = info; } } void sysop_end_chat(void) { if (v_tell) { selvoie(CONSOLE) ; maj_niv(0, 0, 0) ; pvoie->sta.connect = FALSE ; selvoie(v_tell) ; maj_niv(pvoie->sniv1, pvoie->sniv2, pvoie->sniv3) ; prompt(pvoie->finf.flags, pvoie->niv1) ; pvoie->seq = v_tell = 0 ; } } int sysop_chat(void) { if ((!svoie[CONSOLE]->sta.connect) && (svoie[v_tell]->sta.connect)) { ShowFbbWindow(CONSOLE, toplevel); selvoie(CONSOLE) ; pvoie->sta.connect = 16 ; pvoie->deconnect = FALSE ; pvoie->pack = 0; pvoie->read_only = 0; pvoie->vdisk = 2; pvoie->xferok = 1; pvoie->mess_recu = 1 ; pvoie->mbl = 0; init_timout(CONSOLE) ; pvoie->temp3 = 0 ; pvoie->nb_err = 0; pvoie->finf.lang = langue[0]->numlang ; init_langue(voiecur) ; maj_niv(N_MBL, 9, 2) ; selvoie(v_tell) ; init_langue(voiecur) ; maj_niv(N_MBL, 9, 2) ; texte(T_MBL + 15) ; return(1); } return(0); } static void CallOkCB(Widget w, XtPointer client_data, XtPointer call_data) { sysop_chat(); sysop_end(); } static void CallCancelCB(Widget w, XtPointer client_data, XtPointer call_data) { sysop_end(); } void sysop_end(void) { if (sysop_on) { XtUnmanageChild(CallDialog); XtDestroyWidget(CallDialog); sysop_on = FALSE; } } void sysop_call(char *texte) { Arg args[20] ; Cardinal n; XmString string; if (!sysop_on) { sysop_on = TRUE; string = XmStringCreateSimple(texte); /* Cree la fenetre de l'appel */ n = 0; XtSetArg(args[n], XmNautoUnmanage, FALSE);n++; XtSetArg(args[n], XmNtitle, "Sysop call");n++; XtSetArg(args[n], XmNmessageString, string);n++; CallDialog = XmCreateMessageDialog(toplevel, "call_dialog", args, n); XtAddCallback(CallDialog, XmNokCallback, CallOkCB, NULL); XtAddCallback(CallDialog, XmNcancelCallback, CallCancelCB, NULL); XtUnmanageChild(XmMessageBoxGetChild(CallDialog, XmDIALOG_HELP_BUTTON)); XtManageChild(CallDialog); XmStringFree(string); } } static void deleteCB(Widget w, XtPointer data, XtPointer call) { int numero = (int)data; HideFbbWindow(numero, NULL); if (numero == CONSOLE) { sysop_end_chat(); /* Deconnecter la console si connectee */ if (svoie[CONSOLE]->sta.connect) deconnexion(CONSOLE, 0); } else if ((numero != ALLCHAN) && (numero != MMONITOR) && (!svoie[numero]->sta.connect)) { free_buffer(numero); } if (numero > 0) { /* FbbApp->UpdateWindowMenu(Numero, NULL, 0); */ } } /* static void focusCB(Widget w, XtPointer data, XtPointer call) { WinInfo *info = (WinInfo *)data; XtSetKeyboardFocus(w, info->edit); } */ /* static void modifCB(Widget w, XtPointer data, XtPointer call) { printf("ModifCB\n"); } */ static void editCB(Widget w, XtPointer data, XtPointer call) { char *ptr; char buffer[82]; WinInfo *info = (WinInfo *)data; ptr = XmTextFieldGetString(info->line2); XmTextFieldSetString(info->line3, ptr); ptr = XmTextFieldGetString(info->line1); XmTextFieldSetString(info->line2, ptr); ptr = XmTextFieldGetString(info->edit); XmTextFieldSetString(info->line1, ptr); XmTextFieldSetString(info->edit,""); strcpy(buffer, ptr); if (++histo_pos == NB_HISTO) histo_pos = 0; strcpy(history[histo_pos], buffer); strcat(buffer, "\r"); window_write(CONSOLE, buffer, strlen(buffer), W_CNST, 0); console_inbuf(buffer, strlen(buffer)); } static void KeyEV(Widget w, XtPointer data, XKeyEvent *event) { int i; int lg; int code; char *ptr; XmTextPosition pos; WinInfo *info = (WinInfo *)data; code = event->keycode; if (event->state & 1) code |= 0x100; /* shift */ if (event->state & 4) code |= 0x400; /* control */ if (event->state & 8) code |= 0x800; /* alt */ switch(event->keycode) { case 0x009 : /* escape */ ptr = XmTextFieldGetString(info->edit); if (strlen(ptr) == 0) { /* commande Esc */ console_inbuf("\033\r", 2); } else { /* Efface la commande en cours */ XmTextFieldSetString(info->edit, ""); } XtFree(ptr); break; case 0x062 : /* UP */ case 0x162 : /* Shift-UP */ /* ligne precedente */ for (i = 0 ; i < NB_HISTO ; i++) { char *ptr = history[histo_pos]; if (histo_pos == 0) histo_pos = NB_HISTO; --histo_pos; if (*ptr) { XmTextFieldSetString(info->edit, ptr); XmTextFieldSetInsertionPosition(info->edit, 80); break; } } break; case 0x068 : /* DW */ case 0x168 : /* Shift-DW */ /* ligne suivante */ for (i = 0 ; i < NB_HISTO ; i++) { if (++histo_pos == NB_HISTO) histo_pos = 0; if (*history[histo_pos]) { XmTextFieldSetString(info->edit,history[histo_pos]); XmTextFieldSetInsertionPosition(info->edit, 80); break; } } break; case 0x462 : /* Ctrl-UP */ /* Scroll UP */ break; case 0x468 : /* Ctrl-DW */ /* scroll DW */ break; case 0x063 : /* PUP */ case 0x163 : /* Shift-PUP */ break; case 0x069 : /* PDW */ case 0x169 : /* Shift-PDW */ break; case 0x463 : /* Ctrl-PUP */ break; case 0x469 : /* Ctrl-PDW */ break; } /* Teste la fin de ligne */ pos = XmTextFieldGetInsertionPosition(info->edit); lg = XmTextFieldGetMaxLength(info->edit); if (pos == lg) { char *scan; ptr = XmTextFieldGetString(info->edit); scan = strrchr(ptr, ' '); if (scan) { *scan++ = '\0'; } XmTextFieldSetString(info->edit, ptr); editCB(w, info, NULL); if ((scan) && (*scan)) { XmTextFieldSetString(info->edit, scan); XmTextFieldSetInsertionPosition(info->edit, 80); } XtFree(ptr); } } WinInfo *xcnsl(int numero, Widget pere, int nblig, Arg *argp, Cardinal np) { Arg args[20] ; Cardinal n; Pixel foreground; Pixel background; Widget form; WinInfo *info; int mask; XGCValues values; Dimension hg; Widget separe; int console = (numero == CONSOLE) ; if (cnsl[numero] == NULL) alloc_buffer(numero, nblig); info = cnsl[numero]; form = XmCreateForm(pere, "form", argp, np); /* XtAddCallback(form, XmNfocusCallback, focusCB, info); */ if (display == NULL) display = XtDisplay(form); if (fontinfo == NULL) fontinfo = XLoadQueryFont(display, "6x10"); if (console) { XmFontList fontlist; memset(history, 0, NB_HISTO * 82); fontlist = XmFontListCreate(fontinfo, XmSTRING_DEFAULT_CHARSET); n = 0; XtSetArg(args[n], XmNleftAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNbottomAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNmarginHeight,0); n++; XtSetArg(args[n], XmNmaxLength,78); n++; XtSetArg(args[n], XmNshadowThickness,0); n++; XtSetArg(args[n], XmNhighlightThickness,0); n++; XtSetArg(args[n], XmNfontList,fontlist); n++; info->edit = XmCreateTextField(form, "edit", args, n); XtManageChild(info->edit); n = 0; XtSetArg(args[n], XmNleftAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNbottomAttachment,XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNbottomWidget,info->edit); n++; XtSetArg(args[n], XmNeditable,FALSE); n++; XtSetArg(args[n], XmNmarginHeight,0); n++; /* XtSetArg(args[n], XmNmarginWidth,0); n++;*/ XtSetArg(args[n], XmNshadowThickness,0); n++; XtSetArg(args[n], XmNhighlightThickness,0); n++; XtSetArg(args[n], XmNcursorPositionVisible,FALSE); n++; XtSetArg(args[n], XmNfontList,fontlist); n++; info->line1 = XmCreateTextField(form, "line1", args, n); XtManageChild(info->line1); XtSetKeyboardFocus(info->line1, info->edit); n = 0; XtSetArg(args[n], XmNleftAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNbottomAttachment,XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNbottomWidget,info->line1); n++; XtSetArg(args[n], XmNeditable,FALSE); n++; XtSetArg(args[n], XmNmarginHeight,0); n++; /* XtSetArg(args[n], XmNmarginWidth,0); n++; */ XtSetArg(args[n], XmNshadowThickness,0); n++; XtSetArg(args[n], XmNhighlightThickness,0); n++; XtSetArg(args[n], XmNcursorPositionVisible,FALSE); n++; XtSetArg(args[n], XmNfontList,fontlist); n++; info->line2 = XmCreateTextField(form, "line2", args, n); XtManageChild(info->line2); XtSetKeyboardFocus(info->line2, info->edit); n = 0; XtSetArg(args[n], XmNleftAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNbottomAttachment,XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNbottomWidget,info->line2); n++; XtSetArg(args[n], XmNeditable,FALSE); n++; XtSetArg(args[n], XmNmarginHeight,0); n++; /* XtSetArg(args[n], XmNmarginWidth,0); n++; */ XtSetArg(args[n], XmNshadowThickness,0); n++; XtSetArg(args[n], XmNhighlightThickness,0); n++; XtSetArg(args[n], XmNcursorPositionVisible,FALSE); n++; XtSetArg(args[n], XmNfontList,fontlist); n++; info->line3 = XmCreateTextField(form, "line3", args, n); XtManageChild(info->line3); XtSetKeyboardFocus(info->line3, info->edit); n = 0; XtSetArg(args[n], XmNleftAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNbottomAttachment,XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNbottomWidget,info->line3); n++; separe = XmCreateSeparator(form, "separator", args, n); XtManageChild(separe); XtAddCallback(info->edit, XmNactivateCallback, editCB, (XtPointer)info); /* XtAddCallback(info->edit, XmNmodifyVerifyCallback, modifCB, info); */ XtAddEventHandler(info->edit, KeyPressMask, FALSE, (XtEventHandler)KeyEV, (XtPointer)info); XmFontListFree(fontlist); XtSetKeyboardFocus(form, info->edit); n = 0; XtSetArg(args[n], XmNbottomAttachment,XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNbottomWidget,separe); n++; XtSetArg(args[n], XmNrightAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNtopAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNmaximum,nblig); n++; info->scroll = XmCreateScrollBar(form, "scroll", args, n); XtManageChild(info->scroll); n = 0; XtSetArg(args[n], XmNbottomAttachment,XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNbottomWidget,separe); n++; } else { n = 0; XtSetArg(args[n], XmNbottomAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNtopAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNmaximum,nblig); n++; info->scroll = XmCreateScrollBar(form, "scroll", args, n); XtManageChild(info->scroll); n = 0; XtSetArg(args[n], XmNbottomAttachment,XmATTACH_FORM); n++; } XtSetArg(args[n], XmNtopAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNleftAttachment,XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment,XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNrightWidget,info->scroll); n++; XtSetArg(args[n], XmNwidth,500); n++; XtSetArg(args[n], XmNheight,200); n++; info->drawing = XmCreateDrawingArea(form, "drawing", args, n); XtManageChild(info->drawing); XtManageChild(form); XtSetKeyboardFocus(info->drawing, info->edit); n = 0; XtSetArg(args[n], XmNforeground, &foreground); n++; XtSetArg(args[n], XmNbackground, &background); n++; XtSetArg(args[n], XmNheight, &hg);n++; XtGetValues(info->drawing, args, n); /* info->premier = 0; */ mask = GCForeground | GCBackground | GCFont; values.background = background; values.foreground = foreground; values.font = fontinfo->fid; if (dgc == NULL) dgc = XtGetGC(info->drawing, mask, &values); XtAddCallback(info->scroll, XmNvalueChangedCallback, scrollCB, info); XtAddCallback(info->scroll, XmNdragCallback, scrollCB, info); XtAddCallback(info->drawing, XmNexposeCallback, refreshCB, info); XtAddCallback(info->drawing, XmNresizeCallback, resizeCB, info); info->nblignes = hg / (fontinfo->ascent + fontinfo->descent); n = 0; XtSetArg(args[n], XmNpageIncrement, info->nblignes); n++; XtSetArg(args[n], XmNsliderSize, info->nblignes); n++; XtSetArg(args[n], XmNmaximum, info->totlignes); n++; XtSetArg(args[n], XmNvalue, info->totlignes - info->nblignes); n++; XtSetValues(info->scroll, args, n); return(info); } void ShowFbbWindow(int numero, Widget parent) { WinInfo*info; if (cnsl[numero] == NULL) alloc_buffer(numero, 100); info = cnsl[numero]; if (info->frame) { if (XtIsManaged(info->frame)) { XRaiseWindow(XtDisplay(info->frame),XtWindow(info->frame)); } else XtManageChild(info->frame); } else { Arg args[20] ; Cardinal n; Atom DelWindow; char buf[80]; if (numero == CONSOLE) { sprintf(buf, "Console"); } else if (numero == MMONITOR) { sprintf(buf, "Monitoring"); } else if (numero == ALLCHAN) { sprintf(buf, "All channels"); } else { char ssid[20]; int num; num = (numero == INEXPORT) ? 99 : numero-1; /* Fenetres canaux ...*/ if (svoie[numero]->sta.indicatif.num) sprintf(ssid, "-%d", svoie[numero]->sta.indicatif.num); else *ssid = '\0'; sprintf(buf, "Channel %d : %s%s", num, svoie[numero]->sta.indicatif.call, ssid); } n = 0; XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); ++n; XtSetArg(args[n], XmNtitle, buf); ++n; info->frame = XmCreateDialogShell(parent, "cnsl", args, n); xcnsl(numero, info->frame, 100, NULL, 0); XtManageChild(info->frame); DelWindow = XInternAtom(display, "WM_DELETE_WINDOW", FALSE); XmAddWMProtocolCallback(info->frame, DelWindow, deleteCB, (XtPointer)numero); } } void HideFbbWindow(int numero, Widget parent) { if ((cnsl[numero]) && (cnsl[numero]->frame) && (XtIsManaged(cnsl[numero]->frame))) { XtUnmanageChild(cnsl[numero]->frame); } } void ToggleFbbWindow(int numero, Widget parent) { if ((cnsl[numero]) && (cnsl[numero]->frame) && (XtIsManaged(cnsl[numero]->frame))) { HideFbbWindow(numero, parent); } else { ShowFbbWindow(numero, parent); } } #ifdef __TEST__ XtAppContext app_context; int connected; static void TimeoutEvent(XtPointer data, XtIntervalId *Id) { static int i=0; char text[82]; sprintf(text, "Bonjour numero %d. Je suis une ligne ! * ", i++); window_write(1, text, strlen(text), i%16, 0); if (connected) XtAppAddTimeOut(app_context, 500L, TimeoutEvent, NULL); } void ConnectCB(Widget w, XtPointer data, XtPointer call) { if (!connected) { window_connect(1); XtAppAddTimeOut(app_context, 500L, TimeoutEvent, 0); } connected = TRUE; } void DisconnectCB(Widget w, XtPointer data, XtPointer call) { window_disconnect(1); connected = FALSE; } void ShowCB(Widget w, XtPointer data, XtPointer call) { ShowFbbWindow(1, (Widget)data); } void HideCB(Widget w, XtPointer data, XtPointer call) { HideFbbWindow(1, (Widget)data); } void ToggleCB(Widget w, XtPointer data, XtPointer call) { ToggleFbbWindow(1, (Widget)data); } main(int ac, char **av) { Arg args[20] ; Cardinal n; Widget toplevel; Widget rc; Widget bp; svoie[1] = (Svoie *)calloc(sizeof(Svoie), 1); strcpy(svoie[1]->sta.indicatif.call, "F6FBB"); svoie[1]->sta.indicatif.num = 1; SEND = 0; RECV = 2; INDIC = 3; UI = 4; CONS = 5; FOND_VOIE = 6; HEADER = 7; toplevel = XtAppInitialize(&app_context, "TM", NULL, 0, &ac, av, NULL,NULL, 0); n = 0; XtSetArg(args[n], XmNallowShellResize, True);n++; XtSetValues(toplevel, args, n); rc = XmCreateRowColumn(toplevel, "rc", NULL, 0); bp = XmCreatePushButton(rc, "Connect", NULL, 0); XtAddCallback(bp, XmNactivateCallback, ConnectCB, toplevel); XtManageChild(bp); bp = XmCreatePushButton(rc, "Disconnect", NULL, 0); XtAddCallback(bp, XmNactivateCallback, DisconnectCB, toplevel); XtManageChild(bp); bp = XmCreatePushButton(rc, "Show", NULL, 0); XtAddCallback(bp, XmNactivateCallback, ShowCB, toplevel); XtManageChild(bp); bp = XmCreatePushButton(rc, "Hide", NULL, 0); XtAddCallback(bp, XmNactivateCallback, HideCB, toplevel); XtManageChild(bp); bp = XmCreatePushButton(rc, "Toggle", NULL, 0); XtAddCallback(bp, XmNactivateCallback, ToggleCB, toplevel); XtManageChild(bp); XtManageChild(rc); /* alloc_buffer(0); cnsl[0] = xcnsl(toplevel,100, NULL, 0); */ XtRealizeWidget(toplevel); display = XtDisplay(toplevel); set_win_colors(); /* Main Loop */ XtAppMainLoop(app_context); } #endif fbb-7.04j/src/X11/xfbbedtm.c0100644000175100017510000006232607726646105013527 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include static Widget MsgList; static Widget EditMsgDialog; static Widget From; static Widget Bid; static Widget To; static Widget Via; static Widget Title; static Widget Sent; static Widget Recv; static Widget Size; static Widget EditFwdDialog; static Widget tog_w; static Widget tog_d; static Widget fwd_toggle[NBBBS]; static int fwd_t_val[NBBBS]; static Widget Type[4]; static Widget Stat[7]; static Widget Data; static int on_w; static int on_d; static Pixel color_w; static Pixel color_d; static bullist bullig; static void EditFwdStatus(void); void EditMsgCB(Widget w, XtPointer client_data, XtPointer call_data) { if (XtIsManaged(EditMsgDialog)) { /* Passer la fenetre au 1er plan */ XRaiseWindow(XtDisplay(EditMsgDialog),XtWindow(XtParent(EditMsgDialog))); return; } cursor_wait(); printf("EditMsgCB\n"); FbbRequestMessageList(); XmListSelectPos(MsgList, 1, TRUE); /* XmListSetBottomPos(MsgList, 0); */ XtManageChild(EditMsgDialog); end_wait(); } static void ApplyCB(Widget w, XtPointer client_data, XtPointer call_data) { TextFieldGetString(From, bullig.exped, 6, TRUE); TextFieldGetString(Bid, bullig.bid, 12, TRUE); TextFieldGetString(To, bullig.desti, 6, TRUE); TextFieldGetString(Via, bullig.bbsv, 40, TRUE); TextFieldGetString(Title,bullig.titre, 60, FALSE); if (XmToggleButtonGetState(Type[0])) bullig.type = 'A'; if (XmToggleButtonGetState(Type[1])) bullig.type = 'B'; if (XmToggleButtonGetState(Type[2])) bullig.type = 'P'; if (XmToggleButtonGetState(Type[3])) bullig.type = 'T'; if (XmToggleButtonGetState(Stat[0])) bullig.status = '$'; if (XmToggleButtonGetState(Stat[1])) bullig.status = 'N'; if (XmToggleButtonGetState(Stat[2])) bullig.status = 'Y'; if (XmToggleButtonGetState(Stat[3])) bullig.status = 'F'; if (XmToggleButtonGetState(Stat[4])) bullig.status = 'X'; if (XmToggleButtonGetState(Stat[5])) bullig.status = 'K'; if (XmToggleButtonGetState(Stat[6])) bullig.status = 'A'; SetMsgInfo(&bullig, bullig.numero); } static void CloseCB(Widget w, XtPointer client_data, XtPointer call_data) { printf("CloseCB\n"); XtUnmanageChild((Widget)client_data); XmListDeleteAllItems(MsgList); } static void EditFwdCB(Widget w, XtPointer client_data, XtPointer call_data) { printf("EditFwdCB\n"); EditFwdStatus(); } static void EditTxtCB(Widget w, XtPointer client_data, XtPointer call_data) { char nom[80]; char numero[40]; char msgname[256]; printf("EditTxtCB\n"); sprintf(numero, "Msg #%ld", bullig.numero); strcpy(msgname, mess_name(MessPath(), bullig.numero, nom)); EditorOff = FALSE; CreateEditor(msgname, NULL, numero, 0, TRUE); } static void SelectCB(Widget w, XtPointer client_data, XtPointer call_data) { XmListCallbackStruct *cd = (XmListCallbackStruct *)call_data; char *text; long nb; char buf[80]; XmStringGetLtoR(cd->item, XmSTRING_DEFAULT_CHARSET, &text); sscanf(text, "%ld", &nb); printf("SelectCB %ld\n", nb); if (!GetMsgInfos(&bullig, nb)) return; XmTextFieldSetString(From, bullig.exped); XmTextFieldSetString(To, bullig.desti); XmTextFieldSetString(Via, bullig.bbsv); XmTextFieldSetString(Title, bullig.titre); XmTextFieldSetString(Bid, bullig.bid); sprintf(buf,"%ld", bullig.taille); XmTextFieldSetString(Size, buf); XmTextFieldSetString(Recv, strdt(bullig.date)); XmTextFieldSetString(Sent, strdt(bullig.datesd)); XmToggleButtonSetState(Type[0], (bullig.type == 'A'), FALSE); XmToggleButtonSetState(Type[1], (bullig.type == 'B'), FALSE); XmToggleButtonSetState(Type[2], (bullig.type == 'P'), FALSE); XmToggleButtonSetState(Type[3], (bullig.type == 'T'), FALSE); XmToggleButtonSetState(Stat[0], (bullig.status == '$'), FALSE); XmToggleButtonSetState(Stat[1], (bullig.status == 'N'), FALSE); XmToggleButtonSetState(Stat[2], (bullig.status == 'Y'), FALSE); XmToggleButtonSetState(Stat[3], (bullig.status == 'F'), FALSE); XmToggleButtonSetState(Stat[4], (bullig.status == 'X'), FALSE); XmToggleButtonSetState(Stat[5], (bullig.status == 'K'), FALSE); XmToggleButtonSetState(Stat[6], (bullig.status == 'A'), FALSE); XmToggleButtonSetState(Data, (bullig.bin), FALSE); } void EditMessage(Widget toplevel) { Arg args[20] ; Cardinal n; Widget rcl; Widget rcr; Widget rc2; Widget rc3; Widget rc4; Widget w; Widget f; Widget rcTitle; Widget rcVia; Widget rcType; Widget rcData; Widget rcStat; n = 0; XtSetArg(args[n], XmNmarginHeight, 5);n++; XtSetArg(args[n], XmNmarginWidth, 5);n++; XtSetArg(args[n], XmNautoUnmanage, FALSE);n++; EditMsgDialog = XmCreateFormDialog(toplevel, "edit_msg", args, n); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 2);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 22);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(EditMsgDialog, "apply", args, n); XtAddCallback(w, XmNactivateCallback, ApplyCB, 0); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 27);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 47);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(EditMsgDialog, "edit_fwd", args, n); XtAddCallback(w, XmNactivateCallback, EditFwdCB, 0); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 52);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 72);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(EditMsgDialog, "edit_text", args, n); XtAddCallback(w, XmNactivateCallback, EditTxtCB, 0); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 77);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 97);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(EditMsgDialog, "close", args, n); XtAddCallback(w, XmNactivateCallback, CloseCB, (XtPointer)EditMsgDialog); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, w);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rcTitle = XmCreateRowColumn(EditMsgDialog, "rcTitle", args, n); n = 0; XtSetArg(args[n], XmNwidth, 40);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rcTitle, "title", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 40);n++; Title = XmCreateTextField(rcTitle, "TextF", args, n); XtManageChild(Title); XtManageChild(rcTitle); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rcTitle);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rcVia = XmCreateRowColumn(EditMsgDialog, "rcVia", args, n); n = 0; XtSetArg(args[n], XmNwidth, 40);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rcVia, "via", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 40);n++; Via = XmCreateTextField(rcVia, "TextF", args, n); XtManageChild(Via); XtManageChild(rcVia); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 50);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rcVia);n++; rcl = XmCreateForm(EditMsgDialog, "rc", args, n); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 50);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rcVia);n++; rcr = XmCreateForm(EditMsgDialog, "rc", args, n); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rc2 = XmCreateRowColumn(rcl, "rc", args, n); n = 0; XtSetArg(args[n], XmNwidth, 40);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rc2, "to", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 15);n++; To = XmCreateTextField(rc2, "TextF", args, n); XtManageChild(To); XtManageChild(rc2); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rc2);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rc3 = XmCreateRowColumn(rcl, "rc", args, n); n = 0; XtSetArg(args[n], XmNwidth, 40);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rc3, "bid", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 15);n++; Bid = XmCreateTextField(rc3, "TextF", args, n); XtManageChild(Bid); XtManageChild(rc3); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rc3);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rc4 = XmCreateRowColumn(rcl, "rc", args, n); n = 0; XtSetArg(args[n], XmNwidth, 40);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rc4, "from", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 15);n++; From = XmCreateTextField(rc4, "TextF", args, n); XtManageChild(From); XtManageChild(rc4); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNwidth, 40);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_END);n++; w = XmCreateLabel(rcl, "msg", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNtopOffset, 5);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNleftOffset, 5);n++; XtSetArg(args[n], XmNleftWidget, w);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rc4);n++; XtSetArg(args[n], XmNbottomOffset, 5);n++; XtSetArg(args[n], XmNvisibleItemCount, 15);n++; XtSetArg(args[n], XmNhighlightThickness, 0);n++; MsgList = XmCreateScrolledList(rcl, "message_list", args, n); XtAddCallback(MsgList, XmNbrowseSelectionCallback, SelectCB, NULL); XtManageChild(MsgList); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rc2 = XmCreateRowColumn(rcr, "rc", args, n); n = 0; XtSetArg(args[n], XmNwidth, 40);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rc2, "size", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 15);n++; XtSetArg(args[n], XmNeditable, FALSE);n++; XtSetArg(args[n], XmNcursorPositionVisible, FALSE);n++; Size = XmCreateTextField(rc2, "TextF", args, n); XtManageChild(Size); XtManageChild(rc2); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rc2);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rc3 = XmCreateRowColumn(rcr, "rc", args, n); n = 0; XtSetArg(args[n], XmNwidth, 40);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rc3, "recv", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 15);n++; XtSetArg(args[n], XmNeditable, FALSE);n++; XtSetArg(args[n], XmNcursorPositionVisible, FALSE);n++; Recv = XmCreateTextField(rc3, "TextF", args, n); XtManageChild(Recv); XtManageChild(rc3); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rc3);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rc4 = XmCreateRowColumn(rcr, "rc", args, n); n = 0; XtSetArg(args[n], XmNwidth, 40);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rc4, "sent", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 15);n++; XtSetArg(args[n], XmNeditable, FALSE);n++; XtSetArg(args[n], XmNcursorPositionVisible, FALSE);n++; Sent = XmCreateTextField(rc4, "TextF", args, n); XtManageChild(Sent); XtManageChild(rc4); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; f = XmCreateForm(rcr, "form", args, n); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; rcStat = XmCreateRadioBox(f, "rcStat", args, n); n = 0; XtSetArg(args[n], XmNhighlightThickness, 0);n++; Stat[0] = XmCreateToggleButton(rcStat, "$", args, n); Stat[1] = XmCreateToggleButton(rcStat, "N", args, n); Stat[2] = XmCreateToggleButton(rcStat, "Y", args, n); Stat[3] = XmCreateToggleButton(rcStat, "F", args, n); Stat[4] = XmCreateToggleButton(rcStat, "X", args, n); Stat[5] = XmCreateToggleButton(rcStat, "K", args, n); Stat[6] = XmCreateToggleButton(rcStat, "A", args, n); XtManageChildren(Stat, 7); XtManageChild(rcStat); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNrightWidget, rcStat);n++; XtSetArg(args[n], XmNwidth, 40);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_END);n++; w = XmCreateLabel(f, "status", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNrightWidget, rcStat);n++; XtSetArg(args[n], XmNrightOffset, 30);n++; rcType = XmCreateRadioBox(f, "rcType", args, n); n = 0; XtSetArg(args[n], XmNhighlightThickness, 0);n++; Type[0] = XmCreateToggleButton(rcType, "A", args, n); Type[1] = XmCreateToggleButton(rcType, "B", args, n); Type[2] = XmCreateToggleButton(rcType, "P", args, n); Type[3] = XmCreateToggleButton(rcType, "T", args, n); XtManageChildren(Type, 4); XtManageChild(rcType); n = 0; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rcType);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNrightWidget, rcStat);n++; XtSetArg(args[n], XmNrightOffset, 30);n++; rcData = XmCreateRadioBox(f, "rcData", args, n); n = 0; XtSetArg(args[n], XmNhighlightThickness, 0);n++; XtSetArg(args[n], XmNshadowThickness, 0);n++; Data = XmCreateToggleButton(rcData, " ", args, n); XtManageChild(Data); XtSetSensitive(Data, FALSE); XtManageChild(rcData); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET);n++; XtSetArg(args[n], XmNtopWidget, rcType);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNrightWidget, rcType);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNwidth, 40);n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(f, "type", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET);n++; XtSetArg(args[n], XmNtopWidget, rcData);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNrightWidget, rcData);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNwidth, 40);n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(f, "data", args, n); XtManageChild(w); XtManageChild(f); XtManageChild(rcl); XtManageChild(rcr); } #if 0 main(int ac, char **av) { Arg args[20] ; Cardinal n; Widget toplevel; Widget rc; Widget bp; Widget EditMsgDialog; XtAppContext app_context; toplevel = XtAppInitialize(&app_context, "TM", NULL, 0, &ac, av, NULL,NULL, 0); n = 0; XtSetArg(args[n], XmNallowShellResize, True);n++; XtSetValues(toplevel, args, n); EditMessage(toplevel); rc = XmCreateRowColumn(toplevel, "rc", NULL, 0); bp = XmCreatePushButton(rc, "Edit Message", NULL, 0); XtAddCallback(bp, XmNactivateCallback, EditMsgCB, NULL); XtManageChild(bp); XtManageChild(rc); XtRealizeWidget(toplevel); /* Main Loop */ XtAppMainLoop(app_context); } #endif void AddMessageList(char *number) { XmString string; string = XmStringCreateSimple(number); XmListAddItem(MsgList, string, 0); XmStringFree(string); } static void ApplyFwdCB(Widget w, XtPointer client_data, XtPointer call_data) { int nobbs; int noctet; int cmpmsk; for (nobbs = 0 ; nobbs < NBBBS ; nobbs++) { noctet = nobbs / 8 ; cmpmsk = 1 << (nobbs % 8) ; switch (fwd_t_val[nobbs]) { case 0 : clr_bit_fwd(bullig.fbbs, nobbs+1); clr_bit_fwd(bullig.forw, nobbs+1); break; case 1 : clr_bit_fwd(bullig.fbbs, nobbs+1); set_bit_fwd(bullig.forw, nobbs+1); break; case 2 : set_bit_fwd(bullig.fbbs, nobbs+1); clr_bit_fwd(bullig.forw, nobbs+1); break; } } SetMsgInfo(&bullig, bullig.numero); clear_fwd(bullig.numero) ; ins_fwd(&bullig) ; } static void CloseFwdCB(Widget w, XtPointer client_data, XtPointer call_data) { printf("CloseCB\n"); XtUnmanageChild((Widget)client_data); XtDestroyWidget(XtParent((Widget)client_data)); } static void DisplayToggle(Widget w, int val) { Cardinal n; Arg args[20] ; n = 0; switch (val) { case 0 : XtSetArg(args[n], XmNset, False); n++; XtSetArg(args[n], XmNselectColor, color_w); n++; XtSetArg(args[n], XmNindicatorOn, on_w); n++; break; case 1 : XtSetArg(args[n], XmNset, True); n++; XtSetArg(args[n], XmNselectColor, color_w); n++; XtSetArg(args[n], XmNindicatorOn, on_w); n++; break; case 2 : XtSetArg(args[n], XmNset, True); n++; XtSetArg(args[n], XmNselectColor, color_d); n++; XtSetArg(args[n], XmNindicatorOn, on_d); n++; break; } XtSetValues(w, args, n); } static void EditToggleCB(Widget w, XtPointer client_data, XtPointer call_data) { int num = (int)client_data; if (fwd_t_val[num] == -1) { DisplayToggle(w, 0); } else { if (++fwd_t_val[num] == 3) fwd_t_val[num] = 0; DisplayToggle(w, fwd_t_val[num]); } } static void UpdateFwdChecks(Widget *toggle) { int i; int val; int noctet; int cmpmsk; XtVaGetValues(tog_w, XmNselectColor, &color_w, XmNindicatorOn, &on_w, NULL); XtVaGetValues(tog_d, XmNselectColor, &color_d, XmNindicatorOn, &on_d, NULL); for (i = 0 ; i < NBBBS ; i++) { if (fwd_t_val[i] == -1) { DisplayToggle(toggle[i], 0); XtSetSensitive(toggle[i], False); continue; } noctet = i / 8 ; cmpmsk = 1 << (i % 8) ; val = ((bullig.forw[noctet]) & (cmpmsk)) ? 1 : 0; if (val == 0) val = ((bullig.fbbs[noctet]) & (cmpmsk)) ? 2 : 0; fwd_t_val[i] = val; DisplayToggle(toggle[i], val); } } static void EditFwdStatus(void) { Cardinal n; Arg args[20] ; Widget w; Widget fwd_rc; int i; XmString string; char ifwd[NBBBS][7]; ch_bbs(1, ifwd); printf("Msg #%ld\n", bullig.numero); n = 0; XtSetArg(args[n], XmNmarginHeight, 5);n++; XtSetArg(args[n], XmNmarginWidth, 5);n++; XtSetArg(args[n], XmNautoUnmanage, FALSE);n++; EditFwdDialog = XmCreateFormDialog(toplevel, "edit_fwd", args, n); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(EditFwdDialog, "apply", args, n); XtAddCallback(w, XmNactivateCallback, ApplyFwdCB, 0); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNleftWidget, w);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(EditFwdDialog, "close", args, n); XtAddCallback(w, XmNactivateCallback, CloseFwdCB, (XtPointer)EditFwdDialog); XtManageChild(w); n = 0; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreateLabel(EditFwdDialog, "fwd_label_exd", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightWidget, w);n++; tog_d = XmCreateToggleButton(EditFwdDialog, "fwd_toggle_exd", args, n); XtManageChild(tog_d); n = 0; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, tog_d);n++; w = XmCreateLabel(EditFwdDialog, "fwd_label_exw", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, tog_d);n++; XtSetArg(args[n], XmNrightWidget, w);n++; tog_w = XmCreateToggleButton(EditFwdDialog, "fwd_toggle_exw", args, n); XtManageChild(tog_w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, tog_w);n++; XtSetArg(args[n], XmNpacking, XmPACK_COLUMN);n++; XtSetArg(args[n], XmNnumColumns, 4);n++; fwd_rc = XmCreateRowColumn(EditFwdDialog, "fwd_rc", args, n); XtManageChild(fwd_rc); for (i = 0 ; i < NBBBS ; i++) { n = 0; if (*ifwd[i]) { string = XmStringCreateSimple(ifwd[i]); XtSetArg(args[n], XmNfillOnSelect, True); n++; } else { string = XmStringCreateSimple(" "); XtSetArg(args[n], XmNfillOnSelect, False); n++; fwd_t_val[i] = -1; } XtSetArg(args[n], XmNlabelString, string);n++; XtSetArg(args[n], XmNvisibleWhenOff, True); n++; fwd_toggle[i] = XmCreateToggleButton(fwd_rc, "fwd_toggle", args, n); XtAddCallback(fwd_toggle[i], XmNvalueChangedCallback, EditToggleCB, (XtPointer)i); XmStringFree(string); } XtManageChildren(fwd_toggle, NBBBS); UpdateFwdChecks(fwd_toggle); XtManageChild(EditFwdDialog); } fbb-7.04j/src/X11/xfbbedtu.c0100644000175100017510000004760707726646105013544 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include #define LG_TBLIST 100 static int LgList; static char *TbList; static int NbLang; static Widget EditUsrDialog; static Widget Callsign; static Widget CallList; static Widget LangList; static Widget Add; static Widget Del; static Widget Home; static Widget Name; static Widget Pass; static Widget Prvt; static Widget Zip; static Widget Stat[11]; static int AddMode; static info user; void EditUsrCB(Widget w, XtPointer client_data, XtPointer call_data) { int i; XmString string; if (XtIsManaged(EditUsrDialog)) { /* Passer la fenetre au 1er plan */ XRaiseWindow(XtDisplay(EditUsrDialog),XtWindow(XtParent(EditUsrDialog))); return; } AddMode = FALSE; cursor_wait(); NbLang = 0; XmListDeleteAllItems(CallList); XmListDeleteAllItems(LangList); FbbRequestUserList(); /* Tri de la liste */ qsort(TbList, LgList, 7, (int (*)(const void *, const void *))strcmp); for (i = 0 ; i < LgList ; i++) { string = XmStringCreateSimple(TbList + (i * 7)); XmListAddItem(CallList, string, 0); XmStringFree(string); } /* Liberation de la liste */ free(TbList); LgList = 0; TbList = NULL; XmListSelectPos(CallList, 1, TRUE); XtManageChild(EditUsrDialog); end_wait(); } void TextFieldGetString(Widget w, char *str, int len, int upcase) { char *text; text = XmTextFieldGetString(w); if (upcase) { strn_cpy(len, str, text); } else { n_cpy(len, str, text); } XtFree(text); } void RefreshUser(void) { int i; XmString string; cursor_wait(); XmListDeleteAllItems(CallList); XmListDeleteAllItems(LangList); NbLang = 0; FbbRequestUserList(); /* Tri de la liste */ qsort(TbList, LgList, 7, (int (*)(const void *, const void *))strcmp); for (i = 0 ; i < LgList ; i++) { string = XmStringCreateSimple(TbList + (i * 7)); XmListAddItem(CallList, string, 0); XmStringFree(string); } /* Liberation de la liste */ free(TbList); LgList = 0; TbList = NULL; string = XmStringCreateSimple(user.indic.call); XmListSelectItem(CallList, string, TRUE); XmListSetItem(CallList, string); XmStringFree(string); end_wait(); } static void ApplyCB(Widget w, XtPointer client_data, XtPointer call_data) { int count; int *list; if (AddMode) { Widget scroll = NULL; /* Inserer le nouvel indicatif */ char Call[8]; indicat indic; unsigned num_indic; FILE *fptr ; info frec ; /* Lire l'indicatif */ TextFieldGetString(Callsign, Call, 7, TRUE); if (!find(Call)) { char text[80]; /* Erreur call */ sprintf(text, "Invalid callsign \"%s\"", Call); MessageBox(20, text, "Add User", MB_ICONEXCLAMATION|MB_OK); return; } indic.num = 0; extind(Call, indic.call); pvoie->emis = insnoeud(indic.call, &num_indic) ; if (pvoie->emis->coord == 0xffff) { /* L'indicatif n'existe pas ... Creer le record */ pvoie->emis->coord = rinfo++; pvoie->emis->val = 1; strcpy(pvoie->emis->indic, Call); init_info(&frec, &indic) ; fptr = ouvre_nomenc() ; fseek(fptr, (long)pvoie->emis->coord * ((long) sizeof(info)), 0) ; fwrite((char *) & frec, (int) sizeof(info), 1, fptr) ; ferme(fptr, 40) ; } GetUserInfos(indic.call, &user); /* Devalider l'indicatif */ XtUnmapWidget(Callsign); /* Revalider la liste ... */ XtMapWidget(CallList); XtVaGetValues(CallList, XmNverticalScrollBar, &scroll, NULL); if (scroll) XtMapWidget(scroll); XtSetSensitive(Add, TRUE); XtSetSensitive(Del, TRUE); AddMode = FALSE; } /* Modification de l'utilisateur */ XmListGetSelectedPos(LangList, &list, &count); if (count) { user.lang = list[0]-1; free(list); } TextFieldGetString(Name, user.prenom, 12, FALSE); TextFieldGetString(Pass, user.pass, 12, TRUE); TextFieldGetString(Zip, user.zip, 8, TRUE); TextFieldGetString(Prvt, user.priv, 12, TRUE); TextFieldGetString(Home, user.home, 40, TRUE); user.flags = 0; if (XmToggleButtonGetState(Stat[0])) user.flags |= F_PRV; if (XmToggleButtonGetState(Stat[1])) user.flags |= F_PAG; if (XmToggleButtonGetState(Stat[2])) user.flags |= F_BBS; if (XmToggleButtonGetState(Stat[3])) user.flags |= F_PMS; if (XmToggleButtonGetState(Stat[4])) user.flags |= F_SYS; if (XmToggleButtonGetState(Stat[5])) user.flags |= F_EXP; if (XmToggleButtonGetState(Stat[6])) user.flags |= F_LOC; if (XmToggleButtonGetState(Stat[7])) user.flags |= F_EXC; if (XmToggleButtonGetState(Stat[8])) user.flags |= F_MOD; if (XmToggleButtonGetState(Stat[9])) user.flags |= F_UNP; if (XmToggleButtonGetState(Stat[10])) user.flags |= F_NEW; SetUserInfos(user.indic.call, &user); RefreshUser(); } static void CloseCB(Widget w, XtPointer client_data, XtPointer call_data) { if (AddMode) { Widget scroll = NULL; /* Devalider l'indicatif */ XtUnmapWidget(Callsign); XtMapWidget(CallList); XtVaGetValues(CallList, XmNverticalScrollBar, &scroll, NULL); if (scroll) XtMapWidget(scroll); XtSetSensitive(Add, TRUE); XtSetSensitive(Del, TRUE); AddMode = FALSE; } XtUnmanageChild((Widget)client_data); XmListDeleteAllItems(CallList); XmListDeleteAllItems(LangList); } static void AddUserCB(Widget w, XtPointer client_data, XtPointer call_data) { Widget scroll = NULL; XtVaGetValues(CallList, XmNverticalScrollBar, &scroll, NULL); XtUnmapWidget(CallList); if (scroll) XtUnmapWidget(scroll); /* Valider l'indicatif */ XtMapWidget(Callsign); XmTextFieldSetString(Callsign, "CALLSIGN"); XtSetSensitive(Add, FALSE); XtSetSensitive(Del, FALSE); AddMode = TRUE; XmListDeselectAllItems(LangList); XmTextFieldSetString(Name, ""); XmTextFieldSetString(Pass, ""); XmTextFieldSetString(Zip, ""); XmTextFieldSetString(Prvt, ""); XmTextFieldSetString(Home, ""); XmToggleButtonSetState(Stat[0], (PRV(def_mask) != 0), FALSE); XmToggleButtonSetState(Stat[1], (PAG(def_mask) != 0), FALSE); XmToggleButtonSetState(Stat[2], (BBS(def_mask) != 0), FALSE); XmToggleButtonSetState(Stat[3], (PMS(def_mask) != 0), FALSE); XmToggleButtonSetState(Stat[4], (SYS(def_mask) != 0), FALSE); XmToggleButtonSetState(Stat[5], (EXP(def_mask) != 0), FALSE); XmToggleButtonSetState(Stat[6], (LOC(def_mask) != 0), FALSE); XmToggleButtonSetState(Stat[7], (EXC(def_mask) != 0), FALSE); XmToggleButtonSetState(Stat[8], (MOD(def_mask) != 0), FALSE); XmToggleButtonSetState(Stat[9], (UNP(def_mask) != 0), FALSE); XmToggleButtonSetState(Stat[10],(NEW(def_mask) != 0), FALSE); } static void DelUserCB(Widget w, XtPointer client_data, XtPointer call_data) { XmString string; ind_noeud *noeud; unsigned num_indic; FILE *fptr ; info frec ; char text[80]; /* Message box ... */ sprintf(text, "Delete %s. Are you sure ?", user.indic.call); if (!MessageBox(20, text, "Delete user", MB_ICONQUESTION|MB_OKCANCEL)) return; noeud = insnoeud(user.indic.call, &num_indic) ; if (noeud->coord == 0xffff) return; string = XmStringCreateSimple(user.indic.call); XmListDeleteItem(CallList, string); XmStringFree(string); fptr = ouvre_nomenc() ; fseek(fptr, (long)noeud->coord * sizeof(info) , 0) ; fread((char *) & frec, sizeof(info), 1, fptr) ; *(frec.indic.call) = '\0' ; fseek(fptr, (long)noeud->coord * sizeof(info) , 0) ; fwrite((char *) & frec, (int) sizeof(info), 1, fptr) ; ferme(fptr, 41) ; noeud->coord = 0xffff ; XmListSelectPos(CallList, 1, TRUE); } static void SelectCallCB(Widget w, XtPointer client_data, XtPointer call_data) { XmListCallbackStruct *cd = (XmListCallbackStruct *)call_data; char *callsign; XmStringGetLtoR(cd->item, XmSTRING_DEFAULT_CHARSET, &callsign); if (!GetUserInfos(callsign, &user)) return; if (user.lang < NbLang) XmListSelectPos(LangList, user.lang+1, FALSE); else XmListDeselectAllItems(LangList); XmTextFieldSetString(Name, user.prenom); XmTextFieldSetString(Pass, user.pass); XmTextFieldSetString(Zip, user.zip); XmTextFieldSetString(Prvt, user.priv); XmTextFieldSetString(Home, user.home); XmToggleButtonSetState(Stat[0], (PRV(user.flags) != 0), FALSE); XmToggleButtonSetState(Stat[1], (PAG(user.flags) != 0), FALSE); XmToggleButtonSetState(Stat[2], (BBS(user.flags) != 0), FALSE); XmToggleButtonSetState(Stat[3], (PMS(user.flags) != 0), FALSE); XmToggleButtonSetState(Stat[4], (SYS(user.flags) != 0), FALSE); XmToggleButtonSetState(Stat[5], (EXP(user.flags) != 0), FALSE); XmToggleButtonSetState(Stat[6], (LOC(user.flags) != 0), FALSE); XmToggleButtonSetState(Stat[7], (EXC(user.flags) != 0), FALSE); XmToggleButtonSetState(Stat[8], (MOD(user.flags) != 0), FALSE); XmToggleButtonSetState(Stat[9], (UNP(user.flags) != 0), FALSE); XmToggleButtonSetState(Stat[10],(NEW(user.flags) != 0), FALSE); } static void SelectLangCB(Widget w, XtPointer client_data, XtPointer call_data) { XmListCallbackStruct *cd = (XmListCallbackStruct *)call_data; char *text; XmStringGetLtoR(cd->item, XmSTRING_DEFAULT_CHARSET, &text); } void EditUser(Widget toplevel) { Arg args[20] ; Cardinal n; Widget w; Widget rcHome; Widget rcPrvt; Widget rcZip; Widget rcPass; Widget rcName; Widget rcStat; LgList = 0; TbList = NULL; n = 0; XtSetArg(args[n], XmNmarginHeight, 5);n++; XtSetArg(args[n], XmNmarginWidth, 5);n++; XtSetArg(args[n], XmNautoUnmanage, FALSE);n++; EditUsrDialog = XmCreateFormDialog(toplevel, "edit_user", args, n); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNmappedWhenManaged, FALSE);n++; XtSetArg(args[n], XmNcolumns, 8);n++; Callsign = XmCreateTextField(EditUsrDialog, "callsign", args, n); XtManageChild(Callsign); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 2);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 22);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(EditUsrDialog, "apply", args, n); XtAddCallback(w, XmNactivateCallback, ApplyCB, 0); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 27);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 47);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; Add = XmCreatePushButton(EditUsrDialog, "add_user", args, n); XtAddCallback(Add, XmNactivateCallback, AddUserCB, 0); XtManageChild(Add); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 52);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 72);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; Del = XmCreatePushButton(EditUsrDialog, "del_user", args, n); XtAddCallback(Del, XmNactivateCallback, DelUserCB, 0); XtManageChild(Del); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 77);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 97);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(EditUsrDialog, "close", args, n); XtAddCallback(w, XmNactivateCallback, CloseCB, (XtPointer)EditUsrDialog); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, w);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rcHome = XmCreateRowColumn(EditUsrDialog, "rcHome", args, n); n = 0; XtSetArg(args[n], XmNwidth, 70);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rcHome, "home_bbs", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 40);n++; Home = XmCreateTextField(rcHome, "TextF", args, n); XtManageChild(Home); XtManageChild(rcHome); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rcHome);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rcPrvt = XmCreateRowColumn(EditUsrDialog, "rcPriv", args, n); n = 0; XtSetArg(args[n], XmNwidth, 70);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rcPrvt, "private_dir", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 40);n++; Prvt = XmCreateTextField(rcPrvt, "TextF", args, n); XtManageChild(Prvt); XtManageChild(rcPrvt); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rcPrvt);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rcZip = XmCreateRowColumn(EditUsrDialog, "rcZip", args, n); n = 0; XtSetArg(args[n], XmNwidth, 70);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rcZip, "zip_code", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 20);n++; Zip = XmCreateTextField(rcZip, "TextF", args, n); XtManageChild(Zip); XtManageChild(rcZip); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rcZip);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rcPass = XmCreateRowColumn(EditUsrDialog, "rcPass", args, n); n = 0; XtSetArg(args[n], XmNwidth, 70);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rcPass, "password", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 20);n++; Pass = XmCreateTextField(rcPass, "TextF", args, n); XtManageChild(Pass); XtManageChild(rcPass); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rcPass);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END);n++; XtSetArg(args[n], XmNmarginWidth, 0);n++; rcName = XmCreateRowColumn(EditUsrDialog, "rcName", args, n); n = 0; XtSetArg(args[n], XmNwidth, 70);n++; XtSetArg(args[n], XmNrecomputeSize, FALSE);n++; w = XmCreateLabel(rcName, "name", args, n); XtManageChild(w); n = 0; XtSetArg(args[n], XmNcolumns, 20);n++; Name = XmCreateTextField(rcName, "TextF", args, n); XtManageChild(Name); XtManageChild(rcName); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNtopOffset, 5);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftOffset, 5);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rcName);n++; XtSetArg(args[n], XmNbottomOffset, 5);n++; XtSetArg(args[n], XmNvisibleItemCount, 10);n++; XtSetArg(args[n], XmNhighlightThickness, 0);n++; CallList = XmCreateScrolledList(EditUsrDialog, "callsign_list", args, n); XtAddCallback(CallList, XmNbrowseSelectionCallback, SelectCallCB, NULL); XtManageChild(CallList); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNtopOffset, 5);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNleftOffset, 5);n++; XtSetArg(args[n], XmNleftWidget, CallList);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rcName);n++; XtSetArg(args[n], XmNbottomOffset, 5);n++; XtSetArg(args[n], XmNvisibleItemCount, 10);n++; XtSetArg(args[n], XmNhighlightThickness, 0);n++; LangList = XmCreateScrolledList(EditUsrDialog, "language_list", args, n); XtAddCallback(LangList, XmNbrowseSelectionCallback, SelectLangCB, NULL); XtManageChild(LangList); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNleftOffset, 5);n++; XtSetArg(args[n], XmNleftWidget, rcName);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, rcPrvt);n++; XtSetArg(args[n], XmNbottomOffset, 5);n++; XtSetArg(args[n], XmNradioBehavior, FALSE);n++; rcStat = XmCreateRadioBox(EditUsrDialog, "rcStat", args, n); n = 0; XtSetArg(args[n], XmNhighlightThickness, 0);n++; Stat[0] = XmCreateToggleButton(rcStat, "read_all", args, n); Stat[1] = XmCreateToggleButton(rcStat, "paging", args, n); Stat[2] = XmCreateToggleButton(rcStat, "bbs", args, n); Stat[3] = XmCreateToggleButton(rcStat, "pms", args, n); Stat[4] = XmCreateToggleButton(rcStat, "sysop", args, n); Stat[5] = XmCreateToggleButton(rcStat, "expert", args, n); Stat[6] = XmCreateToggleButton(rcStat, "local", args, n); Stat[7] = XmCreateToggleButton(rcStat, "excluded", args, n); Stat[8] = XmCreateToggleButton(rcStat, "modem", args, n); Stat[9] = XmCreateToggleButton(rcStat, "unproto", args, n); Stat[10]= XmCreateToggleButton(rcStat, "private_msg", args, n); XtManageChildren(Stat, 11); XtManageChild(rcStat); } #if 0 main(int ac, char **av) { Arg args[20] ; Cardinal n; Widget toplevel; Widget rc; Widget bp; Widget EditUsrDialog; XtAppContext app_context; toplevel = XtAppInitialize(&app_context, "TM", NULL, 0, &ac, av, NULL,NULL, 0); n = 0; XtSetArg(args[n], XmNallowShellResize, True);n++; XtSetValues(toplevel, args, n); EditUsrDialog = EditUser(toplevel); rc = XmCreateRowColumn(toplevel, "rc", NULL, 0); bp = XmCreatePushButton(rc, "Edit User", NULL, 0); XtAddCallback(bp, XmNactivateCallback, EditUsrCB, (XtPointer)EditUsrDialog); XtManageChild(bp); XtManageChild(rc); XtRealizeWidget(toplevel); /* Main Loop */ XtAppMainLoop(app_context); } #endif void AddUserList(char *callsign) { if ((LgList % LG_TBLIST) == 0) { if (LgList) TbList = realloc(TbList, (LgList + LG_TBLIST) * 7); else TbList = malloc(LG_TBLIST * 7); } strn_cpy(6, TbList + (LgList * 7), callsign); ++LgList; } void AddUserLang(char *langue) { XmString string; string = XmStringCreateSimple(langue); XmListAddItem(LangList, string, 0); XmStringFree(string); ++NbLang; } fbb-7.04j/src/X11/xfbblcnx.c0100644000175100017510000001677207726646105013546 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include static int LgList; static int filtre_port; static Widget CnxDialog; static Widget CnxList; static Widget ListPorts; static Widget ToggleFilter; static Widget TextFilter; static void AfficheListe(void) { long record ; FILE *fptr ; char *ptr ; int valvoie; uchar valport; char valcall[8]; char buffer[80]; statis buffstat; int sub_mask = 0; int affich = 0; XmString string; char call_mask[10]; XmListDeleteAllItems(CnxList); fptr = ouvre_stats() ; record = filelength(fileno(fptr)) ; record -= (long) (sizeof(statis) * 500) ; if (record < 0L) record = 0L; sub_mask = XmToggleButtonGetState(ToggleFilter); ptr = XmTextFieldGetString(TextFilter); strn_cpy(6, call_mask, ptr); XtFree(ptr); fseek(fptr, record, 0) ; for (;;) { if (fread((char *) &buffstat, sizeof(statis), 1, fptr) == 0) break; valport = buffstat.port + 'A' ; if ((filtre_port == 0) || (filtre_port == (buffstat.port + 1))) { valvoie = buffstat.voie ; n_cpy(6, valcall, buffstat.indcnx); if (*call_mask == '\0') affich =1; else if (sub_mask) affich = (strstr(valcall, call_mask) != 0); else affich = (strcmp(valcall, call_mask) == 0); if (affich) { sprintf(buffer, "%c %-2d %6ld %-6s %s %3d'%02d", valport, valvoie, record / (long) sizeof(statis), valcall, strdt(buffstat.datcnx), buffstat.tpscnx / 60, buffstat.tpscnx % 60 ) ; string = XmStringCreateSimple(buffer); XmListAddItem(CnxList, string, 0); XmStringFree(string); } } record += (long) sizeof(statis); } XmListSetBottomPos(CnxList, 0); ferme(fptr, 43) ; } void ListeConnexions(void) { XmString tstring[NBPORT+1]; int i; int nb; Arg args[20] ; Cardinal n; tstring[0] = XmStringCreateSimple("All ports"); nb = 1; for (i = 1 ; i < NBPORT ; i++) { if (p_port[i].pvalid) { printf("Port %d = %s\n", i, p_port[i].freq); tstring[nb] = XmStringCreateSimple(p_port[i].freq); ++nb; } } n = 0; XtSetArg(args[n], XmNitems, tstring); n++; XtSetArg(args[n], XmNitemCount, nb); n++; XtSetArg(args[n], XmNvisibleItemCount, nb); n++; XtSetValues(XtNameToWidget(ListPorts,"*List"), args, n); } void ListCnxCB(Widget w, XtPointer client_data, XtPointer call_data) { if (XtIsManaged(CnxDialog)) { /* Passer la fenetre au 1er plan */ XRaiseWindow(XtDisplay(CnxDialog),XtWindow(XtParent(CnxDialog))); return; } cursor_wait(); printf("PendingCB\n"); LgList = 0; ListeConnexions(); AfficheListe(); XtManageChild(CnxDialog); end_wait(); } static void CloseCB(Widget w, XtPointer client_data, XtPointer call_data) { XtUnmanageChild(CnxDialog); } static void PortCB(Widget w, XtPointer client_data, XtPointer call_data) { XmComboBoxCallbackStruct *cb = (XmComboBoxCallbackStruct *)call_data; filtre_port = cb->item_position - 1; AfficheListe(); } static void ToggleFilterCB(Widget w, XtPointer client_data, XtPointer call_data) { AfficheListe(); } static void TextFilterCB(Widget w, XtPointer client_data, XtPointer call_data) { AfficheListe(); } void ListCnx(Widget toplevel) { Arg args[20] ; Cardinal n; XmString string; Widget w; filtre_port = 0; n = 0; XtSetArg(args[n], XmNmarginHeight, 5);n++; XtSetArg(args[n], XmNmarginWidth, 5);n++; XtSetArg(args[n], XmNautoUnmanage, FALSE);n++; CnxDialog = XmCreateFormDialog(toplevel, "cnx_dialog", args, n); string = XmStringCreateSimple("All ports"); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; ToggleFilter = XmCreateToggleButton(CnxDialog, "toggle_filter", args, n); XtAddCallback (ToggleFilter, XmNvalueChangedCallback, ToggleFilterCB, NULL); XtManageChild(ToggleFilter); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftWidget, ToggleFilter);n++; TextFilter = XmCreateTextField(CnxDialog, "text_filter", args, n); XtAddCallback (TextFilter, XmNvalueChangedCallback, TextFilterCB, NULL); XtManageChild(TextFilter); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftWidget, TextFilter);n++; XtSetArg(args[n], XmNitems, &string); n++; XtSetArg(args[n], XmNitemCount, 1); n++; XtSetArg(args[n], XmNeditable, FALSE); n++; XtSetArg(args[n], XmNcursorPositionVisible, FALSE);n++; ListPorts = XmCreateDropDownComboBox(CnxDialog, "combo_ports", args, n); XtAddCallback (ListPorts, XmNselectionCallback, PortCB, NULL); XtManageChild(ListPorts); n= 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, ListPorts);n++; XtSetArg(args[n], XmNbottomOffset, 5);n++; XtSetArg(args[n], XmNhighlightThickness, 0);n++; XtSetArg(args[n], XmNvisibleItemCount, 20);n++; CnxList = XmCreateScrolledList(CnxDialog, "cnx_list", args, n); XtManageChild(CnxList); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNtopWidget, CnxList);n++; XtSetArg(args[n], XmNleftWidget, ListPorts);n++; XtSetArg(args[n], XmNtopOffset, 5);n++; w = XmCreatePushButton(CnxDialog, "close", args, n); XtAddCallback(w, XmNactivateCallback, CloseCB, (XtPointer)CnxDialog); XtManageChild(w); } #if 0 main(int ac, char **av) { Arg args[20] ; Cardinal n; Widget toplevel; Widget rc; Widget bp; Widget EditUsrDialog; XtAppContext app_context; toplevel = XtAppInitialize(&app_context, "TM", NULL, 0, &ac, av, NULL,NULL, 0); n = 0; XtSetArg(args[n], XmNallowShellResize, True);n++; XtSetValues(toplevel, args, n); EditUsrDialog = EditUser(toplevel); rc = XmCreateRowColumn(toplevel, "rc", NULL, 0); bp = XmCreatePushButton(rc, "Edit User", NULL, 0); XtAddCallback(bp, XmNactivateCallback, EditUsrCB, (XtPointer)EditUsrDialog); XtManageChild(bp); XtManageChild(rc); XtRealizeWidget(toplevel); /* Main Loop */ XtAppMainLoop(app_context); } #endif fbb-7.04j/src/X11/xfbbmain.c0100755000175100017510000011102607726646105013515 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include #include void WinMessage (int temps, char *text); void WinDebug (char *fmt,...); int can_talk (int); static int orig_percent; static int orig_pitch; static int orig_duration; /* char *strlwr(char *txt) { char *ptr = txt; while (*ptr) { if (isupper(*ptr)) *ptr = tolower(*ptr); ++ptr; } return(txt); } */ void FbbSync (void) { /* XEvent event; while (XtAppPending(app_context)) { printf("Deb\n"); XtAppNextEvent(app_context, &event); XtDispatchEvent(&event); printf("Fin\n"); } */ XmUpdateDisplay (toplevel); XmUpdateDisplay (toplevel); } void WinMSleep (unsigned milliseconds) { usleep (milliseconds * 1000); } void WinSleep (unsigned seconds) { sleep (seconds); } void DialogHelpCB (Widget w, XtPointer client_data, XtPointer call_data) { *((int *) client_data) = 2; } void DialogOkCB (Widget w, XtPointer client_data, XtPointer call_data) { *((int *) client_data) = 1; } void DialogCancelCB (Widget w, XtPointer client_data, XtPointer call_data) { *((int *) client_data) = 0; } void RaiseEV (Widget w, XtPointer client_data, XEvent * event) { if (event->type != VisibilityNotify) return; XRaiseWindow (XtDisplay (w), XtWindow (XtParent (w))); } /* static void MessageBoxTimeOutCB(XtPointer client_data, XtIntervalId id) { printf("MessageBoxTimeOutCB\n"); *((int *)client_data) = 1; } */ int MessageBox (int sec, char *texte, char *titre, int flags) { Arg args[20]; Cardinal n; Widget dialog; XEvent event; XmString string; int type; time_t temps; int retour = -1; n = 0; XtSetArg (args[n], XmNautoUnmanage, FALSE); n++; XtSetArg (args[n], XmNtitle, titre); n++; /* XtSetArg(args[n], XmNdialogType, XmDIALOG_QUESTION);n++; */ dialog = XmCreateMessageDialog (toplevel, "Warning", args, n); XtAddCallback (dialog, XmNokCallback, DialogOkCB, (XtPointer) & retour); XtAddCallback (dialog, XmNcancelCallback, DialogCancelCB, (XtPointer) & retour); XtAddCallback (dialog, XmNhelpCallback, DialogHelpCB, (XtPointer) & retour); XtAddEventHandler (dialog, VisibilityChangeMask, FALSE, (XtEventHandler) RaiseEV, NULL); switch (flags & 0xf0) { case 0x10: type = XmDIALOG_ERROR; break; case 0x20: type = XmDIALOG_QUESTION; break; case 0x30: type = XmDIALOG_WARNING; break; case 0x40: type = XmDIALOG_INFORMATION; break; default: type = XmDIALOG_MESSAGE; break; } string = XmStringCreateSimple ("No"); n = 0; XtSetArg (args[n], XmNdialogType, type); n++; XtSetArg (args[n], XmNhelpLabelString, string); n++; XtSetValues (dialog, args, n); XmStringFree (string); flags &= 0xf; if (flags == MB_OK) { XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_HELP_BUTTON)); } else if (flags == MB_OKCANCEL) { XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_HELP_BUTTON)); } else { /* YESNO et YESNOCANCEL */ string = XmStringCreateSimple ("Yes"); n = 0; XtSetArg (args[n], XmNokLabelString, string); n++; XtSetValues (dialog, args, n); XmStringFree (string); if (flags == MB_YESNO) { XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_CANCEL_BUTTON)); } } string = XmStringCreateSimple (texte); n = 0; XtSetArg (args[n], XmNmessageString, string); n++; XtSetValues (dialog, args, n); XmStringFree (string); XtManageChild (dialog); XtAddGrab (dialog, TRUE, TRUE); if (sec > 0) { temps = time (NULL) + (time_t) sec; } else { temps = 0; } while (retour == -1) { if (XtAppPending (app_context)) { XtAppNextEvent (app_context, &event); XtDispatchEvent (&event); } else usleep (100000); if ((temps) && (temps < time (NULL))) { retour = 1; break; } } XtRemoveGrab (dialog); XtUnmanageChild (dialog); XtDestroyWidget (XtParent (dialog)); return (retour); } int editor_on (void) { return (EditorOff != TRUE); } int xfbb_edit (void) { int error = 0; char tmp[1024]; char fn[128]; char bbsv[40]; printf ("xfbb_edit, reply = %d\n", reply); *tmp = '\0'; if (reply) { char ftmp[80]; if (pvoie->enrcur) strcpy (fn, mess_name (MESSDIR, pvoie->enrcur, ftmp)); else *fn = '\0'; } if (*ptmes->bbsv) { sprintf (bbsv, "@ %s", ptmes->bbsv); } else *bbsv = '\0'; if (reply == 1) { sprintf (tmp, "Reply: %s %s", ptmes->desti, bbsv); } else if (reply == 3) { sprintf (tmp, "Mail: %s %s", ptmes->desti, bbsv); } else if (reply == 4) { sprintf (tmp, "Msg: %ld", pvoie->enrcur); } tmp[50] = '\0'; if (reply == 4) CreateEditor (fn, NULL, tmp, ED_EDITMSG, TRUE); else CreateEditor (NULL, fn, tmp, ED_MESSAGE, TRUE); return (error); } int end_xfbb_edit (void) { return 1; } void end_edit (int check) { if (check) { cursor_wait (); init_bbs (); test_buf_fwd (); init_buf_swap (); init_buf_rej (); load_themes (); end_wait (); } EditorOff = TRUE; } int record_message (char *ptr, int len) { selvoie (CONSOLE); if (ptr) { if (!get_mess_fwd ('\0', ptr, len, 2)) get_mess_fwd ('\0', "\032", 1, 2); } retour_mbl (); aff_etat ('E'); send_buf (voiecur); reply = 0; return (1); } int fbb_exec (char *commande) { return (False); } void fbb_quit (unsigned retour) { /* closecom(); */ sortie_prg (); exit (retour); } int fbb_list (int update) { static int nb_prec = -1; int nb = 0; int i; XmString string; for (i = 0; i < NBVOIES; i++) { if (svoie[i]->sta.connect) ++nb; } if ((nb >= 0) && (nb != nb_prec)) { char buffer[80]; nb_prec = nb; if (DEBUG) { strcpy (buffer, "TEST Mode"); } else { if (nb == 0) strcpy (buffer, "No connected station"); else sprintf (buffer, "%d connected station%c", nb, (nb > 1) ? 's' : '\0'); } LabelSetString (ConnectLabel, buffer, (DEBUG) ? "RC" : NULL); } XmListDeleteAllItems (ConnectList); for (i = 0; i < NBVOIES; i++) { if (svoie[i]->sta.connect) { int ok = 0; int nobbs; int ch; struct tm *sdate; unsigned t_cnx; Forward *pfwd; char bbs[10]; char buffer[80]; char call[20]; int choix = 0; int fwd = 0; /* Test du forward */ ok = 0; *bbs = '\0'; pfwd = p_port[no_port (i)].listfwd; while (pfwd) { if ((svoie[i]->curfwd) && (pfwd->forward == i)) { nobbs = svoie[i]->bbsfwd; choix = (int) svoie[i]->cur_choix; strn_cpy (6, bbs, bbs_ptr + (nobbs - 1) * 7); ok = 1; fwd = 1; } pfwd = pfwd->suite; } if ((!ok) && (svoie[i]->mode & F_FOR) && (i != CONSOLE)) { fwd = 2; strcpy (bbs, svoie[i]->sta.indicatif.call); } strlwr (bbs); if (P_TOR (i)) { int port = no_port (i); if (p_port[port].t_wait) { fwd = 3; strcpy (bbs, "F-Wait"); } else if (p_port[port].t_busy) { fwd = 3; strcpy (bbs, "F-Chck"); } } /* Affichage */ sdate = localtime (&(svoie[i]->debut)); t_cnx = (unsigned) (time (NULL) - svoie[i]->debut); if (i == 1) ch = 99; else ch = (i > 0) ? i - 1 : i; if (svoie[i]->sta.indicatif.num) sprintf (call, "%s-%d", svoie[i]->sta.indicatif.call, svoie[i]->sta.indicatif.num); else sprintf (call, "%s", svoie[i]->sta.indicatif.call); sprintf (buffer, "%02d %-9s %02d:%02d %02d:%02d %2d %3d %c%c%s", ch, call, sdate->tm_hour, sdate->tm_min, t_cnx / 3600, (t_cnx / 60) % 60, svoie[i]->sta.ret, svoie[i]->sta.ack, (choix < 2) ? ' ' : '0' + choix, (choix < 2) ? ' ' : '/', bbs ); if (fwd == 1) string = XmStringGenerate (buffer, NULL, XmCHARSET_TEXT, "RC"); else if (fwd == 2) string = XmStringGenerate (buffer, NULL, XmCHARSET_TEXT, "BC"); else if (fwd == 3) string = XmStringGenerate (buffer, NULL, XmCHARSET_TEXT, "BF"); else string = XmStringGenerate (buffer, NULL, XmCHARSET_TEXT, "NO"); XmListAddItem (ConnectList, string, 0); XmStringFree (string); } } SetChList (FALSE); return (nb); } int call_dll (char *cmd, int mode, char *buffer, int len, char *data) { /* int i; int point = 0; char dll_name[80]; char *ptr; int retour = -1; // Looking for DLL in the command ptr = cmd; i = 0; while (*ptr) { if (!isgraph(*ptr)) break; if (*ptr == '.') point = 1; dll_name[i++] = *ptr; ++ptr; } dll_name[i] = '\0'; if (!point) strcat(dll_name, ".DLL"); { // Appel DLL HINSTANCE hinstFilter; SetErrorMode(DEFAULT_ERROR_MODE|SEM_NOOPENFILEERRORBOX); hinstFilter = LoadLibrary(dll_name); if (hinstFilter > HINSTANCE_ERROR) { int ac = 0; char *av[30]; av[ac] = strtok(cmd, " "); while (av[ac]) { ++ac; av[ac] = strtok(NULL, " "); } if (mode == REPORT_MODE) { int (FAR PASCAL *DllProc)(int ac, char FAR **av, char FAR *, int len); (FARPROC) DllProc = GetProcAddress(hinstFilter, "svc_main"); if (DllProc) retour = (*DllProc)(ac, (char FAR **)av, (char FAR *)buffer, len); } else { int (FAR PASCAL *DllProc)(int ac, char FAR **av); (FARPROC) DllProc = GetProcAddress(hinstFilter, "dll_main"); if (DllProc) retour = (*DllProc)(ac, (char FAR **)av); } FreeLibrary(hinstFilter); } SetErrorMode(DEFAULT_ERROR_MODE); } return(retour); */ return (-1); } /* cmd : tableau des commandes a executer nb_cmd : nombre de commandes a executer mode : REPORT_MODE : attend un fichier log en retour NO_REPORT_MODE : pas de fichier log en retour log : nom du fichier de retour xdir : repertoire dans lequel doivent s'executer les commandes */ int call_nbdos (char **cmd, int nb_cmd, int mode, char *log, char *xdir, char *data) { /* Appel DOS */ int i; int ExitCode = 0; char *ptr; char file[256]; char buf[256]; char dir[256]; char arg[256]; if (log) sprintf (file, " %s 2>&1", back2slash (log)); else sprintf (file, " > 8; printf ("retour = %x\n", retour); if (ExitCode == 127) ExitCode = -1; printf ("ExitCode = %d\n", ExitCode); } return (ExitCode); } int filter (char *ligne, char *buffer, int len, char *data, char *xdir) { char deroute[80]; int retour; sprintf (deroute, "%sEXECUTE.xxx", MBINDIR); retour = call_nbdos (&ligne, 1, REPORT_MODE, deroute, xdir, data); /* retour = wait_dos(ligne, deroute); */ if (retour != -1) { outfichs (deroute); } unlink (deroute); return (retour); } void CompressPosition (int mode, int val, long numero) { Arg args[10]; Cardinal n; Pixel color; if (val == 0) val = 1; switch (mode) { case 0: color = df_pixel; val = 100; break; case 1: color = rc_pixel; break; case 2: color = bc_pixel; break; default: color = bc_pixel; break; } n = 0; XtSetArg (args[n], XmNsliderSize, val); n++; XtSetArg (args[n], XmNbackground, color); n++; XtSetValues (Jauge, args, n); FbbSync (); } void FbbStatus (char *callsign, char *texte) { if (!foothelp) { char buffer[80]; sprintf (buffer, "%-15s %s", callsign, texte); LabelSetString (Footer, buffer, NULL); } } void FbbMem (int update) { static long old_us = 0xffffffffL; static long old_avail = 0; static time_t old_time = 0L; static int old_getd = 0; static int old_gMem = -1; static long old_nbmess = -1L; static long old_temp = 0; int gMem = nb_ems_pages (); long us = mem_alloue; char texte[80]; time_t new_time = time (NULL); /* positionne tot_mem a la taille de memoire dispo tot_mem = 1000000L; */ if (operationnel == -1) return; /* Mise a jour toutes les secondes */ if (old_time == new_time) return; old_time = new_time; if (us < 0L) us = 0L; if (us != old_us) { sprintf (texte, ": %ld", us); LabelSetString (Used, texte, NULL); old_us = us; } if (gMem != old_gMem) { sprintf (texte, ": %d K", gMem << 4); LabelSetString (GMem, texte, NULL); old_gMem = gMem; } /* Test disque toutes les 10 secondes */ if (old_getd == 0) { struct statfs dfree; fsid_t fsid; if (statfs (DATADIR, &dfree) == 0) { if (dfree.f_bavail != old_avail) { sys_disk = dfree.f_bavail * (dfree.f_bsize / 1024L); LabelSetString (TxtDisk1, "Disk#1 free", (sys_disk < 1000) ? "RC" : NULL); /* FbbApp->FbbDiskTxt->IntVal = (sys_disk < 100); */ sprintf (texte, ": %ld K", sys_disk); /* FbbApp->FbbDisk->IntVal = (sys_disk < 100); */ /* FbbApp->FbbDisk->SetText(texte); */ LabelSetString (Disk1, texte, (sys_disk < 1000) ? "RC" : NULL); old_avail = dfree.f_bavail; memcpy (&fsid, &dfree.f_fsid, sizeof (fsid)); } } if ((statfs (MBINDIR, &dfree) == 0) && (dfree.f_bavail != old_avail)) /* (memcmp(&fsid, &dfree.f_fsid,sizeof(fsid_t)) != 0)) */ { if (dfree.f_bavail != old_temp) { tmp_disk = dfree.f_bavail * (dfree.f_bsize / 1024L); LabelSetString (TxtDisk2, "Disk#2 free", (tmp_disk < 1000) ? "RC" : NULL); /* FbbApp->FbbDiskTxt->IntVal = (sys_disk < 100); */ sprintf (texte, ": %ld K", tmp_disk); /* FbbApp->FbbDisk->IntVal = (sys_disk < 100); */ /* FbbApp->FbbDisk->SetText(texte); */ LabelSetString (Disk2, texte, (tmp_disk < 1000) ? "RC" : NULL); XtManageChild (Disk2); XtManageChild (TxtDisk2); old_temp = dfree.f_bavail; } } else { tmp_disk = sys_disk; XtUnmanageChild (Disk2); XtUnmanageChild (TxtDisk2); } old_getd = 10; } else --old_getd; if (nbmess != old_nbmess) { sprintf (texte, ": %ld", nbmess); LabelSetString (Msgs, texte, NULL); old_nbmess = nbmess; } /* val = GetFreeSystemResources(GFSR_SYSTEMRESOURCES); if (val != old_system) { sprintf(texte, "Syst: %d%%", val); FbbApp->FbbSystem->SetText(texte); FbbApp->FbbSystem->UpdateWindow(); old_system = val; } val = GetFreeSystemResources(GFSR_USERRESOURCES); if (val != old_user) { sprintf(texte, ": %d %%", val); FbbApp->FbbUser->SetText(texte); FbbApp->FbbUser->UpdateWindow(); old_user = val; } val = GetFreeSystemResources(GFSR_GDIRESOURCES); if (val != old_gdi) { sprintf(texte, ": %d %%", val); FbbApp->FbbGdi->SetText(texte); FbbApp->FbbGdi->UpdateWindow(); old_gdi = val; } if (nbmess != old_nbmess) { sprintf(texte, ": %ld", nbmess); FbbApp->FbbMsg->SetText(texte); FbbApp->FbbMsg->UpdateWindow(); old_nbmess = nbmess; } */ } void DisplayResync (int port, int nb) { static int tot_resync = 0; char texte[80]; if (nb) { if (nb == 1) { LabelSetString (TxtResync, "Resynchro", "RC"); ++tot_resync; } sprintf (texte, ": (%d) %d", port, nb); LabelSetString (Resync, texte, "RC"); } else { LabelSetString (TxtResync, "Resynchro", NULL); sprintf (texte, ": %d ", tot_resync); LabelSetString (Resync, texte, NULL); } } /* void AddListFwd(int mode, char *bbs) { switch (mode) { case 0 : FbbApp->ForwardList->SetRedraw(FALSE); FbbApp->ForwardList->ClearList(); break; case 1 : FbbApp->ForwardList->AddString(bbs); break; case 2 : FbbApp->ForwardList->SetRedraw(TRUE); FbbApp->ForwardList->Invalidate(); break; } } */ void ShowError (char *titre, char *info, int lig) { printf ("%s : %s %d\n", titre, info, lig); /* char texte[80]; sndPlaySound("SystemExclamation", SND_ASYNC); if(lig > 0) wsprintf(texte, "%s %d", info, lig); else strcpy(texte, info); FbbApp->Box(60, texte, titre, IDI_EXCLAMATION); */ } void WinMessage (int temps, char *text) { MessageBox (temps, text, "Message", MB_ICONEXCLAMATION | MB_OK); } void WMessage (int temps, char *text, char *message) { MessageBox (temps, text, message, MB_ICONEXCLAMATION | MB_OK); } static void InfoMessageTimeOutCB (XtPointer client_data, XtIntervalId id) { printf ("XtAddTimeOutCB\n"); InfoMessage (-1, NULL, NULL); } void InfoMessage (int temps, char *texte, char *titre) { static Widget InfoW = NULL; Arg args[10]; Cardinal n; if (InfoW == NULL) { n = 0; XtSetArg (args[n], XmNautoUnmanage, FALSE); n++; InfoW = XmCreateMessageDialog (toplevel, "info_msg", args, n); XtUnmanageChild (XmMessageBoxGetChild (InfoW, XmDIALOG_OK_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild (InfoW, XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild (InfoW, XmDIALOG_HELP_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild (InfoW, XmDIALOG_SEPARATOR)); } if (texte == NULL) { if (InfoW) { sleep (1); XtUnmanageChild (InfoW); } } else { XmString string; n = 0; if (titre) { XtSetArg (args[n], XmNtitle, titre); n++; } else sleep (1); /* XtSetArg(args[n], XmNwidth, 300);n++; */ XtSetValues (XtParent (InfoW), args, n); string = XmStringCreateSimple (texte); n = 0; XtSetArg (args[n], XmNdialogType, XmDIALOG_INFORMATION); n++; XtSetArg (args[n], XmNmessageString, string); n++; XtSetValues (InfoW, args, n); XmStringFree (string); if (titre) XtManageChild (InfoW); if (temps > 0) { printf ("XtAddTimeOut %d\n", temps); XtAppAddTimeOut (app_context, temps * 1000, (XtTimerCallbackProc) InfoMessageTimeOutCB, NULL); } FbbSync (); } } void CloseFbbWindow (int numero) { if (numero == 0) sysop_end (); HideFbbWindow (numero, toplevel); } int sel_option (char *texte, int *val) { int res = MessageBox (0, texte, NULL, MB_ICONQUESTION | MB_OKCANCEL); if (res == IDOK) *val = 'y'; return (res == IDOK); } int WindowService (void) { /* return (FbbApp->SvcList != NULL); */ return (False); } void GetBell (Display * dpy) { XKeyboardState stateValues; XGetKeyboardControl (dpy, &stateValues); orig_percent = stateValues.bell_percent; orig_pitch = stateValues.bell_pitch; orig_duration = stateValues.bell_duration; } /*--------------------------------------------------------------------* | SetBell | *--------------------------------------------------------------------*/ void SetBell (Display * dpy, int pitch, int duration) { XKeyboardControl controlValues; unsigned long valueMask = KBBellPercent | KBBellPitch | KBBellDuration; controlValues.bell_percent = orig_percent; controlValues.bell_pitch = pitch; controlValues.bell_duration = duration; XChangeKeyboardControl (dpy, valueMask, &controlValues); } #if 0 /*--------------------------------------------------------------------* | Pitch | *--------------------------------------------------------------------*/ int Pitch (int note) { double x, m, n, f; /* notes are calculated from the base frequency. */ /* This is the first note on the keyboard. */ /* The frequency of a note = 2^(index / 12). */ x = (double) 2.0; m = (double) note; n = (double) 12.0; f = (double) appData->baseFrequency * pow (x, (m / n)); return ((int) f); } #endif /*--------------------------------------------------------------------* | PlayNote | *--------------------------------------------------------------------*/ void PlayNote (int Pitch, int Duration) { if (orig_duration == 0) GetBell (XtDisplay (toplevel)); if (Pitch) { SetBell (XtDisplay (toplevel), Pitch, Duration); XBell (XtDisplay (toplevel), 100); SetBell (XtDisplay (toplevel), orig_pitch, orig_duration); FbbSync (); } WinMSleep (Duration); } void bipper (void) { if (!bip) return; if (doub_fen) { if (!play ("connect.wav")) { WinMessage (5, "Error : Cannot play file \"connect.wav\""); } } else { /* XBell(XtDisplay(toplevel), 100); */ PlayNote (2000, 40); PlayNote (1000, 40); #if 0 /* Haut parleur */ /* outportb(0x43, 0xb6); outportb(0x42, 0xffff); asm nop asm nop asm nop outportb(0x42,0xffff); OpenSound(); SetVoiceSound(1, MAKELONG(0, 2000), 20); SetVoiceSound(1, MAKELONG(0, 1000), 20); StartSound(); WaitSoundState(S_QUEUEEMPTY); CloseSound(); */ #endif } } void music (int stat) { static int note[10] = { /* 440, 0, 0, 440, 440, 388, 499, 388, 499, 0, 0, 499 */ /* 44, 0, 44, 44, 42, 45, 42, 45, 0, 45 */ 40, 0, 40, 36, 40, 36, 38, 38, 0, 38 }; /* int res = MessageBox(texte, NULL, MB_ICONQUESTION|MB_OKCANCEL); if (res == IDOK) { */ if (doub_fen) { if (stat) { t_tell = 1000; if (!play ("syscall.wav")) { WinMessage (5, "Error : Cannot play file \"syscall.wav\""); } } else { t_tell = -1; } } else { int i; for (i = 0; i < 10; i++) { double x, m, n, f; /* notes are calculated from the base frequency. */ /* This is the first note on the keyboard. */ /* The frequency of a note = 2^(index / 12). */ if (note[i]) { x = (double) 2.0; m = (double) note[i]; n = (double) 12.0; f = (double) 55 *pow (x, (m / n)); } else f = 0.0; PlayNote ((int) f, 200); WinMSleep (100); } /* outportb(0x43, 0xb6); outportb(0x42, 0xffff); asm nop asm nop asm nop outportb(0x42,0xffff); if (stat) { t_tell = 1000 ; OpenSound(); SetVoiceAccent(1, 120, 255, S_STACCATO, 0); SetVoiceNote(1, 0, 8, 0); for (i = 0 ; i < 10 ; i++) { // if (note[i] == note[i+1]) // SetVoiceSound(1, MAKELONG(0, 0), 5); // SetVoiceSound(1, MAKELONG(0, note[i]), 50); SetVoiceNote(1, note[i], 8, 0); } StartSound(); } else { t_tell = -1 ; } WaitSoundState(S_QUEUEEMPTY); CloseSound(); */ } } void maj_menu_options (void) { XmToggleButtonSetState (Opt[CM_OPTIONEDIT], sed, FALSE); XmToggleButtonSetState (Opt[CM_OPTIONCALL], ok_tell, FALSE); XmToggleButtonSetState (Opt[CM_OPTIONALARM], bip, FALSE); XmToggleButtonSetState (Opt[CM_OPTIONGATEWAY], gate, FALSE); XmToggleButtonSetState (Opt[CM_OPTIONJUSTIF], just, FALSE); XmToggleButtonSetState (Opt[CM_OPTIONAFFICH], ok_aff, FALSE); XmToggleButtonSetState (Opt[CM_OPTIONSOUNDB], doub_fen, FALSE); XmToggleButtonSetState (Opt[CM_OPTIONINEXPORT], aff_inexport, FALSE); XmToggleButtonSetState (ScanMsg, p_forward, FALSE); } void set_option (int id, int val) { switch (id) { case CM_OPTIONEDIT: sed = val; break; case CM_OPTIONCALL: ok_tell = val; break; case CM_OPTIONJUSTIF: just = val; break; case CM_OPTIONALARM: bip = val; break; case CM_OPTIONGATEWAY: gate = val; break; case CM_OPTIONAFFICH: ok_aff = val; break; case CM_OPTIONSOUNDB: doub_fen = val; break; case CM_OPTIONINEXPORT: aff_inexport = val; break; } maj_options (); } int set_callsign (char *buf) { FILE *fptr; if (!ind_console (0, buf)) return (0); aff_msg_cons (); if ((fptr = fopen (d_disque ("ETAT.SYS"), "r+t")) == NULL) fbb_error (ERR_OPEN, d_disque ("ETAT.SYS"), 0); fprintf (fptr, "%-6s-%X\n", cons_call.call, cons_call.num); ferme (fptr, 74); return (1); } void get_callsign (char *buf) { sprintf (buf, "%s-%d", cons_call.call, cons_call.num); } void win_msg_cons (int priv, int hold) { char texte[80]; if (priv >= 0) { sprintf (texte, ": %d", priv); LabelSetString (TxtPriv, "Priv msgs", (priv > 0) ? "RC" : NULL); LabelSetString (Priv, texte, (priv > 0) ? "RC" : NULL); /* FbbApp->FbbPriv->IntVal = priv; */ } if (hold >= 0) { sprintf (texte, ": %d", hold); LabelSetString (TxtHold, "Hold msgs", (hold > 0) ? "RC" : NULL); LabelSetString (Hold, texte, (hold > 0) ? "RC" : NULL); /* FbbApp->FbbHoldTxt->IntVal = hold; */ } } void disconnect_channel (int channel, int immediate) { if ((svoie[channel]->sta.connect) && (channel) && (channel < NBVOIES)) { if (immediate) force_deconnexion (channel, 1); else deconnexion (channel, 1); } } int can_talk (int channel) { if ((channel < 0) || (channel >= NBVOIES)) return (FALSE); return ((svoie[channel]->sta.connect) && (channel) && (channel < NBVOIES) && (svoie[channel]->niv3 == 0)); } int talk_to (int channel) { if ((svoie[channel]->sta.connect) && (channel) && (channel < NBVOIES)) { if (svoie[channel]->niv3 == 0) { v_tell = channel; selvoie (CONSOLE); strn_cpy (6, pvoie->sta.indicatif.call, cons_call.call); pvoie->sta.indicatif.num = cons_call.num; pvoie->sta.connect = 16; pvoie->deconnect = FALSE; pvoie->pack = 0; pvoie->read_only = 0; pvoie->vdisk = 2; pvoie->xferok = 1; pvoie->mess_recu = 1; pvoie->mbl = 0; init_timout (CONSOLE); pvoie->temp3 = 0; pvoie->nb_err = 0; pvoie->finf.lang = langue[0]->numlang; init_langue (voiecur); maj_niv (N_MBL, 9, 2); selvoie (v_tell); pvoie->sniv1 = pvoie->niv1; pvoie->sniv2 = pvoie->niv2; pvoie->sniv3 = pvoie->niv3; pvoie->nb_err = 0; init_langue (voiecur); maj_niv (N_MBL, 9, 2); texte (T_MBL + 16); t_tell = -1; ShowFbbWindow (0, toplevel); return (1); } } return (0); } int fct_arret (int type) { long caltemps; #ifdef ENGLISH static char *strtype[4] = {"Error ", "End", "Re-Run ", "Maintenance"}; #else static char *strtype[4] = {"Erreur", "Fin", "Relance", "Maintenance"}; #endif int c; int nb_connect; int res; c = 1; nb_connect = actif (2); if (nb_connect) { res = MessageBox (0, "Immediate", strtype[type], MB_ICONQUESTION | MB_YESNOCANCEL); if (res == IDCANCEL) return (0); if (res == IDNO) c = 2; } type_sortie = type; switch (c) { case 1: if (MessageBox (0, "Are you sure ?", "Quit XFBB", MB_ICONQUESTION | MB_OKCANCEL) == IDOK) { house_keeping (); maintenance (); fbb_quit (type); } else return (0); break; case 2: save_fic = 1; set_busy (); time (&caltemps); stop_min = minute (caltemps); break; case 3: house_keeping (); break; } return (1); } void scan_fwd (int val) { XmToggleButtonSetState (ScanMsg, val, FALSE); if (val) { if (p_forward == 0) { p_forward = 1; init_buf_fwd (); init_buf_swap (); init_buf_rej (); init_bbs (); } } else { if (p_forward) p_forward = 0; } maj_options (); } void win_status (char *txt) { char texte[80]; sprintf (texte, ": %s", txt); LabelSetString (State, texte, NULL); } char *win_memo (int val) { FILE *fptr = fopen (d_disque ("MEMO.SYS"), "rt"); char buffer[257]; char *ptr = NULL; if (fptr) { while (fgets (buffer, 256, fptr)) { if (val-- == 0) { ptr = var_crlf (sup_ln (buffer)); break; } } ferme (fptr, 81); } return (ptr); } void fin_tache (int voie) { selvoie (voie); traite_voie (voie); } void win_execute (char *buffer) { /* WORD diagInst; BOOL bResult; TASKENTRY te; HANDLE hInst; // Attend la reception eventuelle de trames RS232 WinSleep(1); if ((FbbApp->ddeCB == 0) && (FbbApp->pThunk == NULL)) { // Si la liste est vide, lancer la notify Callback //AppWindow = FbbApp->MainWindow->HWindow; //FbbApp->pThunk = MakeProcInstance((FARPROC)Callback, FbbApp->ghInstance); //NotifyRegister(0, (LPFNNOTIFYCALLBACK)FbbApp->pThunk, NF_NORMAL); } ++FbbApp->ddeCB; // diagInst = WinExec(buffer, SW_SHOWNORMAL); diagInst = WinExec(buffer, SW_SHOWMINNOACTIVE); if (diagInst < 32) { FbbApp->MainWindow->MessageBox("WinExec Failed", "Error", MB_OK); } else { hInst = (HANDLE)diagInst; te.dwSize = sizeof(te); bResult = TaskFirst(&te); while (bResult) { if (te.hInst == hInst) { pvoie->task = te.hTask; break; } bResult = TaskNext(&te); } } */ } #if 0 void init_socket (int port) { /* int adresse = p_com[p_port[port].ccom].cbase; FbbApp->Socket = new MySocket(FbbApp->Client->HWindow, adresse, port, p_port[port].nb_voies); */ } void dec_socket (int voie) { /* int canal = no_canal(voie); SOCKET sock; if (canal == -1) return; sock = FbbApp->Socket->SockCan[canal-1].socket; FbbApp->Socket->Server_DestroyConnection(sock); FbbApp->Socket->Disconnection(sock, 0); */ } void free_socket (int port) { /* if (FbbApp->Socket) delete FbbApp->Socket; FbbApp->Socket = NULL; */ } int snd_tcp (int port, int canal, int cmd, char *buffer, int len, Beacon * ptr) { /* SOCKET sock; if (cmd == UNPROTO) { // Unprotos ? ... return(0); } sock = FbbApp->Socket->SockCan[canal-1].socket; if (sock == 0xffff) return(-1); FbbApp->Socket->Send(sock, buffer, len); return(len); */ } int tcp_busy (int voie) { /* int canal = no_canal(voie); if (canal == -1) return(0); SOCKET sock = FbbApp->Socket->SockCan[canal-1].socket; return((FbbApp->Socket->Full(sock)) ? svoie[voie]->maxbuf * 2 : 0); */ } void connect_tcp (int voie, indicat * call, char *address, int tcport) { /* int canal = no_canal(voie); if (canal == -1) return; MySocket *Socket = FbbApp->Socket; SocketCanal *Canal = &Socket->SockCan[canal-1]; wsprintf(Canal->call, "%s-%d", call->call, call->num); Canal->socket = Socket->ConnectPort((LPSTR)address, tcport); */ } #endif void user_status (int voie) { int i; int trouve = FALSE; int pos = 0; XmString string; DisplayInfoDialog (voie); /* Chercher la voie dans la liste */ for (i = 0; i < NBVOIES; i++) { if (svoie[i]->sta.connect) { ++pos; if (i == voie) { trouve = TRUE; break; } } } if (trouve) { int ok = 0; int nobbs; int ch; struct tm *sdate; unsigned t_cnx; Forward *pfwd; char bbs[10]; char buffer[80]; char call[20]; int choix = 0; int fwd = 0; /* Test du forward */ ok = 0; *bbs = '\0'; pfwd = p_port[no_port (i)].listfwd; while (pfwd) { if ((svoie[i]->curfwd) && (pfwd->forward == i)) { nobbs = svoie[i]->bbsfwd; choix = (int) svoie[i]->cur_choix; strn_cpy (6, bbs, bbs_ptr + (nobbs - 1) * 7); ok = 1; fwd = 1; } pfwd = pfwd->suite; } if ((!ok) && (svoie[i]->mode & F_FOR) && (i != CONSOLE)) { fwd = 2; strcpy (bbs, svoie[i]->sta.indicatif.call); } strlwr (bbs); if (P_TOR (i)) { int port = no_port (i); if (p_port[port].t_wait) { fwd = 3; strcpy (bbs, "F-Wait"); } else if (p_port[port].t_busy) { fwd = 3; strcpy (bbs, "F-Chck"); } } /* Affichage */ sdate = localtime (&(svoie[i]->debut)); t_cnx = (unsigned) (time (NULL) - svoie[i]->debut); if (i == 1) ch = 99; else ch = (i > 0) ? i - 1 : i; if (svoie[i]->sta.indicatif.num) sprintf (call, "%s-%d", svoie[i]->sta.indicatif.call, svoie[i]->sta.indicatif.num); else sprintf (call, "%s", svoie[i]->sta.indicatif.call); sprintf (buffer, "%02d %-9s %02d:%02d %02d:%02d %2d %3d %c%c%s", ch, call, sdate->tm_hour, sdate->tm_min, t_cnx / 3600, (t_cnx / 60) % 60, svoie[i]->sta.ret, svoie[i]->sta.ack, (choix < 2) ? ' ' : '0' + choix, (choix < 2) ? ' ' : '/', bbs ); if (fwd == 1) string = XmStringGenerate (buffer, NULL, XmCHARSET_TEXT, "RC"); else if (fwd == 2) string = XmStringGenerate (buffer, NULL, XmCHARSET_TEXT, "BC"); else if (fwd == 3) string = XmStringGenerate (buffer, NULL, XmCHARSET_TEXT, "BF"); else string = XmStringGenerate (buffer, NULL, XmCHARSET_TEXT, "NO"); /* Remplacer la ligne par la nouvelle ligne */ XmListReplaceItemsPos (ConnectList, &string, 1, pos); XmStringFree (string); SetChList (FALSE); } } void aff_traite (int voie, int val) { /* FbbApp->ConnectList->SetChannelProcess(voie, val); if (1) // if (val) { char buf[40]; char call[30]; Svoie *ptvoie = svoie[voie]; sprintf (buf, "Buf:%03d Task:%02d-%02d-%02d", ptvoie->sta.mem, ptvoie->niv1, ptvoie->niv2, ptvoie->niv3); #ifdef ENGLISH sprintf (call, "Ch:%02d %s-%d", #else sprintf (call, "Vo:%02d %s-%d", #endif virt_canal (voie), ptvoie->sta.indicatif.call, ptvoie->sta.indicatif.num); FbbStatus (call, buf); } */ } void select_con (int voie) { /* char select[10]; wsprintf(select, "%02d", voie); // FbbApp->ConnectList->SetSelString(select, -1); */ } void SpoolLine (int voie, int attr, char *data, int lg) { if (data) { char *ptr; char *buf; int i; if (p_fptr == NULL) { char *ptr; /* Ouvrir le spooler */ ptr = getenv ("XFBB_PRN"); if (ptr) p_fptr = popen (ptr, "w"); else p_fptr = popen ("lpr", "w"); } printf ("spool %d carac ok\n", lg); ptr = buf = malloc (lg); if (buf == NULL) return; for (i = 0; i < lg; i++) { if (data[i] == '\r') *ptr++ = '\n'; else *ptr++ = data[i]; } fwrite (buf, lg, 1, p_fptr); free (buf); } else { /* Fermer l'imprimante */ if (p_fptr) { pclose (p_fptr); p_fptr = NULL; } return; } } #include void WinDebug (char *fmt,...) { va_list argptr; int cnt; va_start (argptr, fmt); cnt = vprintf (fmt, argptr); va_end (argptr); } void SendEchoCmd (char *buf, int lg) { /* int i; int debut; char *ptr; char sauve; if (lg == 0) return; if (!FbbApp->ProgTnc->IsWindow()) return; ptr= buf; debut = 1; for (i = 0 ; i < lg; i++) { // Saute les LF if ((buf[i] == '\r') || (buf[i] == '\n')) { if (debut) { ptr= &buf[i+1]; } else { sauve = buf[i]; buf[i]= '\0'; FbbApp->ProgTnc->ResLine->Insert(ptr); FbbApp->ProgTnc->ResLine->Insert("\r\n"); buf[i] = sauve; ptr= &buf[i+1]; debut = 1; } } else debut = 0; } if (!debut) { FbbApp->ProgTnc->ResLine->Insert(ptr); FbbApp->ProgTnc->ResLine->Insert("\r\n"); } */ } /* void window_write(int numero, char *data, int len, int color, int header) { char buf[300]; char *ptr; memcpy(buf, data, len); buf[len] = '\0'; ptr = buf; while (*ptr) { if (*ptr == '\r') *ptr = '\n'; ++ptr; } printf("%02d:%s", numero, buf); } */ static void FSOkCB (Widget w, XtPointer client_data, XtPointer call_data) { *((int *) client_data) = 1; } static void FSCancelCB (Widget w, XtPointer client_data, XtPointer call_data) { *((int *) client_data) = 0; } int GetFileNameDialog (char *filename) { Arg args[20]; Cardinal n; XmString string; Widget fs; int retour; XEvent event; n = 0; string = XmStringCreateSimple ("*.imp"); XtSetArg (args[n], XmNpattern, string); n++; fs = XmCreateFileSelectionDialog (toplevel, "file_selection", args, n); XmStringFree (string); XtAddCallback (fs, XmNokCallback, FSOkCB, &retour); XtAddCallback (fs, XmNcancelCallback, FSCancelCB, &retour); XtUnmanageChild (XmFileSelectionBoxGetChild (fs, XmDIALOG_HELP_BUTTON)); XtManageChild (fs); retour = -1; XtAddGrab (fs, TRUE, TRUE); while (retour == -1) { XtAppNextEvent (app_context, &event); XtDispatchEvent (&event); } /* n = 0; XtSetArg(args[n], XmNfileListItemCount, &nb);n++; XtSetArg(args[n], XmNfileListItems, &stable);n++; XtGetValues(fs, args, n); */ if (retour) { char *text; n = 0; XtSetArg (args[n], XmNtextString, &string); n++; XtGetValues (fs, args, n); if (!XmStringGetLtoR (string, XmSTRING_DEFAULT_CHARSET, &text)) retour = 0; else strcpy (filename, text); } XtRemoveGrab (fs); XtUnmanageChild (fs); XtDestroyWidget (XtParent (fs)); return (retour); } fbb-7.04j/src/X11/xfbbpndd.c0100644000175100017510000004021307726646105013512 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include static int LgList; static Widget PendingDialog; static Widget FwdList[4]; static Widget imp_dialog; static void import_bbs(Widget w, char *call); void PendingCB(Widget w, XtPointer client_data, XtPointer call_data) { int i; if (XtIsManaged(PendingDialog)) { /* Passer la fenetre au 1er plan */ XRaiseWindow(XtDisplay(PendingDialog),XtWindow(XtParent(PendingDialog))); return; } cursor_wait(); LgList = 0; for (i = 0 ; i< 4 ; i++) { XmListDeleteAllItems(FwdList[i]); } fwd_encours(); XtManageChild(PendingDialog); end_wait(); } static void CloseCB(Widget w, XtPointer client_data, XtPointer call_data) { XtUnmanageChild(PendingDialog); } static void StopFwdCB(Widget w, XtPointer client_data, XtPointer call_data) { int *tab; int nb; int nb_bbs; int i; char str[80]; char bbs[8]; int bbs_list[80]; int port_fwd; char ifwd[NBBBS][7]; ch_bbs (1, ifwd); nb_bbs = 0; for (i = 0 ; i< 4 ; i++) { if (XmListGetSelectedPos(FwdList[i], &tab, &nb)) { nb_bbs = 1; bbs_list[0] = (i*20) + tab[0] - 1; free(tab); break; } } if (nb_bbs == 0) { strcpy(str, "Select a BBS"); MessageBox(60, str, "STOP", MB_OK | MB_ICONEXCLAMATION); return; } for (i = 0 ; i < nb_bbs ; i++) { if (!isgraph(ifwd[bbs_list[i]][0])) continue; strn_cpy(6, bbs, ifwd[bbs_list[i]]); sprintf(str, "Stops forwarding to BBS %s", bbs); /* ret = MessageBox(60, str, "STOP", MB_OKCANCEL | MB_ICONQUESTION); if (ret == IDCANCEL) continue; */ *str= '\0'; switch (port_fwd = dec_fwd(bbs)) { case -1 : sprintf(str, "BBS %s is not forwarding", bbs); break; case -2 : sprintf(str, "Unknown BBS %s", bbs); break; default : break; } if (*str) { MessageBox(60, str, "STOP", MB_OK | MB_ICONEXCLAMATION); return; } } CloseCB(w, NULL, NULL); } static void SelectFwdCB(Widget w, XtPointer client_data, XtPointer call_data) { int i; for (i = 0 ; i< 4 ; i++) { if (i == (int)client_data) continue; XmListDeselectAllItems(FwdList[i]); } } static void StartFwdCB(Widget w, XtPointer client_data, XtPointer call_data) { int nb_bbs; char str[80]; int bbs_list[80]; int i; int nb; int *tab; char ifwd[NBBBS][7]; ch_bbs (1, ifwd); nb_bbs = 0; for (i = 0 ; i< 4 ; i++) { if (XmListGetSelectedPos(FwdList[i], &tab, &nb)) { nb_bbs = 1; bbs_list[0] = (i*20) + tab[0] - 1; free(tab); break; } } if (nb_bbs == 0) { strcpy(str, "Select a BBS"); MessageBox(60, str, "START", MB_OK | MB_ICONEXCLAMATION); return; } for (i = 0 ; i < nb_bbs ; i++) { int retour; int port_fwd; int reverse = 1; char bbs[8]; *str = '\0'; if (!isgraph(ifwd[bbs_list[i]][0])) continue; strn_cpy(6, bbs, ifwd[bbs_list[i]]); retour = val_fwd(bbs, &port_fwd, reverse); if (retour < 0) { switch (retour) { case -1 : sprintf(str, "No forwarding channel on port %d", port_fwd); break; case -2: sprintf(str, "No port affected to %s", bbs); break; case -3 : sprintf(str, "Unknown BBS %s", bbs); break; case -4 : sprintf(str, "BBS %s already connected", bbs); break; } if (*str) { MessageBox(60, str, "START", MB_OK | MB_ICONEXCLAMATION); return; } } } CloseCB(w, NULL, NULL); } static void StartAllCB(Widget w, XtPointer client_data, XtPointer call_data) { char str[80]; int port_fwd; int reverse =0; int retour; char bbs[8]; *str = '\0'; strcpy(bbs, "9"); retour = val_fwd(bbs, &port_fwd, reverse); if (retour < 0) { switch (retour) { case -1 : sprintf(str, "No forwarding channel on port %d", port_fwd); break; case -2: sprintf(str, "No port affected to %s", bbs); break; case -3 : sprintf(str, "Unknown BBS %s", bbs); break; case -4 : sprintf(str, "BBS %s already connected", bbs); break; } if (*str) { MessageBox(60, str, "START", MB_OK | MB_ICONEXCLAMATION); return; } } if (*str == '\0') CloseCB(w, NULL, NULL); } static void OkCB(Widget w, XtPointer client_data, XtPointer call_data) { Widget *pw; pw = (Widget *)client_data; XtUnmanageChild(imp_dialog); XtDestroyWidget(XtParent(imp_dialog)); imp_dialog = NULL; } static void ApplyCB(Widget w, XtPointer client_data, XtPointer call_data) { Widget wt; Widget wf; char *ptr; wf = (Widget)client_data; /* wt = XmSelectionBoxGetChild(call_dialog, XmDIALOG_TEXT); */ wt = XmSelectionBoxGetChild(w, XmDIALOG_TEXT); ptr = XmTextGetString(wt); XtUnmanageChild(imp_dialog); XtDestroyWidget(XtParent(imp_dialog)); imp_dialog = NULL; if (find(ptr)) { import_bbs(wf, ptr); } else { char str[80]; sprintf(str, "Invalid callsign %s", ptr); MessageBox(60, str, "Import", MB_OK | MB_ICONEXCLAMATION); } XtFree(ptr); } static void ImportCallsign(Widget w) { Arg args[20] ; Cardinal n; if (imp_dialog) { /* Dialog deja ouvert, on le passe devant */ XRaiseWindow(XtDisplay(imp_dialog),XtWindow(XtParent(imp_dialog))); return; } n = 0; XtSetArg(args[n], XmNautoUnmanage, FALSE);n++; XtSetArg(args[n], XmNmessageAlignment, XmALIGNMENT_CENTER);n++; imp_dialog = XmCreatePromptDialog(toplevel, "callsign", args, n); XtManageChild(XmSelectionBoxGetChild(imp_dialog, XmDIALOG_APPLY_BUTTON)); XtUnmanageChild(XmSelectionBoxGetChild(imp_dialog, XmDIALOG_OK_BUTTON)); XtUnmanageChild(XmSelectionBoxGetChild(imp_dialog, XmDIALOG_HELP_BUTTON)); XtAddCallback(imp_dialog, XmNapplyCallback, ApplyCB, (XtPointer)w); XtAddCallback(imp_dialog, XmNcancelCallback, OkCB, (XtPointer)w); XtManageChild(imp_dialog); } static void import_bbs(Widget w, char *call) { int fd; int retour; char filename[512]; char str[80]; retour = GetFileNameDialog(filename); if (retour == 0) return; if ((fd = open(filename, S_IREAD)) != -1) close(fd); else { sprintf(str, "Cannot find %s", filename); MessageBox(60, str, "Import", MB_OK | MB_ICONEXCLAMATION); return; } n_cpy(6, svoie[INEXPORT]->sta.indicatif.call, call) ; svoie[INEXPORT]->sta.indicatif.num = 0 ; strcpy(io_fich,filename); mail_ch = INEXPORT; selvoie(mail_ch) ; pvoie->sta.connect = inexport = 4 ; pvoie->enrcur = 0L ; pvoie->debut = time(NULL); pvoie->mode = F_FOR | F_HIE | F_BID | F_MID ; pvoie->finf.lang = langue[0]->numlang ; aff_event(voiecur, 1); maj_niv(N_MBL, 99, 0) ; CloseCB(w, NULL, NULL); } static void ImportFwdCB(Widget w, XtPointer client_data, XtPointer call_data) { int nb_bbs; int bbs_list[80]; char callsign[10]; char str[80]; int i; int nb; int *tab; char ifwd[NBBBS][7]; ch_bbs (1, ifwd); if (svoie[INEXPORT]->sta.connect) { sprintf(str, "Channel busy, cannot import"); MessageBox(60, str, "Import", MB_OK | MB_ICONEXCLAMATION); return; } nb_bbs = 0; for (i = 0 ; i< 4 ; i++) { if (XmListGetSelectedPos(FwdList[i], &tab, &nb)) { nb_bbs = 1; bbs_list[0] = (i*20) + tab[0] - 1; free(tab); n_cpy(6, callsign, ifwd[bbs_list[0]]) ; if (!isgraph(callsign[0])) { nb_bbs = 0; } break; } } if (nb_bbs == 0) { /* sprintf(str, "Select a BBS"); MessageBox(60, str, "Import", MB_OK | MB_ICONEXCLAMATION); */ ImportCallsign(w); return; } if (nb_bbs > 1) { sprintf(str, "Only one selection allowed"); MessageBox(60, str, "Import", MB_OK | MB_ICONEXCLAMATION); return; } import_bbs(w, callsign); } static void ExportFwdCB(Widget w, XtPointer client_data, XtPointer call_data) { int fd; int nb_bbs; char str[80]; int bbs_list[80]; int i; int *tab; int nb; int retour; char filename[512]; char ifwd[NBBBS][7]; char callsign[10]; ch_bbs (1, ifwd); if (svoie[INEXPORT]->sta.connect) { sprintf(str, "Channel busy, cannot export"); MessageBox(60, str, "Export", MB_OK | MB_ICONEXCLAMATION); return; } nb_bbs = 0; for (i = 0 ; i< 4 ; i++) { if (XmListGetSelectedPos(FwdList[i], &tab, &nb)) { nb_bbs = 1; bbs_list[0] = (i*20) + tab[0] - 1; free(tab); n_cpy(6, callsign, ifwd[bbs_list[0]]) ; if (!isgraph(callsign[0])) { nb_bbs = 0; } break; } } if (nb_bbs == 0) { sprintf(str, "Select a BBS"); MessageBox(60, str, "Import", MB_OK | MB_ICONEXCLAMATION); return; } if (nb_bbs > 1) { sprintf(str, "Only one selection allowed"); MessageBox(60, str, "Import", MB_OK | MB_ICONEXCLAMATION); return; } n_cpy(6, svoie[INEXPORT]->sta.indicatif.call, callsign) ; svoie[INEXPORT]->sta.indicatif.num = 0 ; selvoie(INEXPORT) ; pvoie->mode = F_FOR ; if (!appel_rev_fwd(1)) { sprintf(str, "No mail for %s", svoie[INEXPORT]->sta.indicatif.call); MessageBox(60, str, "Export", MB_OK | MB_ICONEXCLAMATION); return; } retour = GetFileNameDialog(filename); if (retour == 0) return; strcpy(io_fich, filename); if ((fd = creat(io_fich, S_IREAD | S_IWRITE)) != -1) close(fd); else { sprintf(str, "Cannot create %s", io_fich); MessageBox(60, str, "Export", MB_OK | MB_ICONEXCLAMATION); return; } unlink(io_fich) ; /* supprime un eventuel fichier */ mail_ch = INEXPORT; selvoie(mail_ch) ; pvoie->sta.connect = inexport = 4 ; pvoie->debut = time(NULL); pvoie->finf.lang = langue[0]->numlang ; aff_event(voiecur, 1); maj_niv(N_MBL, 98, 0) ; CloseCB(w, NULL, NULL); } void PendingForward(Widget toplevel) { int i; Arg args[20] ; Cardinal n; Widget w; XmRenderTable rt; n = 0; XtSetArg(args[n], XmNmarginHeight, 5);n++; XtSetArg(args[n], XmNmarginWidth, 5);n++; XtSetArg(args[n], XmNautoUnmanage, FALSE);n++; PendingDialog = XmCreateFormDialog(toplevel, "pending_fwd", args, n); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 2);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 17);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(PendingDialog, "stop_fwd", args, n); XtAddCallback(w, XmNactivateCallback, StopFwdCB, 0); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 18);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 33);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(PendingDialog, "start_fwd", args, n); XtAddCallback(w, XmNactivateCallback, StartFwdCB, (XtPointer)PendingDialog); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 34);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 49);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(PendingDialog, "start_all", args, n); XtAddCallback(w, XmNactivateCallback, StartAllCB, (XtPointer)PendingDialog); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 50);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 65);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(PendingDialog, "import_fwd", args, n); XtAddCallback(w, XmNactivateCallback, ImportFwdCB, (XtPointer)PendingDialog); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 66);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 81);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(PendingDialog, "export_fwd", args, n); XtAddCallback(w, XmNactivateCallback, ExportFwdCB, (XtPointer)PendingDialog); XtManageChild(w); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, 82);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, 97);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; w = XmCreatePushButton(PendingDialog, "close", args, n); XtAddCallback(w, XmNactivateCallback, CloseCB, (XtPointer)PendingDialog); XtManageChild(w); for (i = 0 ; i < 4 ; i++) { n= 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNleftPosition, i * 25);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION);n++; XtSetArg(args[n], XmNrightPosition, i* 25 + 24);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, w);n++; XtSetArg(args[n], XmNhighlightThickness, 0);n++; XtSetArg(args[n], XmNvisibleItemCount, 20);n++; FwdList[i] = XmCreateList(PendingDialog, "fwd_list", args, n); XtAddCallback(FwdList[i], XmNbrowseSelectionCallback, SelectFwdCB, (XtPointer)i); XtAddCallback(FwdList[i], XmNdefaultActionCallback, StartFwdCB, (XtPointer)i); XtVaGetValues(FwdList[i], XmNrenderTable, &rt, NULL, NULL); /* Make a copy so that setvalues will work correctly */ rt = XmRenderTableCopy(rt, NULL, 0); rt = XmRenderTableAddRenditions(rt, r_rend, r_index, XmMERGE_NEW); XtVaSetValues(FwdList[i], XmNrenderTable, rt, NULL, NULL); XmRenderTableFree(rt); } XtManageChildren(FwdList, 4); } #if 0 main(int ac, char **av) { Arg args[20] ; Cardinal n; Widget toplevel; Widget rc; Widget bp; Widget EditUsrDialog; XtAppContext app_context; toplevel = XtAppInitialize(&app_context, "TM", NULL, 0, &ac, av, NULL,NULL, 0); n = 0; XtSetArg(args[n], XmNallowShellResize, True);n++; XtSetValues(toplevel, args, n); EditUsrDialog = EditUser(toplevel); rc = XmCreateRowColumn(toplevel, "rc", NULL, 0); bp = XmCreatePushButton(rc, "Edit User", NULL, 0); XtAddCallback(bp, XmNactivateCallback, EditUsrCB, (XtPointer)EditUsrDialog); XtManageChild(bp); XtManageChild(rc); XtRealizeWidget(toplevel); /* Main Loop */ XtAppMainLoop(app_context); } #endif void AddPendingLine(char *call, int priv, int bull, int kb) { char str[80]; XmString string; if (*call) { sprintf(str, "%-6s:%d/%d-%dk", call, priv, bull, kb); if (priv) string = XmStringGenerate(str, NULL, XmCHARSET_TEXT, "RC"); else if (bull) string = XmStringGenerate(str, NULL, XmCHARSET_TEXT, "BC"); else string = XmStringGenerate(str, NULL, XmCHARSET_TEXT, "NO"); } else { str[0] = '.'; str[1] = '\0'; string = XmStringCreateSimple(str); } XmListAddItem(FwdList[LgList/20], string, 0); XmStringFree(string); ++LgList; } fbb-7.04j/src/X11/xeditor.c0100644000175100017510000017364107726646105013415 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #ifndef __MAIN__ #include #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* #include "textedit.h" */ /*********************************************************************** ** ** ** G L O B A L V A R I A B L E S ** ** ** ***********************************************************************/ static Widget save_alert; /* Warning Dialog */ static Atom a_del_win; /* Atom for WM_DELETE_WINDOW */ static Widget find_db, /* The dialog box */ find_lbl, /* Label: "Find:" */ find_txt, /* Find-string Entry Field */ frep_lbl, /* Label: "Repl:" */ frep_txt, /* Replace-string Entry Field */ find_sep, /* Sep between pres & conf */ find_btn_1, /* Action pushbutton */ find_btn_2, /* Go-away pushbutton */ find_btn_3, /* Replace pushbutton */ cantfind_db; /* "Can't Find" Alert */ static XmString find_str, /* XmString for "Find" */ can_str, /* XmString for "Cancel" */ next_str, /* XmString for "Next" */ repl_str, /* XmString for "Replace" */ done_str; /* XmString for "Done" */ static int finding; /* Flag for FindCB() */ static int fd_start, /* Start of the found text */ fd_end; /* End of the found text */ static int curpos; static int line = 0; /* Ligne dans le texte */ static int col = 0; /* Colonne dans le texte */ static int pos = 0; /* Position de l'insertion ds le buffer */ static int wp; static int wrap; /* Mode wrap valide */ static int justif; /* Mode justification demande */ static int efoothelp = 0; static Widget mainwin; /* XmMainWindow */ static Widget menubar; /* MainWindow Menu Bar */ static Widget toolbar; /* MainWindow Menu Bar */ static Widget workwin; /* MainWindow Work Area */ static Widget editshell; /* Shell of the editor */ static Widget textwin; /* Work Window XmText widget */ static Widget footer; /* MainWindow Footer */ static Widget MSave; /* Widget Save */ static Widget MSaveAs; /* Widget SaveAs */ static Widget MCut; /* Widget Cut*/ static Widget MCopy; /* Widget Copy */ static Widget MJustif; /* Widget Justification */ static Widget MWrap; /* Widget AutoWrap */ #define E_NB_ICON 10 static Widget EIcon[E_NB_ICON]; /* Icons of the toolbar */ static int OldIconState[E_NB_ICON]; static Arg arglist[16]; /* For programmatic rsrc stuf */ static Boolean changed; /* Used for save alert */ static int EditorOptions; static char *curfile = NULL; /* The current filename */ static Widget stdfile_db; /* The Standard File dialog */ static Widget find_alert; static void (*fileproc)(void); /* The Read/Write function */ /*********************************************************************** ** ** ** F O R W A R D D E F I N I T I O N S ** ** ** ***********************************************************************/ static void EndEditor(int); static void InitMenuBar(void); /* menu.c */ static void InitOther(void); /* misc.c */ static char *StrFind(char *, char *); static void InitAlerts(void); /* alerts.c */ static void InitFiler(void); /* filer.c */ static void FileNew(void); static void FileOpen(void); static void FileInsert(void); static void FileSave(void); static void FileSaveAs(void); static void InitFindDB(void); /* find.c */ static void ManageFindDB(void); static void InitSaveProto(void); /* saveproto.c */ static void InitMainWindow(char *); static void InitWorkWindow(void); static void InitFileMenu(void); static void InitEditMenu(void); static void InitViewMenu(void); static void InitOptionMenu(void); static void InitHelpMenu(void); static void FileMenuCB(Widget, char *, caddr_t); static void EditMenuCB(Widget, char *, XmAnyCallbackStruct *); static void ViewMenuCB(Widget, char *, XmAnyCallbackStruct *); static void ManageStdFile(char *, XtCallbackProc, char *); static void UnmanageStdFile(void); static void SFProc(Widget, caddr_t, XmFileSelectionBoxCallbackStruct *); static void ReadProc(void); static void InsertProc(void); static void WriteProc(void); static void PreReadProc(void); static void FindCB(Widget, char *, XmAnyCallbackStruct *); static void ReplaceCB(Widget, char *, XmAnyCallbackStruct *); static void FindCanCB(Widget, char *, XmAnyCallbackStruct *); static void SaveProtoCB(Widget, char *, XmAnyCallbackStruct *); static void InitSaveAlert(void); static void AlertSaveCB(Widget, char *, caddr_t); static Boolean AlertSaveWP(caddr_t); static void InitFindAlert(void); /* void CreateEditor(char *file, char *preload, char *title, int options, int autow); */ #ifdef __MAIN__ static Widget toplevel; /* Application Shell */ void PbCB(Widget w, XtPointer client_data, XtPointer call_data) { /* XtManageChild(mainwin); */ CreateEditor(NULL, "filer.c", "Editing : filer.c", 0, 0); } /*********************************************************************** ** ** ** main( argc, argv ) ** ** ** ** Program entry point. Creates shell, calls initialization funcs, ** ** and turns control over to event loop. ** ** ** ***********************************************************************/ void main( argc, argv ) int argc; char *argv[]; { Widget Pb; toplevel = XtInitialize( argv[0], "TextEdit", NULL, 0, &argc, argv ); Pb = XmCreatePushButton(toplevel, "Bouton", NULL, 0 ); XtManageChild(Pb); XtAddCallback(Pb, XmNactivateCallback, PbCB, NULL); XtRealizeWidget( toplevel ); XtMainLoop(); } #endif /* __MAIN__ */ Boolean EditWorkProc(XtPointer data) { int i; int IconState[E_NB_ICON]; static int first = 1; static Pixel TopShadow; static Pixel BottomShadow; if (first) { XtVaGetValues(EIcon[0], XmNtopShadowColor, &TopShadow, XmNbottomShadowColor, &BottomShadow, NULL); XtSetSensitive( EIcon[6], TRUE ); XtSetSensitive( EIcon[7], TRUE ); } *((int *)data) = 0; for (i = 0 ; i < E_NB_ICON ; i++) IconState[i] = FALSE; IconState[0] = TRUE; IconState[1] = changed; IconState[2] = (XmTextGetSelection(textwin) != NULL); IconState[3] = (XmTextGetSelection(textwin) != NULL); IconState[4] = TRUE; IconState[5] = TRUE; IconState[6] = justif; IconState[7] = wrap; IconState[8] = ((EditorOptions & ED_MESSAGE) != 0); /* Help */ IconState[9]= TRUE; for (i = 0 ; i < E_NB_ICON ; i++) { if (OldIconState[i] != IconState[i]) { /* Menues associated to icons */ Widget MenuW; Widget MenuX; MenuW = NULL; MenuX = NULL; switch(i) { case 1: MenuW = MSave; MenuX = MSaveAs; break; case 2: MenuW = MCut; break; case 3: MenuW = MCopy; break; case 6: MenuW = MJustif; break; case 7: MenuW = MWrap; break; } OldIconState[i] = IconState[i]; if ((i == 6) || (i == 7)) { if (IconState[i]) { XtVaSetValues(EIcon[i], XmNtopShadowColor, BottomShadow, XmNbottomShadowColor, TopShadow, NULL); } else { XtVaSetValues(EIcon[i], XmNtopShadowColor, TopShadow, XmNbottomShadowColor, BottomShadow, NULL); } if (MenuW) { /* XmToggleButtonSetValue(MenuW, IconState[i], FALSE); */ XtVaSetValues(MenuW, XmNset, IconState[i], NULL); } } else { XtSetSensitive(EIcon[i], IconState[i]); if (MenuW) XtSetSensitive(MenuW, IconState[i]); if (MenuX) XtSetSensitive(MenuX, IconState[i]); } } } if (!efoothelp) { XmString string; char buf[80]; static int old_lig = 0; static int old_col = 0; if ((old_lig != line) || (old_col != col)) { old_lig = line; old_col = col; sprintf(buf, "Line %-4d column %-4d", line+1, col+1); string = XmStringCreateSimple(buf); XtVaSetValues(footer, XmNlabelString, string, NULL); XmStringFree(string); } } return(True); } static void Update(void) { if (wp == 0) { wp = 1; XtAppAddWorkProc(app_context, EditWorkProc, &wp); } } void CreateEditor(char *file, char *preload, char *title, int options, int autow) { int i; EditorOptions = options; for (i = 0 ; i < E_NB_ICON ; i++) OldIconState[i] = -1; InitMainWindow(title); InitMenuBar(); InitWorkWindow(); XmMainWindowSetAreas( mainwin, menubar, NULL, NULL, NULL, workwin ); InitOther(); XtManageChild(mainwin); XtManageChild(editshell); changed = FALSE; if (curfile) free(curfile); curfile = NULL; if (preload) { curfile = strdup(preload); PreReadProc(); XmTextSetInsertionPosition(textwin, (XmTextPosition) MAXLONG); } if (file) { curfile = strdup(file); ReadProc(); } /* Initialisation sequences */ Update(); EditWorkProc(&wp); } void JustifyCB(Widget w, XtPointer client_data, XtPointer call_data) { justif = !justif; Update(); } void WrapCB(Widget w, XtPointer client_data, XtPointer call_data) { wrap = !wrap; Update(); } void DeliverCB(Widget w, XtPointer client_data, XtPointer call_data) { printf("Deliver\n"); EndEditor(TRUE); } XtEventHandler EHelpCB(Widget w, XtPointer client_data, XEvent *event) { static XmString prev = NULL; if (client_data) { XmString string; if (prev) XmStringFree(prev); XtVaGetValues(footer, XmNlabelString, &prev, NULL); string = XmStringCreateSimple((char *)client_data); XtVaSetValues(footer, XmNlabelString, string, NULL); XmStringFree(string); efoothelp = TRUE; } else { if (prev) XtVaSetValues(footer, XmNlabelString, prev, NULL); efoothelp = FALSE; } return 0; } /*********************************************************************** ** ** ** InitMainWindow() ** ** ** ** This function creates the main window widget and its scrollbars. ** ** The main window is created as a child of the application shell. ** ** The scrollbars are either created along with the main-window (if ** ** its "scrollingPolicy" resource contains TRUE) or separately. ** ** ** ** This function modifies the global "mainwin", and accesses the ** ** global "toplevel". ** ** ** ***********************************************************************/ static void InitMainWindow(char *title) { int n = 0; XtSetArg(arglist[n], XmNallowShellResize, True);n++; XtSetArg(arglist[n], XmNdeleteResponse, XmDO_NOTHING); ++n; XtSetArg(arglist[n], XmNtitle, title); ++n; editshell = XmCreateDialogShell(toplevel, "cnsl", arglist, n); mainwin = XmCreateMainWindow( editshell, "MainWin", NULL, 0 ); } static void ChangedCB(Widget w, XtPointer client_data, XtPointer call_data) { changed = TRUE; Update(); } #define MAXLINE 78 static int Wrap(Widget w) { int i; int debut; int graph; int space; char *pbuf = NULL; if (col < MAXLINE) return(0); if (!justif && !wrap) return(0); pbuf = XmTextGetString(w); printf("pos = %d texte = %02x\n", pos, pbuf[pos]); debut = pos - col; printf("debut de ligne = %02x %02x\n", pbuf[debut], pbuf[debut+1]); /* Recherche le dernier espace de la ligne, sinon tronque */ graph = 0; space = -1; for (i = debut ; i < pos ; i++) { /* Ne tient pas compte des espaces de debut de ligne */ if (isgraph(pbuf[i])) graph = 1; if ((graph) && (isspace(pbuf[i]))) space = i; } printf("Espace en %d\n", space); if (space != -1) { /* remplacer l'espace par un return */ XmTextReplace(w, space, space+1, "\n"); } else { /* inserer un return */ XmTextReplace(w, debut+MAXLINE, debut+MAXLINE, "\n"); debut = pos; } /* Justification eventuelle */ if (justif) { char buffer[1024]; if (pos != debut) { n_cpy(space-debut, buffer, &pbuf[debut]); justifie(buffer); XmTextReplace(w, debut, space ,buffer); } } XtFree(pbuf); return(1); } static void DisplayLC(Widget w) { Position x, y; int xvalue, yvalue; Widget scw, hsb, vsb; Dimension fh, fw; int xbase, ybase; int xinc, yinc; { XmString string; XmFontList font; xbase = 6; XtVaGetValues(w, XmNfontList, &font, NULL); ybase = XmTextGetBaseline(w); string = XmStringCreateSimple("Wy"); XmStringExtent(font, string, &fw, &fh); XmStringFree(string); fw /= 2; /* printf("Font : w = %d h = %d\n", fw, fh); */ } pos = XmTextGetInsertionPosition(w); XmTextPosToXY(w, pos, &x, &y); /* printf("x=%d, y=%d\n", x, y); */ scw = XtParent(w); XtVaGetValues(scw, XmNverticalScrollBar, &vsb, XmNhorizontalScrollBar, &hsb, NULL); if (hsb) XtVaGetValues(hsb, XmNvalue, &xvalue, XmNincrement, &xinc, NULL); else { xvalue = 0; xinc = 1; } if (vsb) XtVaGetValues(vsb, XmNvalue, &yvalue, XmNincrement, &yinc, NULL); else { yvalue = 0; yinc = 1; } /* printf("xvalue = %d %d yvalue = %d %d\n", xvalue, xinc, yvalue, yinc);*/ line = (yvalue/1) + ((y - ybase) / fh); col = (xvalue/fw) + ((x - xbase) / fw); /* printf("lig = %d col = %d\n", line, col); */ Update(); } static void KbHit(Widget w, caddr_t client_data, XEvent *event) { char buf[10]; KeySym keysym; XLookupString(&event->xkey, buf, 1, &keysym, NULL); /* printf("buf[0]=%02x keysym=%x b=%d\n", buf[0], keysym, IsKeypadKey(keysym));*/ if ((keysym < 0xff) && (Wrap(w))) DisplayLC(w); } static void PosMoved(Widget w, caddr_t client_data, XEvent *event) { DisplayLC(w); } /*********************************************************************** ** ** ** InitWorkWindow() ** ** ** ** This function creates the work window and its children. The ** ** work window is created as the child of the main window. ** ** ** ** This function modifies the globals "workwin" and "textwin", and ** ** accesses the global "mainwin". ** ** ** ***********************************************************************/ static void InitWorkWindow() { int n = 0; XmString string; workwin = XmCreateForm( mainwin, "WorkWin", arglist, n ); n = 0; XtSetArg(arglist[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg(arglist[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(arglist[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg(arglist[n], XmNorientation, XmHORIZONTAL);n++; toolbar = XmCreateRowColumn( workwin, "tool_bar", arglist, n ); XtManageChild( toolbar ); EIcon[0] = add_item(TOOLBUTTON, toolbar, "Open", FileMenuCB, "Opn", "Opens a file", EHelpCB); EIcon[1] = add_item(TOOLBUTTON, toolbar, "Save", FileMenuCB, "Sav", "Saves the edited file", EHelpCB); EIcon[2] = add_item(TOOLBUTTON, toolbar, "Cut", EditMenuCB, "Cut", "Cuts the selection", EHelpCB); EIcon[3] = add_item(TOOLBUTTON, toolbar, "Copy", EditMenuCB, "Cpy", "Copies the selection to the clipboard", EHelpCB); EIcon[4] = add_item(TOOLBUTTON, toolbar, "Paste", EditMenuCB, "Pst", "Pastes the clipboard to the cursor position", EHelpCB); EIcon[5] = add_item(TOOLBUTTON, toolbar, "Replace", EditMenuCB, "Fnd", "Finds and replace the selected text", EHelpCB); EIcon[6] = add_item(TOOLBUTTON, toolbar, "Justify", JustifyCB, NULL, "Justifies the text", EHelpCB); EIcon[7] = add_item(TOOLBUTTON, toolbar, "Wrap", WrapCB, NULL, "Auto wraps at 78 characters", EHelpCB); EIcon[8] = add_item(TOOLBUTTON, toolbar, "Deliver", DeliverCB, NULL, "Delivers the message", EHelpCB); EIcon[9] = add_item(TOOLBUTTON, toolbar, "B16", NULL, NULL, "On-line help", EHelpCB); XtVaSetValues(toolbar, XmNmenuHelpWidget, EIcon[9], NULL); if (EditorOptions & ED_MESSAGE) { XtUnmanageChild(EIcon[0]); } else { XtUnmanageChild(EIcon[8]); } string = XmStringCreateSimple(" "); n = 0; XtSetArg(arglist[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(arglist[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(arglist[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(arglist[n], XmNlabelString, string);n++; footer = XmCreateLabel(workwin, "footer", arglist, n); XtManageChild(footer); XmStringFree(string); n = 0; XtSetArg(arglist[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(arglist[n], XmNtopWidget, toolbar); n++; XtSetArg(arglist[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(arglist[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg(arglist[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(arglist[n], XmNbottomWidget, footer);n++; textwin = XmCreateScrolledText(workwin, "TextWin", arglist, n); XtManageChild( textwin ); XtAddCallback(textwin, XmNvalueChangedCallback, ChangedCB, NULL); XtAddEventHandler(textwin, KeyPressMask, FALSE, (XtPointer)KbHit, NULL); XtAddEventHandler(textwin, ButtonReleaseMask|KeyReleaseMask, FALSE, (XtPointer)PosMoved, NULL); XtManageChild( workwin ); } /*********************************************************************** ** ** ** InitMenuBar() ** ** ** ** This function creates the menu bar and all pulldown menus. The ** ** menu bar is created as the child of the main window. ** ** ** ** This function modifies the global "menubar", and accesses the ** ** global "mainwin". ** ** ** ***********************************************************************/ static void InitMenuBar(void) { menubar = XmCreateMenuBar( mainwin, "menu_bar", NULL, 0 ); XtManageChild( menubar ); InitFileMenu(); InitEditMenu(); InitViewMenu(); InitOptionMenu(); InitHelpMenu(); } /*********************************************************************** ** ** ** InitFileMenu() ** ** ** ** Creates the File menu: cascade button, pull-down menu pane, and ** ** all menu-pane choices. Attaches callbacks to menu-pane choices. ** ** ** ***********************************************************************/ static void InitFileMenu(void) { Widget topic, pane, choices[8]; pane = XmCreatePulldownMenu( menubar, "FilePane", NULL, 0 ); choices[0] = XmCreatePushButton( pane, "File_New", NULL, 0 ); choices[1] = XmCreatePushButton( pane, "File_Open", NULL, 0 ); choices[2] = XmCreatePushButton( pane, "File_Insert", NULL, 0 ); choices[3] = XmCreatePushButton( pane, "File_Save", NULL, 0 ); choices[4] = XmCreatePushButton( pane, "File_SaveAs", NULL, 0 ); choices[5] = XmCreateSeparator( pane, "File_Sep1", NULL, 0 ); choices[6] = XmCreatePushButton( pane, "File_Deliver", NULL, 0 ); choices[7] = XmCreatePushButton( pane, "File_Exit", NULL, 0 ); XtManageChildren( choices, 8 ); XtSetArg( arglist[0], XmNsubMenuId, pane ); topic = XmCreateCascadeButton( menubar, "FileTopic", arglist, 1 ); XtManageChild( topic ); XtAddCallback( choices[0], XmNactivateCallback, (XtPointer)FileMenuCB, "New" ); XtAddCallback( choices[1], XmNactivateCallback, (XtPointer)FileMenuCB, "Opn" ); XtAddCallback( choices[2], XmNactivateCallback, (XtPointer)FileMenuCB, "Ins" ); XtAddCallback( choices[3], XmNactivateCallback, (XtPointer)FileMenuCB, "Sav" ); XtAddCallback( choices[4], XmNactivateCallback, (XtPointer)FileMenuCB, "SAs" ); XtAddCallback( choices[6], XmNactivateCallback, (XtPointer)FileMenuCB, "Del" ); XtAddCallback( choices[7], XmNactivateCallback, (XtPointer)FileMenuCB, "Ext" ); if (EditorOptions & ED_MESSAGE) { XtSetSensitive( choices[0], FALSE ); XtSetSensitive( choices[1], FALSE ); XtSetSensitive( choices[3], FALSE ); wrap = justif = TRUE; } else { XtSetSensitive( choices[6], FALSE ); wrap = justif = FALSE; } MSave = choices[3]; MSaveAs = choices[4]; printf("wrap=%d justif=%d\n", wrap, justif); } /*********************************************************************** ** ** ** InitEditMenu() ** ** ** ** Creates the Edit menu: cascade button, pull-down menu pane, and ** ** all menu-pane choices. Attaches callbacks to menu-pane choices. ** ** ** ***********************************************************************/ static void InitEditMenu(void) { Widget topic, pane, choices[7]; pane = XmCreatePulldownMenu( menubar, "Edit_Pane", NULL, 0 ); choices[0] = XmCreatePushButton( pane, "Edit_Cut", NULL, 0 ); choices[1] = XmCreatePushButton( pane, "Edit_Copy", NULL, 0 ); choices[2] = XmCreatePushButton( pane, "Edit_Paste", NULL, 0 ); choices[3] = XmCreateSeparator( pane, "Edit_Sep1", NULL, 0 ); choices[4] = XmCreatePushButton( pane, "Edit_Find", NULL, 0 ); XtManageChildren( choices, 5 ); XtSetArg( arglist[0], XmNsubMenuId, pane ); topic = XmCreateCascadeButton( menubar, "EditTopic", arglist, 1 ); XtManageChild( topic ); XtAddCallback( choices[0], XmNactivateCallback, (XtPointer)EditMenuCB, "Cut" ); XtAddCallback( choices[1], XmNactivateCallback, (XtPointer)EditMenuCB, "Cpy" ); XtAddCallback( choices[2], XmNactivateCallback, (XtPointer)EditMenuCB, "Pst" ); XtAddCallback( choices[4], XmNactivateCallback, (XtPointer)EditMenuCB, "Fnd" ); XtSetSensitive( choices[2], FALSE ); MCopy = choices[1]; MCut = choices[0]; } /*********************************************************************** ** ** ** InitViewMenu() ** ** ** ** Creates the View menu: cascade button, pull-down menu pane, and ** ** all menu-pane choices. Attaches callbacks to menu-pane choices. ** ** ** ***********************************************************************/ static void InitViewMenu(void) { Widget pane, choices[4]; pane = XmCreatePulldownMenu( menubar, "View_Pane", NULL, 0 ); choices[0] = XmCreatePushButton( pane, "View_Top", NULL, 0 ); choices[1] = XmCreatePushButton( pane, "View_Bot", NULL, 0 ); /* choices[2] = XmCreateSeparator( pane, "View_Sep1", NULL, 0 ); choices[3] = XmCreatePushButton( pane, "View_Page", NULL, 0 ); */ XtManageChildren( choices, 2 ); XtAddCallback( choices[0], XmNactivateCallback, (XtPointer)ViewMenuCB, "Top" ); XtAddCallback( choices[1], XmNactivateCallback, (XtPointer)ViewMenuCB, "Bot" ); /* XtSetArg( arglist[0], XmNsubMenuId, pane ); topic = XmCreateCascadeButton( menubar, "ViewTopic", arglist, 1 ); XtManageChild( topic ); */ } /*********************************************************************** ** ** ** InitOptionMenu() ** ** ** ** Creates the Option menu: cascade button, pull-down menu pane, and ** ** all menu-pane choices. Attaches callbacks to menu-pane choices. ** ** ** ***********************************************************************/ static void InitOptionMenu() { Arg args[1]; Widget topic, pane, choices[1]; pane = XmCreatePulldownMenu( menubar, "Option_Pane", NULL, 0 ); XtSetArg(args[0], XmNvisibleWhenOff, True); choices[0] = XmCreateToggleButton( pane, "Option_Justif", args, 1 ); choices[1] = XmCreateToggleButton( pane, "Option_Wrap", args, 1 ); XtManageChildren( choices, 2 ); XtAddCallback( choices[0], XmNvalueChangedCallback, JustifyCB, "Top" ); XtAddCallback( choices[1], XmNvalueChangedCallback, WrapCB, "Bot" ); XtSetArg( arglist[0], XmNsubMenuId, pane ); topic = XmCreateCascadeButton( menubar, "OptionTopic", arglist, 1 ); XtManageChild( topic ); MJustif = choices[0]; MWrap = choices[1]; } /*********************************************************************** ** ** ** InitHelpMenu() ** ** ** ** Creates the Help menu: cascade button, pull-down menu pane, and ** ** all menu-pane choices. Attaches callbacks to menu-pane choices. ** ** ** ***********************************************************************/ static void InitHelpMenu() { Widget topic, pane, choices[1]; pane = XmCreatePulldownMenu( menubar, "Help_Pane", NULL, 0 ); choices[0] = XmCreateLabel( pane, "Help_Lbl", NULL, 0 ); XtManageChildren( choices, 1 ); XtSetArg( arglist[0], XmNsubMenuId, pane ); topic = XmCreateCascadeButton( menubar, "HelpTopic", arglist, 1 ); XtManageChild( topic ); XtSetArg( arglist[0], XmNmenuHelpWidget, topic ); XtSetValues( menubar, arglist, 1 ); } static void EndEditor(int send) { /* exit( 0 ); */ XtUnmanageChild(mainwin); XtDestroyWidget(editshell); #ifndef __MAIN__ if (EditorOptions & ED_MESSAGE) { if (send) { char *txtbuf = XmTextGetString( textwin ); int size = strlen(txtbuf); int i; for (i = 0 ; i < size ; i++) { if (txtbuf[i] == '\n') txtbuf[i] = '\r'; } record_message(txtbuf, size); XtFree( txtbuf ); } else { record_message(NULL, 0); } } if ((EditorOptions & ED_MESSAGE) || (EditorOptions & ED_EDITMSG)) end_edit(FALSE); else end_edit(TRUE); #endif } /*********************************************************************** ** ** ** FileMenuCB( w, client_data, call_data ) ** ** ** ** Callback procedure for the "File" pull-down. This function is ** ** called when any of the file menu buttons are activated. The ** ** particular operation is identified by a string accessed by the ** ** "client_data" param. ** ** ** ** Note: This callback is only invoked on Activate, so the call ** ** data (which describes the reason) is superfluous. It is ** ** therefore not declared as a specific type in the func hdr. ** ** ** ***********************************************************************/ static void FileMenuCB( w, client_data, call_data ) Widget w; char *client_data; caddr_t call_data; { if (!strcmp(client_data, "New")) FileNew(); else if (!strcmp(client_data, "Opn")) FileOpen(); else if (!strcmp(client_data, "Ins")) FileInsert(); else if (!strcmp(client_data, "Sav")) FileSave(); else if (!strcmp(client_data, "SAs")) FileSaveAs(); else if (!strcmp(client_data, "Del")) { EndEditor(FALSE); } else if (!strcmp(client_data, "Ext")) { if (changed) XtManageChild( save_alert ); else EndEditor(FALSE); } } /*********************************************************************** ** ** ** ViewMenuCB( w, client_data, call_data ) ** ** ** ** Callback procedure for the "Edit" pull-down. This function is ** ** called when any of the menu buttons are activated. The choice ** ** is identified by a string pointed-to by the "client_data" parm. ** ** "client_data" param. ** ** ** ** Note: This callback is only invoked on Activate, so the call ** ** data (which describes the reason) is superfluous. It is ** ** therefore not declared as a specific type in the func hdr. ** ** ** ***********************************************************************/ static void ViewMenuCB( w, client_data, call_data ) Widget w; char *client_data; XmAnyCallbackStruct *call_data; { if (!strcmp(client_data, "Top")) { XmTextSetInsertionPosition(textwin, (XmTextPosition) 0); } else if (!strcmp(client_data, "Bot")) { XmTextSetInsertionPosition(textwin, (XmTextPosition) MAXLONG); } } /*********************************************************************** ** ** ** EditMenuCB( w, client_data, call_data ) ** ** ** ** Callback procedure for the "Edit" pull-down. This function is ** ** called when any of the menu buttons are activated. The choice ** ** is identified by a string pointed-to by the "client_data" parm. ** ** "client_data" param. ** ** ** ** Note: This callback is only invoked on Activate, so the call ** ** data (which describes the reason) is superfluous. It is ** ** therefore not declared as a specific type in the func hdr. ** ** ** ***********************************************************************/ static void EditMenuCB( w, client_data, call_data ) Widget w; char *client_data; XmAnyCallbackStruct *call_data; { XButtonEvent *event = (XButtonEvent *)call_data->event; if (!strcmp(client_data, "Cut")) XmTextCut( textwin, event->time ); else if (!strcmp(client_data, "Cpy")) XmTextCopy( textwin, event->time ); else if (!strcmp(client_data, "Pst")) XmTextPaste( textwin ); else if (!strcmp(client_data, "Del")) { } else if (!strcmp(client_data, "Fnd")) { ManageFindDB(); } else if (!strcmp(client_data, "Rpl")) { } } /*********************************************************************** ** ** ** InitFiler() ** ** ** ** This function initializes the filer module: it clears the current ** ** filename, disables the File/Save menu choice, and creates the ** ** Standard File dialog. ** ** ** ***********************************************************************/ void InitFiler() { stdfile_db = XmCreateFileSelectionDialog( mainwin, "StdFile", NULL, 0 ); XtAddCallback( stdfile_db, XmNokCallback, (XtPointer)SFProc, NULL ); XtAddCallback( stdfile_db, XmNcancelCallback, (XtPointer)UnmanageStdFile, NULL ); XtAddCallback( stdfile_db, XmNhelpCallback, (XtPointer)UnmanageStdFile, NULL ); } /*********************************************************************** ** ** ** ManageStdFile( title, proc, defspec ) ** ** ** ** This function manages the Standard File dialog. It sets the ** ** dialog's title to the string passed as "title", installs the ** ** function passed as "proc" in the "fileproc" variable (it gets ** ** called by the StdFile callback handler), and stores the string ** ** passed in "defspec" in the "dirSpec" resource. ** ** ** ***********************************************************************/ static void ManageStdFile( title, proc, defspec ) char *title; XtCallbackProc proc; char *defspec; { XmString temp1, temp2; temp1 = XmStringCreate( title, XmSTRING_DEFAULT_CHARSET ); if (defspec == NULL) temp2 = XmStringCreate( "", XmSTRING_DEFAULT_CHARSET ); else temp2 = XmStringCreate( defspec, XmSTRING_DEFAULT_CHARSET ); XtSetArg( arglist[0], XmNdialogTitle, temp1 ); XtSetArg( arglist[1], XmNdirSpec, temp2 ); XtSetValues( stdfile_db, arglist, 2 ); XmStringFree( temp1 ); XmStringFree( temp2 ); XmFileSelectionDoSearch( stdfile_db, NULL ); XtManageChild( stdfile_db ); fileproc = (XtPointer)proc; } /*********************************************************************** ** ** ** UnmanageStdFile() ** ** ** ** This function unmanages the Standard File dialog. It is attached ** ** to the "Cancel" and "Help" buttons, because XmFileSelectionBox ** ** does not handle the "autoUnmanage" resource. ** ** ** ***********************************************************************/ static void UnmanageStdFile() { XtUnmanageChild( stdfile_db ); } /*********************************************************************** ** ** ** SFProc( w, client_data, call_data ) ** ** ** ** This function is the callback procedure for the Standard File ** ** dialog. It stores the chosen filename in "curfile", and then ** ** calls the function pointed-to by "fileproc". ** ** ** ***********************************************************************/ static void SFProc(w, client_data, call_data ) Widget w; caddr_t client_data; XmFileSelectionBoxCallbackStruct *call_data; { if (curfile != NULL) free( curfile ); XmStringGetLtoR( call_data->value, XmSTRING_DEFAULT_CHARSET, &curfile ); UnmanageStdFile(); (*fileproc)(); } /*********************************************************************** ** ** ** ReadProc() ** ** ** ** This function reads the file specified by "curfile" into the ** ** editor's text buffer. ** ** ** ***********************************************************************/ static void ReadProc() { FILE *infile = fopen( curfile, "rt" ); char *txtbuf; char *ptr; long size; int i; if (infile == NULL) /* Should display error */ return; fseek( infile, 0L, 2 ); size = ftell( infile ); rewind( infile ); txtbuf = XtMalloc( size+1 ); fread( txtbuf, sizeof(char), size, infile ); ptr = txtbuf; for (i = 0 ; i < size ; i++) { if (txtbuf[i] == '\r') continue; *ptr++ = txtbuf[i]; } *ptr = '\0'; XmTextSetString( textwin, txtbuf ); XtFree( txtbuf ); changed = FALSE; Update(); } /*********************************************************************** ** ** ** PreReadProc() ** ** ** ** This function reads the file specified by "curfile" into the ** ** editor's text buffer. Each line is preceeded with ">" ** ** ** ***********************************************************************/ #define SBUF 65000 static void PreReadProc() { FILE *infile; FILE *tmpfile; char *txtbuf; long size; char tmpname[80]; sprintf(tmpname, "/tmp/xfbbtmp.%d", getpid()); infile = fopen( curfile, "rt" ); if (infile == NULL) /* Should display error */ return; tmpfile = fopen( tmpname, "w+t"); if (tmpfile == NULL) { perror("open"); /* Should display error */ return; } txtbuf = XtMalloc( SBUF+1 ); txtbuf[0] = '>'; while (fgets(txtbuf+1, SBUF, infile)) { fputs(txtbuf, tmpfile); } XtFree( txtbuf ); fclose(infile); fseek( tmpfile, 0L, 2 ); size = ftell( tmpfile ); rewind( tmpfile ); txtbuf = XtMalloc( size+1 ); fread( txtbuf, sizeof(char), size, tmpfile ); XmTextSetString( textwin, txtbuf ); XtFree( txtbuf ); fclose ( tmpfile ); unlink( tmpname ); changed = FALSE; Update(); } /*********************************************************************** ** ** ** InsertProc() ** ** ** ** This function reads the file specified by "curfile" into the ** ** editor's text buffer. ** ** ** ***********************************************************************/ static void InsertProc() { FILE *infile = fopen( curfile, "rt" ); char *txtbuf; char *ptr; long size; int i; XmTextPosition position; if (infile == NULL) /* Should display error */ return; fseek( infile, 0L, 2 ); size = ftell( infile ); rewind( infile ); txtbuf = XtMalloc( size+1 ); fread( txtbuf, sizeof(char), size, infile ); ptr = txtbuf; for (i = 0 ; i < size ; i++) { if (txtbuf[i] == '\r') continue; *ptr++ = txtbuf[i]; } *ptr = '\0'; position = XmTextGetInsertionPosition( textwin); XmTextInsert( textwin, position, txtbuf ); XtFree( txtbuf ); changed = TRUE; Update(); } /*********************************************************************** ** ** ** WriteProc() ** ** ** ** This function writes the editor's text buffer into a file named ** ** by "curfile". ** ** ** ***********************************************************************/ static void WriteProc() { FILE *outfile; char *txtbuf; long size; outfile = fopen( curfile, "wt" ); if (outfile == NULL) /* Should display error */ return; txtbuf = XmTextGetString( textwin ); size = strlen(txtbuf); fwrite( txtbuf, sizeof(char), size, outfile ); fclose( outfile ); XtFree( txtbuf ); changed = FALSE; Update(); } /*********************************************************************** ** ** ** FileNew() ** ** ** ** This function is called from the File/New menu choice. It clears ** ** the text buffer, resets the current file, and disables the File/ ** ** Save menu choice. ** ** ** ***********************************************************************/ void FileNew() { XmTextSetString( textwin, "" ); if (curfile != NULL) free( curfile ); curfile = NULL; changed = FALSE; Update(); } /*********************************************************************** ** ** ** FileOpen() ** ** ** ** This function is called from the File/Open menu choice. All it ** ** does is invoke the Standard File dialog -- SFProc and ReadProc ** ** do the real work. ** ** ** ***********************************************************************/ void FileOpen() { ManageStdFile( "Open...", (XtPointer)ReadProc, NULL ); } /*********************************************************************** ** ** ** FileInsert() ** ** ** ** This function is called from the File/Open menu choice. All it ** ** does is invoke the Standard File dialog -- SFProc and ReadProc ** ** do the real work. ** ** ** ***********************************************************************/ void FileInsert() { ManageStdFile( "Insert...", (XtPointer)InsertProc, NULL ); } /*********************************************************************** ** ** ** FileSave() ** ** ** ** This function is a link to WriteProc(), which writes the text ** ** buffer into a file using the current filename. ** ** ** ***********************************************************************/ void FileSave() { if (curfile == NULL) FileSaveAs(); else WriteProc(); } /*********************************************************************** ** ** ** FileSaveAs() ** ** ** ** This function is called from the File/Save-As menu choice. It ** ** invokes the Standard File dialog, and links it to WriteProc. ** ** ** ***********************************************************************/ void FileSaveAs() { ManageStdFile( "Save As...", (XtPointer)WriteProc, curfile ); } /*********************************************************************** ** ** ** InitFindDB() ** ** ** ** Creates the "Find" dialog box, which is controlled by the ** ** Edit/Find... pull-down menu choice. ** ** ** ** Modifies the global variable "find_db", and local variables ** ** "find_txt", "find_ok_btn", and "find_nxt_btn". ** ** ** ***********************************************************************/ void InitFindDB() { Widget temp; find_db = XmCreateBulletinBoardDialog( mainwin, "FindDB", NULL, 0 ); find_lbl = XmCreateLabel( find_db, "Find_Lbl", NULL, 0 ); XtManageChild( find_lbl ); find_txt = XmCreateText( find_db, "Find_Txt", NULL, 0 ); XtManageChild( find_txt ); frep_lbl = XmCreateLabel( find_db, "Rep_Lbl", NULL, 0 ); XtManageChild( frep_lbl ); frep_txt = XmCreateText( find_db, "Rep_Txt", NULL, 0 ); XtManageChild( frep_txt ); find_sep = XmCreateSeparator( find_db, "Find_Sep", NULL, 0 ); XtManageChild( find_sep ); find_btn_1 = XmCreatePushButton( find_db, "Find_Btn1", NULL, 0 ); XtManageChild( find_btn_1 ); find_btn_2 = XmCreatePushButton( find_db, "Find_Btn2", NULL, 0 ); XtManageChild( find_btn_2 ); find_btn_3 = XmCreatePushButton( find_db, "Find_Btn3", NULL, 0 ); XtManageChild( find_btn_3 ); XtAddCallback( find_btn_1, XmNactivateCallback, (XtPointer)FindCB, NULL ); XtAddCallback( find_btn_2, XmNactivateCallback, (XtPointer)FindCanCB, NULL ); XtAddCallback( find_btn_3, XmNactivateCallback, (XtPointer)ReplaceCB, NULL ); XtSetArg( arglist[0], XmNdefaultButton, find_btn_1 ); XtSetValues( find_db, arglist, 1 ); find_str = XmStringCreate( "Find", XmSTRING_DEFAULT_CHARSET ); can_str = XmStringCreate( "Cancel", XmSTRING_DEFAULT_CHARSET ); next_str = XmStringCreate( "Next", XmSTRING_DEFAULT_CHARSET ); repl_str = XmStringCreate( "Replace",XmSTRING_DEFAULT_CHARSET ); done_str = XmStringCreate( "Done", XmSTRING_DEFAULT_CHARSET ); cantfind_db = XmCreateMessageDialog( mainwin, "CantFind", NULL, 0 ); temp = XmMessageBoxGetChild( cantfind_db, XmDIALOG_CANCEL_BUTTON ); XtUnmanageChild( temp ); temp = XmMessageBoxGetChild( cantfind_db, XmDIALOG_HELP_BUTTON ); XtUnmanageChild( temp ); } /*********************************************************************** ** ** ** ManageFindDB() ** ** ** ** Called when the dialog box is first presented, this function ** ** manages the DB and sets the labels of its buttons to "Find" ** ** and "Cancel". It also sets the "finding" flag FALSE, for the ** ** first call to FindCB. ** ** ** ***********************************************************************/ void ManageFindDB() { char *findstr; XtManageChild( find_db ); _XmGrabTheFocus( find_txt ); findstr = XmTextGetSelection( textwin ); if (findstr) { XtSetArg( arglist[0], XmNvalue, findstr ); XtSetValues( find_txt, arglist, 1 ); } XtSetArg( arglist[0], XmNlabelString, find_str ); XtSetValues( find_btn_1, arglist, 1 ); XtSetArg( arglist[0], XmNlabelString, can_str ); XtSetValues( find_btn_2, arglist, 1 ); XtSetArg( arglist[0], XmNlabelString, repl_str ); XtSetValues( find_btn_3, arglist, 1 ); XtSetSensitive( find_btn_3, FALSE); finding = FALSE; fd_start = fd_end = -1; } /*********************************************************************** ** ** ** FindCB( w, client_data, call_data ) ** ** ** ** Called from the "Find" or "Next" buttons of the Find DB. This ** ** function searches for the first/next occurrence of the search ** ** string. The "client_data" param points to a string -- "Fnd" or ** ** "Nxt" -- which indicates which button this is called from; it ** ** must initialize its local variables for the first call. ** ** ** ** In operation, this function searches for the next occurrence of ** ** the target string in the text buffer, and selects it. ** ** ** ***********************************************************************/ static void FindCB( w, client_data, call_data ) Widget w; char *client_data; XmAnyCallbackStruct *call_data; { char *findstr, *txtbuf, *txtptr; if (!finding) { finding = TRUE; curpos = 0; XtSetArg( arglist[0], XmNlabelString, next_str ); XtSetValues( find_btn_1, arglist, 1 ); XtSetArg( arglist[0], XmNlabelString, done_str ); XtSetValues( find_btn_2, arglist, 1 ); } findstr = XmTextGetString( find_txt ); txtbuf = XmTextGetString( textwin ); txtptr = StrFind( (txtbuf + curpos), findstr ); if (txtptr == NULL) { XtUnmanageChild( find_db ); XtManageChild( cantfind_db ); } else { fd_start = txtptr - txtbuf; fd_end = fd_start + strlen(findstr); XtSetArg( arglist[0], XmNcursorPosition, fd_end ); XtSetValues( textwin, arglist, 1 ); XmTextSetSelection( textwin, fd_start, fd_end, call_data->event->xbutton.time ); curpos = fd_start + 1; XtSetSensitive( find_btn_3, TRUE); } XtFree( txtbuf ); XtFree( findstr ); DisplayLC(textwin); } /*********************************************************************** ** ** ** ReplaceCB( w, client_data, call_data ) ** ** ** ** Called from the "Replace" button of the Find DB. This ** ** replaces the found text. ** ** ** ***********************************************************************/ static void ReplaceCB( w, client_data, call_data ) Widget w; char *client_data; XmAnyCallbackStruct *call_data; { char *replstr; if (fd_start == -1) return; replstr = XmTextGetString( frep_txt ); XmTextReplace( textwin, fd_start, fd_end, replstr ); curpos += (strlen(replstr) - (fd_end - fd_start)) ; XtFree( replstr ); DisplayLC(textwin); } /*********************************************************************** ** ** ** FindCanCB( w, client_data, call_data ) ** ** ** ** Called from the "Cancel" or "OK" buttons of the Find DB. This ** ** simply unmanages the DB. ** ** ** ***********************************************************************/ static void FindCanCB( w, client_data, call_data ) Widget w; char *client_data; XmAnyCallbackStruct *call_data; { XtUnmanageChild( find_db ); } /*********************************************************************** ** ** ** InitSaveProto() ** ** ** ** This function sets up the callback for the WM_DELETE_WINDOW ** ** protocol. To make this work, it must also modify the shell's ** ** deleteResponse resource -- otherwise the shell kills the job. ** ** ** ***********************************************************************/ void InitSaveProto(void) { a_del_win = XInternAtom( XtDisplay(editshell), "WM_DELETE_WINDOW", FALSE ); XmAddWMProtocolCallback( editshell, a_del_win, (XtPointer)SaveProtoCB, NULL ); XtSetArg( arglist[0], XmNdeleteResponse, XmDO_NOTHING ); XtSetValues( editshell, arglist, 1 ); InitSaveAlert(); } /*********************************************************************** ** ** ** InitSaveAlert() ** ** ** ** Creates the "Quit without Saving?" message box. ** ** ** ** Note: The "Help" button is changed to "Quit" for this dialog. ** ** ** ***********************************************************************/ static void InitSaveAlert() { Widget temp; if (EditorOptions & ED_MESSAGE) { save_alert = XmCreateWarningDialog( mainwin, "SendAlert", NULL, 0 ); temp = XmMessageBoxGetChild( save_alert, XmDIALOG_OK_BUTTON ); XtUnmanageChild(temp); temp = XmMessageBoxGetChild( save_alert, XmDIALOG_HELP_BUTTON ); XtAddCallback( temp, XmNactivateCallback, (XtPointer)AlertSaveCB, "Quit" ); } else { save_alert = XmCreateWarningDialog( mainwin, "SaveAlert", NULL, 0 ); temp = XmMessageBoxGetChild( save_alert, XmDIALOG_OK_BUTTON ); XtAddCallback( temp, XmNactivateCallback, (XtPointer)AlertSaveCB, "Save" ); temp = XmMessageBoxGetChild( save_alert, XmDIALOG_HELP_BUTTON ); XtAddCallback( temp, XmNactivateCallback, (XtPointer)AlertSaveCB, "Quit" ); } } /*********************************************************************** ** ** ** SaveProtoCB( w, client_data, call_data ) ** ** ** ** This function handles the callback for the WM_DELETE_WINDOW ** ** protocol. It displays a dialog, which queries whether or not ** ** the workspace should be saved. ** ** ** ***********************************************************************/ static void SaveProtoCB( w, client_data, call_data ) Widget w; caddr_t client_data; XmAnyCallbackStruct *call_data; { if (changed) XtManageChild( save_alert ); else EndEditor(FALSE); } /*********************************************************************** ** ** ** AlertSaveCB( w, client_data, call_data ) ** ** ** ** Callback for the "Quit without Saving?" message box. ** ** This function either quits or saves then quits. ** ** ** ***********************************************************************/ static void AlertSaveCB( w, client_data, call_data ) Widget w; char *client_data; caddr_t call_data; { if (!strcmp(client_data, "Save")) { changed = FALSE; XtAppAddWorkProc(app_context, (XtPointer)AlertSaveWP, NULL ); FileSave(); } else EndEditor(FALSE); } /*********************************************************************** ** ** ** AlertSaveWP( client_data ) ** ** ** ** Workproc to handle wait while user saves file. This function ** ** simply waits until the global variable "saved" becomes TRUE. ** ** ** ***********************************************************************/ static Boolean AlertSaveWP( client_data ) caddr_t client_data; { if (!changed) { EndEditor(FALSE); return(TRUE); } else return( FALSE ); } /*********************************************************************** ** ** ** InitOther() ** ** ** ** This function performs other program initialization, such as ** ** loading any default data. ** ** ** ***********************************************************************/ void InitOther(void) { InitAlerts(); InitFiler(); InitFindDB(); InitSaveProto(); } /*********************************************************************** ** ** ** StrFind( s1, s2 ) ** ** ** ** Returns a pointer to the first occurrence of string s2 in ** ** string s1. Returns NULL is s2 does not occur in s1. ** ** ** ***********************************************************************/ char *StrFind( s1, s2 ) char *s1; char *s2; { char *tmps1; char *tmps2; for ( ; *s1 != '\0' ; s1++) { if (*s1 == *s2) { tmps1 = s1; tmps2 = s2; for ( ; (*s1 == *tmps2) && (*s1 != '\0') ; s1++, tmps2++) ; if (*tmps2 == '\0') return( tmps1 ); } } return( NULL ); } /*********************************************************************** ** ** ** InitAlerts() ** ** ** ** Creates all message boxes. ** ** ** ***********************************************************************/ void InitAlerts(void) { InitFindAlert(); } /*********************************************************************** ** ** ** InitFindAlert() ** ** ** ** Creates the "Search Failed" message box for Find. ** ** ** ***********************************************************************/ static void InitFindAlert(void) { Widget temp; find_alert = XmCreateMessageDialog( mainwin, "FindAlert", NULL, 0 ); temp = XmMessageBoxGetChild( find_alert, XmDIALOG_CANCEL_BUTTON ); XtUnmanageChild( temp ); temp = XmMessageBoxGetChild( find_alert, XmDIALOG_HELP_BUTTON ); XtUnmanageChild( temp ); } /*********************************************************************** ** ** ** AlertFindFailed() ** ** ** ** Manages the "Search Failed" message box. ** ** ** ***********************************************************************/ /* void AlertFindFailed(void) { XtManageChild( find_alert ); } */ fbb-7.04j/src/X11/Makefile0100644000175100017510000000506107726646105013221 0ustar abaaba AX25LIBPATH = /usr/lib AX25INCPATH = /usr/include/netax25 XINCLUDE = -I/usr/X11R6/LessTif/Motif2.0/include -I/usr/X11R6/include OLD_AX25 := $(shell test -f /usr/include/ax25/axutils.h && echo 1) ifeq ($(OLD_AX25), 1) DEFS = -DOLD_AX25 endif CC = gcc CFLAGS = -Wall -Wstrict-prototypes -O2 -g -funsigned-char $(DEFS) -D__LINUX__ -DPROTOTYPES -I../../include $(XINCLUDE) -I$(AX25INCPATH) LIBS = -L$(AX25LIBPATH) -lm -lax25 XLIBS = -L/usr/X11R6/lib -L/usr/X11R6/LessTif/Motif2.0/lib -lXm -lXt -lXpm -lXext -lX11 COMMON_OBJECTS = \ ../arbre.o\ ../autobin.o\ ../balise.o\ ../bidexms.o\ ../conf.o\ ../console.o\ ../date.o\ ../devio.o\ ../dos_1.o\ ../dos_dir.o\ ../driver.o\ ../drv_aea.o\ ../drv_ded.o\ ../drv_hst.o\ ../drv_kam.o\ ../drv_mod.o\ ../drv_pop.o\ ../drv_sock.o\ ../drv_tcp.o\ ../edit.o\ ../ems.o\ ../error.o\ ../exec_pg.o\ ../fbb_conf.o\ ../fortify.o\ ../forward.o\ ../fwdovl1.o\ ../fwdovl2.o\ ../fwdovl3.o\ ../fwdovl4.o\ ../fwdovl5.o\ ../fwdovl6.o\ ../fwdovl7.o\ ../fwdutil.o\ ../gesfic.o\ ../ibm.o\ ../info.o\ ../init.o\ ../init_srv.o\ ../init_tnc.o\ ../initfwd.o\ ../initport.o\ ../k_tasks.o\ ../kernel.o\ ../lzhuf.o\ ../maint_fw.o\ ../mbl_edit.o\ ../mbl_expo.o\ ../mbl_impo.o\ ../mbl_kill.o\ ../mbl_lc.o\ ../mbl_list.o\ ../mbl_log.o\ ../mbl_menu.o\ ../mbl_opt.o\ ../mbl_prn.o\ ../mbl_read.o\ ../mbl_rev.o\ ../mbl_stat.o\ ../mbl_sys.o\ ../mbl_user.o\ ../mblutil.o\ ../md5c.o\ ../modem.o\ ../nomenc.o\ ../nouvfwd.o\ ../pac_crc.o\ ../pacsat.o\ ../qraloc.o\ ../redist.o\ ../rx25.o\ ../serv.o\ ../serveur.o\ ../statis.o\ ../themes.o\ ../tnc.o\ ../tncio.o\ ../trait.o\ ../trajec.o\ ../trajovl.o\ ../variable.o\ ../warning.o\ ../watchdog.o\ ../waveplay.o\ ../wp.o\ ../wp_mess.o\ ../wpserv.o\ ../xfwd.o\ ../xmodem.o\ ../yapp.o X_OBJETS = \ xfbbabtd.o\ xfbbcnsl.o\ xfbbedtm.o\ xfbbedtu.o\ xfbblcnx.o\ xfbbmain.o\ xfbbpndd.o\ xeditor.o XC_OBJETS = \ ../md5c.o \ xfbbXabtd.o\ xfbbXcnsl.o all : xfbb xfbbX_cl clean : $(RM) *.o *.orig core $(RM) xfbbX_cl xfbb xfbb: $(COMMON_OBJETS) $(X_OBJETS) xfbb.o $(CC) $(CFLAGS) -o xfbb xfbb.o $(COMMON_OBJECTS) $(X_OBJETS) $(LIBS) $(XLIBS) xfbb.o : xfbb.c $(CC) $(CFLAGS) -c -o xfbb.o xfbb.c xfbbX_cl: $(XC_OBJETS) xfbbX.o $(CC) $(CFLAGS) -o xfbbX_cl xfbbX.o $(XC_OBJETS) $(LIBS) $(XLIBS) xfbbX.o : xfbbX.c $(CC) $(CFLAGS) -c -o xfbbX.o xfbbX.c fbb-7.04j/src/X11/xfbb.c0100644000175100017510000012111107726646105012641 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #define PUBLIC #include #include #include /* Added Satoshi Yasuda for NLS */ #include #include #include static void HelpAct (Widget, XEvent *, String *, Cardinal*); static void ConsoleAct(Widget, XEvent *, String *, Cardinal*); static void DisconnAct(Widget, XEvent *, String *, Cardinal*); static void PendingAct(Widget, XEvent *, String *, Cardinal*); static void MonitorAct(Widget, XEvent *, String *, Cardinal*); static void SetCallAct(Widget, XEvent *, String *, Cardinal*); static void ProgTncAct(Widget, XEvent *, String *, Cardinal*); static void GatewayAct(Widget, XEvent *, String *, Cardinal*); static void TalkToAct (Widget, XEvent *, String *, Cardinal*); static void MsgScanAct(Widget, XEvent *, String *, Cardinal*); static void EditorAct (Widget, XEvent *, String *, Cardinal*); static void ListCnxAct(Widget, XEvent *, String *, Cardinal*); static void SndTextAct(Widget, XEvent *, String *, Cardinal*); static void ChoCB(Widget, XtPointer, XtPointer); static void ScanCB(Widget, XtPointer, XtPointer); static void FHelpCB(Widget, XtPointer, XEvent *); static XtActionsRec actionsTable[] = { { "Help", HelpAct }, { "Console", ConsoleAct }, { "Disconnect", DisconnAct }, { "PendingFwd", PendingAct }, { "Monitor", MonitorAct }, { "SetCall", SetCallAct }, { "ProgTnc", ProgTncAct }, { "Gateway", GatewayAct }, { "TalkTo", TalkToAct }, { "MsgScan", MsgScanAct }, { "Editor", EditorAct }, { "ListCnx", ListCnxAct }, { "SndText", SndTextAct } }; static int init_phase = 1; static int StopOn = FALSE; static Widget MTalkTo; static Widget MShow; static Widget MInfos; static Widget MDiscon; static Widget MImDisc; static Widget MEdit; static Widget MScan; static Widget MCho; void TalkToCB(Widget w, XtPointer client_data, XtPointer call_data); void OneChanCB(Widget w, XtPointer client_data, XtPointer call_data); void DisconnectCB(Widget w, XtPointer client_data, XtPointer call_data); static void sig_fct(int sig) { /* int pid, pstatus; */ sig &= 0xff; signal(sig, sig_fct); printf("Signal received = %d\n", sig); /* pid = wait(&pstatus); */ switch(sig) { case SIGHUP : /* reload system files */ printf("Update system files\n"); init_buf_fwd(); init_buf_swap(); init_buf_rej(); init_bbs(); break; case SIGTERM: /* end of session */ printf("Closing connections\n"); maintenance() ; fbb_quit(1); break; case SIGBUS: /* end of session */ fprintf(stderr, "xfbbd : Bus error\n"); exit(5); break; case SIGSEGV: /* end of session */ fprintf(stderr, "xfbb : Segmentation violation\n"); exit(5); break; } } int SetChList(int clean) { int i; int ok = 0; int pos = 0; for (i = 0; i < NBVOIES ; i++) { if ((svoie[i]->sta.connect)) { ++pos; if (i == CurrentSelection) { XmListSelectPos(ConnectList, pos, TRUE); ok = 1; break; } } } if ((clean) && (!ok)) XmListDeselectAllItems(ConnectList); return 1; } int GetChList(void) { int numero = -1; int *array; int pos; int nb; int i; if ((XmListGetSelectedPos(ConnectList, &array, &nb)) && (nb > 0)) { /* position de la selection */ nb = array[0]; /* recherche du numero de canal */ pos = 1; for (i = 0; i < NBVOIES ; i++) { if (svoie[i]->sta.connect) { if (pos == nb) { numero = i; break; } ++pos; } } free(array); } return(numero); } static Pixel CreeCouleur(Widget w, int couleur) { XColor tcolor; tcolor.pixel = 0; tcolor.red = ((couleur >> 16) & 0xff) << 8; tcolor.green = ((couleur >> 8 ) & 0xff) << 8; tcolor.blue = (couleur & 0xff) << 8; tcolor.flags = DoRed|DoGreen|DoBlue; XAllocColor(XtDisplay(w), DefaultColormapOfScreen(XtScreen(w)), &tcolor); return(tcolor.pixel); } static XmRendition CreeCouleurRendition(Widget w, Pixel couleur, char *nom) { Arg args[10] ; Cardinal n; n = 0; XtSetArg(args[n], XmNrenditionForeground, couleur); n++; return XmRenditionCreate(w, nom, args, n); } void CreateRendition(Widget w) { r_index = 0; XtVaGetValues(form, XmNbackground, &df_pixel, NULL); rc_pixel = CreeCouleur(w, 0xff0000); r_rend[r_index++] = CreeCouleurRendition(w, rc_pixel, "RC"); vc_pixel = CreeCouleur(w, 0x00ff00); r_rend[r_index++] = CreeCouleurRendition(w, vc_pixel, "VC"); bc_pixel = CreeCouleur(w, 0x0000ff); r_rend[r_index++] = CreeCouleurRendition(w, bc_pixel, "BC"); no_pixel = CreeCouleur(w, 0x000000); r_rend[r_index++] = CreeCouleurRendition(w, no_pixel, "NO"); rf_pixel = CreeCouleur(w, 0x800000); r_rend[r_index++] = CreeCouleurRendition(w, rf_pixel, "RF"); vf_pixel = CreeCouleur(w, 0x008000); r_rend[r_index++] = CreeCouleurRendition(w, vf_pixel, "VF"); bf_pixel = CreeCouleur(w, 0x000080); r_rend[r_index++] = CreeCouleurRendition(w, bf_pixel, "BF"); } void ToolIcons(void) { int i; int numero; static int OldIconState[NB_ICON]; int IconState[NB_ICON]; static int first = 1; static int cho = -1; static int scanning = -1; static Pixel TopShadow; static Pixel BottomShadow; int port = is_pactor(); if (first) { XtVaGetValues(BIcon[0], XmNtopShadowColor, &TopShadow, XmNbottomShadowColor, &BottomShadow, NULL); XtSetSensitive(BIcon[13], TRUE); } if (MenuPactor) { if (scanning != pactor_scan[port]) { scanning = pactor_scan[port]; XmToggleButtonSetState(MScan, scanning, FALSE); } if ((ONLINE(port)) && (cho != 1)) XtSetSensitive(MCho, TRUE); else if (cho != 0); XtSetSensitive(MCho, FALSE); cho = ONLINE(port);; } for (i = 0 ; i < NB_ICON ; i++) IconState[i] = FALSE; IconState[0] = TRUE; IconState[1] = TRUE; IconState[2] = TRUE; IconState[3] = TRUE; IconState[8] = TRUE; IconState[9] = TRUE; IconState[10] = TRUE; IconState[11] = TRUE; IconState[12] = !editor_on(); IconState[13] = print; /* IconState[14] = TRUE; */ IconState[15] = TRUE; numero = GetChList(); if (numero == -1) { IconState[4] = FALSE; IconState[5] = FALSE; IconState[6] = FALSE; IconState[7] = FALSE; } else if (numero == CONSOLE) { IconState[4] = (svoie[CONSOLE]->sta.connect); IconState[5] = TRUE; } else { IconState[4] = TRUE; IconState[5] = TRUE; IconState[6] = TRUE; IconState[7] = (svoie[CONSOLE]->sta.connect == 0) && (can_talk(numero)); } for (i = 0 ; i < NB_ICON ; i++) { if (OldIconState[i] != IconState[i]) { /* Menues associated to icons */ Widget MenuW = NULL; Widget MenuX = NULL; switch(i) { case 4: MenuW = MShow; break; case 5: MenuW = MInfos; break; case 6: MenuW = MDiscon; MenuX = MImDisc; break; case 7: MenuW = MTalkTo; break; case 12: MenuW = MEdit; break; default: MenuW = NULL; break; } if (i == 13) { /* Bouton PRINT */ if (IconState[i]) { XtVaSetValues(BIcon[i], XmNtopShadowColor, BottomShadow, XmNbottomShadowColor, TopShadow, NULL); } else { XtVaSetValues(BIcon[i], XmNtopShadowColor, TopShadow, XmNbottomShadowColor, BottomShadow, NULL); } } else { XtSetSensitive(BIcon[i], IconState[i]); if (MenuW) XtSetSensitive(MenuW, IconState[i]); if (MenuX) XtSetSensitive(MenuX, IconState[i]); } OldIconState[i] = IconState[i]; } } } void Caption(void) { time_t temps; struct tm tmg; struct tm tml; char buf[80]; static int lmin = -1; temps = time(NULL); tmg = *(gmtime(&temps)); tml = *(localtime(&temps)); if (tmg.tm_min != lmin) { lmin = tmg.tm_min; sprintf(buf, "XFBB - %s-%d - %02d:%02d UTC", mycall, myssid, tmg.tm_hour, tmg.tm_min); XtVaSetValues(toplevel, XmNtitle, buf, NULL); } } void InitText(char *text) { static char *initext[NB_INIT_B] = { "Reading INIT.SRV", "Reading Texts (%s)", "Ports configuration (%s)", "TNC configuration (%s)", "Servers & PG (%s)", "Loading BIDs (%s)", "Callsigns set-up (%s)", "Messages set-up (%s)", "WP set-up (%s)", "Forward set-up (%s)", "BBS set-up (%s)" }; char str[80]; Arg args[10] ; Cardinal n = 0; int rouge = ((DEBUG) && ((init_phase == 2) || (init_phase == 3))); if (init_phase > NB_INIT_B) return; n = 0; XtSetArg(args[n], XmNset, TRUE); n++; XtSetValues(Tb[init_phase-1], args, n); sprintf(str, initext[init_phase-1], text); LabelSetString(Tb[init_phase-1], str, (rouge) ? "RC" : NULL); } Boolean InitWorkProc(XtPointer data) { if (step_initialisations (init_phase)) { /* Initialisation is finished */ int i; /* Delete init window and map main window */ for (i = 0 ; i < NB_INIT_B ; i++) { XtUnmapWidget(Tb[i]); } XtManageChild(ConnectLabel); XtManageChild(ConnectString); XtManageChild(ConnectList); if (is_pactor()) { Widget bouton; Arg args[10] ; MenuPactor = XmCreatePulldownMenu(MenuBar,"pactor", args, 0); XtSetArg(args[0], XmNsubMenuId, MenuPactor); bouton = XmCreateCascadeButton(MenuBar,"pactor", args, 1); XtManageChild(bouton); MScan = add_item(TOGGLE, MenuPactor, "scanning", ScanCB, NULL, "Start/stop frequency scanning", FHelpCB); MCho = add_item(BUTTON, MenuPactor, "changeover", ChoCB, NULL, "Send a change-over", FHelpCB); } return (TRUE); } /* Next step */ ++init_phase; return(FALSE); } Boolean KernelWorkProc(XtPointer data) { static int running = 0; if (running) { /* printf("Kernel %d\n", ++val); */ ToolIcons(); Caption(); kernel(); FbbMem(0); if (is_idle) { usleep(1); } else { is_idle = 1; } } else { running = InitWorkProc(NULL); } return(FALSE); } /* right click in the list */ void PostIt(Widget w, Widget popup, XButtonEvent *event) { int i; int nb; int numero; int pos; xprintf("YPos = %d\n", event->y); pos = XmListYToPos(ConnectList, event->y); nb = 0; for (i = 0 ; i < NBVOIES ; i++) { if (svoie[i]->sta.connect) ++nb; } if ((pos == 0) || (pos > nb)) { XmListDeselectAllItems(ConnectList); CurrentSelection = -1; return; } if (event->button != Button3) return; XmListSelectPos(ConnectList, pos, TRUE); numero = GetChList(); CurrentSelection = numero; if (numero == -1) { for (i = 0 ; i < NB_PITEM ; i++) XtSetSensitive(PItem[i], FALSE); } else if (numero == CONSOLE) { XtSetSensitive(PItem[0], FALSE); XtSetSensitive(PItem[1], TRUE); XtSetSensitive(PItem[2], TRUE); XtSetSensitive(PItem[3], FALSE); XtSetSensitive(PItem[4], FALSE); } else { int val; val = (svoie[CONSOLE]->sta.connect == 0) && (can_talk(numero)); XtSetSensitive(PItem[0], val); XtSetSensitive(PItem[1], TRUE); XtSetSensitive(PItem[2], TRUE); XtSetSensitive(PItem[3], TRUE); XtSetSensitive(PItem[4], TRUE); } XmMenuPosition(popup, event); XtManageChild(popup); } static void EditFileCB(Widget w, XtPointer client_data, XtPointer call_data) { if (EditorOff) { EditorOff = FALSE; CreateEditor(NULL, NULL, "Edit system file", 0, 0); } } void ItemCB(Widget w, XtPointer client_data, XtPointer call_data) { int numero = (int)client_data; printf("ItemCB = %d\n", numero); switch(numero) { case 0 : /* Talk */ TalkToCB(w, client_data, call_data); break; case 1 : /* Show */ OneChanCB(w, client_data, call_data); break; case 2 : /* Infos */ InfoDialog(w, client_data, call_data); break; case 3 : /* Disconnect */ DisconnectCB(w, client_data, call_data); break; case 4 : /* Immediate Disconnect */ DisconnectCB(w, client_data, call_data); break; } } void ActiveListCB(Widget w, XtPointer client_data, XtPointer call_data) { CurrentSelection = GetChList(); } void SelectListCB(Widget w, XtPointer client_data, XtPointer call_data) { CurrentSelection = GetChList(); if (CurrentSelection != -1) { /* Selection d'un canal */ ShowFbbWindow(CurrentSelection, toplevel); } } void ConsoleCB(Widget w, XtPointer client_data, XtPointer call_data) { /* Connexion en console */ cursor_wait(); ShowFbbWindow(CONSOLE, toplevel); connect_console(); end_wait(); } void GatewayCB(Widget w, XtPointer client_data, XtPointer call_data) { ShowFbbWindow(CONSOLE, toplevel); connect_tnc(); traite_voie(CONSOLE); } void AllChanCB(Widget w, XtPointer client_data, XtPointer call_data) { ToggleFbbWindow(ALLCHAN, toplevel); } void OneChanCB(Widget w, XtPointer client_data, XtPointer call_data) { int canal = GetChList(); if (canal == 0) { ShowFbbWindow(canal, toplevel); } else if (canal > 0) { ToggleFbbWindow(canal, toplevel); } else { MessageBox(60, "No selected callsign", "DISPLAY", MB_ICONEXCLAMATION|MB_OK); } } void DisconnectCB(Widget w, XtPointer client_data, XtPointer call_data) { int voie = GetChList(); int immediate = ((int)client_data == 4); if (voie > 0) { int res; char texte[80]; if (immediate) sprintf(texte, "Immediate disconnect %s", svoie[voie]->sta.indicatif.call); else sprintf(texte, "Disconnect %s", svoie[voie]->sta.indicatif.call); res = MessageBox(60, texte, "DISCONNECT", MB_ICONEXCLAMATION|MB_OKCANCEL); if (res == IDOK) { disconnect_channel(voie, immediate); } } else { MessageBox(60, "No selected callsign", "DISCONNECT", MB_ICONEXCLAMATION|MB_OK); } } void MonitorCB(Widget w, XtPointer client_data, XtPointer call_data) { ToggleFbbWindow(MMONITOR, toplevel); } static void ScanCB(Widget w, XtPointer client_data, XtPointer call_data) { char cmde[80]; int port = is_pactor(); /* Start/Stop scanning */ sprintf(cmde, "PTCTRX SCAN %d", !pactor_scan[port]); ptctrx(0, cmde); } static void ChoCB(Widget w, XtPointer client_data, XtPointer call_data) { int port = is_pactor(); if ((port) && (ONLINE(port))) { /* Tue l'eventuel timer en cours */ del_timer(p_port[port].t_iss); p_port[port].t_iss = NULL; if (ISS(port)) { tor_stop(p_port[port].pr_voie); printf("CHO\r\n"); } else { tor_start(p_port[port].pr_voie); printf("BRK\r\n"); } } } void ScanSysCB(Widget w, XtPointer client_data, XtPointer call_data) { cursor_wait(); init_buf_fwd(); init_buf_swap(); init_buf_rej(); init_bbs(); end_wait(); } void ScanMsgCB(Widget w, XtPointer client_data, XtPointer call_data) { printf("ScanMsg = %d\n", ((XmToggleButtonCallbackStruct*)call_data)->set ); scan_fwd(!p_forward); } void OptionsCB(Widget w, XtPointer client_data, XtPointer call_data) { printf("Option CB %d = %d\n", (int)client_data, ((XmToggleButtonCallbackStruct*)call_data)->set ); set_option((int)client_data,((XmToggleButtonCallbackStruct*)call_data)->set); } void TalkToCB(Widget w, XtPointer client_data, XtPointer call_data) { int voie; char texte[80]; char callsign[80]; voie = GetChList(); if (voie > 0) { strcpy(callsign, svoie[voie]->sta.indicatif.call); if (!talk_to(voie)) { wsprintf(texte, "Can't talk to %s", callsign); MessageBox(60,texte, "TALK", MB_ICONEXCLAMATION|MB_OK); } } else { MessageBox(60, "No selected callsign", "TALK", MB_ICONEXCLAMATION|MB_OK); } } void MaintCB(Widget w, XtPointer client_data, XtPointer call_data) { if ((!StopOn) && (fct_arret(3))) { XtSetSensitive(BIcon[14], TRUE); XtMapWidget(BIcon[14]); StopOn = TRUE; } } void RerunCB(Widget w, XtPointer client_data, XtPointer call_data) { if ((!StopOn) && (fct_arret(2))) { XtSetSensitive(BIcon[14], TRUE); XtMapWidget(BIcon[14]); StopOn = TRUE; } } void ExitCB(Widget w, XtPointer client_data, XtPointer call_data) { printf("ExitCB\n"); if ((!StopOn) && (fct_arret(1))) { XtSetSensitive(BIcon[14], TRUE); XtMapWidget(BIcon[14]); StopOn = TRUE; } } void StopCB(Widget w, XtPointer client_data, XtPointer call_data) { if (operationnel == 1) { cursor_wait(); maintenance() ; end_wait(); fbb_quit(type_sortie); } } void PrintCB(Widget w, XtPointer client_data, XtPointer call_data) { print = !print; printf("print = %d\n", print); if (!print) close_print(); } void LabelSetString(Widget label, char *text, char *attr) { Arg args[10] ; Cardinal n = 0; XmString string; if (text == NULL) return; if (attr) string = XmStringGenerate(text, NULL, XmCHARSET_TEXT, attr); else string = XmStringCreateSimple(text); n = 0; XtSetArg(args[n], XmNlabelString, string); n++; XtSetValues(label, args, n); XmStringFree(string); FbbSync(); } static void FHelpCB(Widget w, XtPointer client_data, XEvent *event) { static XmString prev = NULL; if (client_data) { XmString string; if (prev) XmStringFree(prev); XtVaGetValues(Footer, XmNlabelString, &prev, NULL); string = XmStringCreateSimple((char *)client_data); XtVaSetValues(Footer, XmNlabelString, string, NULL); XmStringFree(string); foothelp = TRUE; } else { if (prev) XtVaSetValues(Footer, XmNlabelString, prev, NULL); foothelp = FALSE; } } Widget add_item(int type, Widget menu_pane, char *nom, XtPointer callback, XtPointer data, char *help, XtPointer HelpCB) { Arg args[10] ; Cardinal n = 0; Widget bouton = NULL; if ((callback == NULL) && (type != SEPARATOR) && (type != TOOLBUTTON)) { XtSetArg(args[n], XmNsensitive, False); n++; } switch (type) { case SEPARATOR: bouton = XmCreateSeparator(menu_pane, nom, args, n); break; case BUTTON: bouton = XmCreatePushButton(menu_pane, nom, args, n); if (callback) XtAddCallback(bouton, XmNactivateCallback, callback, data); break; case TOGGLE: XtSetArg(args[n], XmNvisibleWhenOff, True); n++; bouton = XmCreateToggleButton(menu_pane, nom, args, n); if (callback) XtAddCallback(bouton, XmNvalueChangedCallback, callback, data); break; case TOOLBUTTON: XtSetArg(args[n], XmNhighlightThickness, 0);n++; XtSetArg(args[n], XmNlabelType, XmPIXMAP);n++; XtSetArg(args[n], XmNsensitive, FALSE);n++; bouton = XmCreatePushButton(menu_pane, nom, args, n); if (callback) XtAddCallback(bouton, XmNactivateCallback, callback, data); break; } if (help) { XtAddEventHandler(bouton, EnterWindowMask, FALSE, HelpCB, (XtPointer) help); XtAddEventHandler(bouton, LeaveWindowMask, FALSE, HelpCB, NULL); } XtManageChild(bouton); return(bouton); } void AddRT(Widget w) { XmRenderTable rt; XtVaGetValues(w, XmNrenderTable, &rt, NULL, NULL); /* Make a copy so that setvalues will work correctly */ rt = XmRenderTableCopy(rt, NULL, 0); rt = XmRenderTableAddRenditions(rt, r_rend, r_index, XmMERGE_NEW); XtVaSetValues(w, XmNrenderTable, rt, NULL, NULL); XmRenderTableFree(rt); } /* Translations */ static void HelpAct (Widget w, XEvent *event, String *parms, Cardinal *num) { AboutDialog(w, NULL, NULL); } static void ConsoleAct(Widget w, XEvent *event, String *parms, Cardinal *num) { ConsoleCB(w, NULL, NULL); } static void DisconnAct(Widget w, XEvent *event, String *parms, Cardinal *num) { DisconnectCB(w, NULL, NULL); } static void PendingAct(Widget w, XEvent *event, String *parms, Cardinal *num) { PendingCB(w, NULL, NULL); } static void MonitorAct(Widget w, XEvent *event, String *parms, Cardinal *num) { MonitorCB(w, NULL, NULL); } static void SetCallAct(Widget w, XEvent *event, String *parms, Cardinal *num) { CallsignDialog(w, NULL, NULL); } static void ProgTncAct(Widget w, XEvent *event, String *parms, Cardinal *num) { } static void GatewayAct(Widget w, XEvent *event, String *parms, Cardinal *num) { GatewayCB(w, NULL, NULL); } static void TalkToAct (Widget w, XEvent *event, String *parms, Cardinal *num) { TalkToCB(w, NULL, NULL); } static void MsgScanAct(Widget w, XEvent *event, String *parms, Cardinal *num) { TalkToCB(w, NULL, NULL); } static void EditorAct (Widget w, XEvent *event, String *parms, Cardinal *num) { if (EditorOff) { EditorOff = FALSE; CreateEditor(NULL, NULL, "Edit system file", 0, 0); } } static void ListCnxAct(Widget w, XEvent *event, String *parms, Cardinal *num) { ListCnxCB(w, NULL, NULL); } static void SndTextAct(Widget w, XEvent *event, String *parms, Cardinal *num) { printf("SndText <%s>\n", parms[0]); } int main(int ac, char **av) { Pixmap pixmap; Widget bouton; Arg args[20] ; Cardinal n; XmString string; int i; Atom DelWindow; Display *display; Widget FormRC; int s; daemon_mode = 0; CurrentSelection = -1; p_fptr = NULL; setlocale(LC_CTYPE, ""); /* Added Satoshi Yasuda for NLS */ for (i = 1 ; i < NSIG ; i++) { signal(i, sig_fct); } #if 0 toplevel = XtAppInitialize(&app_context, "xfbb", NULL, 0, &ac, av, NULL,NULL, 0); XtAppAddActions(app_context, actionsTable, XtNumber(actionsTable)); #else XtToolkitInitialize(); app_context = XtCreateApplicationContext(); display = XtOpenDisplay(app_context, NULL, av[0], "xfbb", NULL, 0, &ac, av); if (display == NULL) { XtWarning("xfbb : cannot open display, exiting..."); exit(0); } XtAppAddActions(app_context, actionsTable, XtNumber(actionsTable)); toplevel = XtAppCreateShell(av[0], "xfbb", applicationShellWidgetClass, display, NULL, 0); #endif all_packets = 0; /* Parsing options */ while ((s = getopt(ac, av, "ad")) != -1) { switch (s) { case 'a': all_packets = 1; break; case 'd': break; case '?': fprintf(stderr, "Usage: xfbb [-a]\n"); return 0; } } n = 0; XtSetArg(args[n], XmNallowShellResize, True);n++; XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); ++n; XtSetValues(toplevel, args, n); DelWindow = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", FALSE); XmAddWMProtocolCallback(toplevel, DelWindow, ExitCB, NULL); n = 0; XtSetArg(args[n], XmNmarginHeight, 5);n++; XtSetArg(args[n], XmNmarginWidth, 5);n++; form = XmCreateForm(toplevel, "form", args, n); CreateRendition(toplevel); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; MenuBar = XmCreateMenuBar(form, "menu_bar", args, n); XtManageChild(MenuBar); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNtopWidget, MenuBar);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; /* XtSetArg(args[n], XmNmarginWidth, 0);n++; XtSetArg(args[n], XmNmarginHeight, 0);n++; XtSetArg(args[n], XmNspacing, 0);n++; */ ToolBar = XmCreateRowColumn(form, "tool_bar", args, n); /* ToolBar = XmCreateMenuBar(form, "tool_bar", args, n); */ /* Initialisation des boutons du menubar */ bouton = 0; n = 0; MenuFile = XmCreatePulldownMenu(MenuBar,"file", args, n); MenuUser = XmCreatePulldownMenu(MenuBar,"user", args, n); MenuEdit = XmCreatePulldownMenu(MenuBar,"edit", args, n); MenuWindow = XmCreatePulldownMenu(MenuBar,"window", args, n); MenuOptions= XmCreatePulldownMenu(MenuBar,"options", args, n); MenuConfig = XmCreatePulldownMenu(MenuBar,"config", args, n); MenuPactor = NULL; MenuHelp = XmCreatePulldownMenu(MenuBar,"help", args, n); XtSetArg(args[0], XmNsubMenuId, MenuFile); bouton = XmCreateCascadeButton(MenuBar,"file", args, 1); XtManageChild(bouton); XtSetArg(args[0], XmNsubMenuId, MenuUser); bouton = XmCreateCascadeButton(MenuBar,"user", args, 1); XtManageChild(bouton); XtSetArg(args[0], XmNsubMenuId, MenuEdit); bouton = XmCreateCascadeButton(MenuBar,"edit", args, 1); XtManageChild(bouton); XtSetArg(args[0], XmNsubMenuId, MenuWindow); bouton = XmCreateCascadeButton(MenuBar,"window", args, 1); XtManageChild(bouton); XtSetArg(args[0], XmNsubMenuId, MenuOptions); bouton = XmCreateCascadeButton(MenuBar,"options", args, 1); XtManageChild(bouton); XtSetArg(args[0], XmNsubMenuId, MenuConfig); bouton = XmCreateCascadeButton(MenuBar,"config", args, 1); XtManageChild(bouton); XtSetArg(args[0], XmNsubMenuId, MenuHelp); bouton = XmCreateCascadeButton(MenuBar,"help", args, 1); XtManageChild(bouton); /* Bouton help a droite */ XtVaSetValues(MenuBar, XmNmenuHelpWidget, bouton, NULL); XtManageChild(MenuFile); XtManageChild(MenuUser); XtManageChild(MenuEdit); XtManageChild(MenuWindow); XtManageChild(MenuFile); XtManageChild(MenuConfig); ScanSys = add_item(BUTTON, MenuFile, "scan_sys", ScanSysCB, NULL, "Tests the different system files for updating", FHelpCB); ScanMsg = add_item(TOGGLE, MenuFile, "scan_msg", ScanMsgCB, NULL, "Re-scans the list of messages", FHelpCB); add_item(SEPARATOR, MenuFile, "", NULL, NULL, NULL, NULL); add_item(BUTTON, MenuFile, "maintenance", MaintCB, NULL, "Exits and runs house-keeping tasks", FHelpCB); add_item(BUTTON, MenuFile, "re_run", RerunCB, NULL, "Re-Runs XFBB", FHelpCB); add_item(BUTTON, MenuFile, "exit", ExitCB, NULL, "End of the session", FHelpCB); MTalkTo = add_item(BUTTON, MenuUser, "talk", TalkToCB, NULL, "Talks to the selected user", FHelpCB); MShow = add_item(BUTTON, MenuUser, "show", OneChanCB, NULL, "Shows the traffic of the selectedd user", FHelpCB); MInfos = add_item(BUTTON, MenuUser, "infos", InfoDialog, NULL, "Give informations on the selected user", FHelpCB); MDiscon = add_item(BUTTON, MenuUser, "disconnect", DisconnectCB, (XtPointer)3, "Disconnects the selected user", FHelpCB); MImDisc = add_item(BUTTON, MenuUser, "immediatedisc", DisconnectCB, (XtPointer)4, "Immediately disconnects the selected user", FHelpCB); add_item(BUTTON, MenuUser, "last_connections", ListCnxCB, NULL, "Lists the last connections", FHelpCB); add_item(BUTTON, MenuEdit, "user", EditUsrCB, NULL, "Edits user's information", FHelpCB); add_item(BUTTON, MenuEdit, "message", EditMsgCB, NULL, "Edits message information and text", FHelpCB); add_item(BUTTON, MenuEdit, "forwarding", NULL, NULL, "Pending forward", FHelpCB); MEdit = add_item(BUTTON, MenuEdit, "system_file", EditFileCB, NULL, "Edits a system file", FHelpCB); add_item(BUTTON, MenuWindow, "console", ConsoleCB, NULL, "Console connection", FHelpCB); add_item(BUTTON, MenuWindow, "gateway", GatewayCB, NULL, "Gateway connection", FHelpCB); add_item(BUTTON, MenuWindow, "monitoring", MonitorCB, NULL, "Shows monitoring", FHelpCB); add_item(BUTTON, MenuWindow, "all_channels", AllChanCB, NULL, "Shows the traffic of all users", FHelpCB); Opt[CM_OPTIONEDIT] = add_item(TOGGLE, MenuOptions, "edition", OptionsCB, (XtPointer)CM_OPTIONEDIT, "Enable/disable full page editor", FHelpCB); Opt[CM_OPTIONJUSTIF] = add_item(TOGGLE, MenuOptions, "justification", OptionsCB, (XtPointer)CM_OPTIONJUSTIF, "Enable/disable console justification", FHelpCB); Opt[CM_OPTIONALARM] = add_item(TOGGLE, MenuOptions, "connection_bip", OptionsCB, (XtPointer)CM_OPTIONALARM, "Enable/disable connection alarm", FHelpCB); Opt[CM_OPTIONCALL] = add_item(TOGGLE, MenuOptions, "sysop_call", OptionsCB, (XtPointer)CM_OPTIONCALL, "Enable/disable sysop call", FHelpCB); Opt[CM_OPTIONGATEWAY] = add_item(TOGGLE, MenuOptions, "gateway", OptionsCB, (XtPointer)CM_OPTIONGATEWAY, "Enable/disable gateway access", FHelpCB); Opt[CM_OPTIONAFFICH] = add_item(TOGGLE, MenuOptions, "banners", OptionsCB, (XtPointer)CM_OPTIONAFFICH, "Enable/disable callsign banners", FHelpCB); Opt[CM_OPTIONSOUNDB] = add_item(TOGGLE, MenuOptions, "soundcard", OptionsCB, (XtPointer)CM_OPTIONSOUNDB, "Enable/disable soundcard", FHelpCB); Opt[CM_OPTIONINEXPORT]= add_item(TOGGLE, MenuOptions, "inexport", OptionsCB, (XtPointer)CM_OPTIONINEXPORT, "Enable/disable display of import/export mail", FHelpCB); add_item(BUTTON, MenuConfig, "tnc_parameters", NULL, NULL, "Access to the low-level TNC programmation", FHelpCB); add_item(BUTTON, MenuConfig, "console_callsign", CallsignDialog, NULL, "Specifies the callsign used in console", FHelpCB); add_item(BUTTON, MenuConfig, "main_parameters", NULL, NULL, "Main configuration of the software", FHelpCB); add_item(BUTTON, MenuConfig, "fonts", NULL, NULL, "Set the font of the text windows", FHelpCB); MScan = NULL; MCho = NULL; add_item(BUTTON, MenuHelp, "contents", NULL, NULL, "Access online help", FHelpCB); add_item(BUTTON, MenuHelp, "copyright", CopyDialog, NULL, "Displays copyright informations", FHelpCB); add_item(SEPARATOR, MenuHelp, "", NULL, NULL, NULL, NULL); add_item(BUTTON, MenuHelp, "about", AboutDialog, NULL, "Informations on WinFBB software", FHelpCB); BIcon[0] = add_item(TOOLBUTTON, ToolBar, "B1", ConsoleCB, NULL, "Console connection", FHelpCB); BIcon[1] = add_item(TOOLBUTTON, ToolBar, "B2", GatewayCB, NULL, "Gateway connection", FHelpCB); BIcon[2] = add_item(TOOLBUTTON, ToolBar, "B3", MonitorCB, NULL, "Monitoring window", FHelpCB); BIcon[3] = add_item(TOOLBUTTON, ToolBar, "B4", AllChanCB, NULL, "Shows the traffic of all users", FHelpCB); BIcon[4] = add_item(TOOLBUTTON, ToolBar, "B5", OneChanCB, NULL, "Shows the traffic of the selected user", FHelpCB); BIcon[5] = add_item(TOOLBUTTON, ToolBar, "B6", InfoDialog, NULL, "Give informations on the selected user", FHelpCB); BIcon[6] = add_item(TOOLBUTTON, ToolBar, "B7", DisconnectCB, NULL, "Disconnects the selected user ", FHelpCB); BIcon[7] = add_item(TOOLBUTTON, ToolBar, "B8", TalkToCB, NULL, "Talk to the selected user", FHelpCB); BIcon[8] = add_item(TOOLBUTTON, ToolBar, "B9", ListCnxCB, NULL, "Lists the last connections", FHelpCB); BIcon[9] = add_item(TOOLBUTTON, ToolBar, "B10", EditUsrCB, NULL, "Edits user's information", FHelpCB); BIcon[10] = add_item(TOOLBUTTON, ToolBar, "B11", EditMsgCB, NULL, "Edits message information and text", FHelpCB); BIcon[11] = add_item(TOOLBUTTON, ToolBar, "B12", PendingCB, NULL, "Pending forward", FHelpCB); BIcon[12] = add_item(TOOLBUTTON, ToolBar, "B13", EditFileCB, NULL, "Edits a system file", FHelpCB); BIcon[13] = add_item(TOOLBUTTON, ToolBar, "B14", PrintCB, NULL, "Opens printer", FHelpCB); BIcon[14] = add_item(TOOLBUTTON, ToolBar, "B15", StopCB, NULL, "Immediate stop", FHelpCB); BIcon[15] = add_item(TOOLBUTTON, ToolBar, "B16", AboutDialog, NULL, "On-line help", FHelpCB); XtVaSetValues(ToolBar, XmNmenuHelpWidget, BIcon[15], NULL); string = XmStringCreateSimple(" "); n = 0; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNlabelString, string);n++; Footer = XmCreateLabel(form, "footer", args, n); XtManageChild(Footer); XmStringFree(string); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNtopWidget, ToolBar);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; /* XtSetArg(args[n], XmNmappedWhenManaged, FALSE);n++; */ ConnectLabel = XmCreateLabel(form, "list_label", args, n); AddRT(ConnectLabel); XtManageChild(ConnectLabel); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNtopWidget, ConnectLabel);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, Footer);n++; /* XtSetArg(args[n], XmNborderWidth, 1);n++; */ StatForm = XmCreateForm(form, "stat_form", args, n); XtManageChild(StatForm); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNtopWidget, ConnectLabel);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNrightWidget, StatForm);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, Footer);n++; /* XtSetArg(args[n], XmNborderWidth, 1);n++; */ ListForm = XmCreateForm(form, "list_form", args, n); XtManageChild(ListForm); string = XmStringCreateSimple(" "); for (i = 0 ; i < NB_INIT_B ; i++) { n = 0; if (i == 0) { XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; } else { XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNtopWidget, Tb[i-1]);n++; } XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNhighlightThickness, 0);n++; XtSetArg(args[n], XmNmarginHeight, 0);n++; XtSetArg(args[n], XmNlabelString, string);n++; Tb[i]= XmCreateToggleButton(ListForm, "toggle_b", args, n); } XtManageChildren(Tb, NB_INIT_B); XmStringFree(string); string = XmStringCreateSimple("Ch Callsign Start Time Rt Buf C/Fwd"); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNlabelString, string);n++; ConnectString = XmCreateLabel(ListForm, "list_label", args, n); /* XtManageChild(ConnectString);*/ XmStringFree(string); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNtopWidget, ConnectString);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNhighlightThickness, 0);n++; XtSetArg(args[n], XmNscrollBarDisplayPolicy, XmSTATIC);n++; /* XtSetArg(args[n], XmNmappedWhenManaged, FALSE);n++; */ ConnectList = XmCreateScrolledList(ListForm, "connect_list", args, n); XtAddCallback(ConnectList, XmNdefaultActionCallback, SelectListCB, NULL); XtAddCallback(ConnectList, XmNbrowseSelectionCallback, ActiveListCB, NULL); AddRT(ConnectList); Popup = XmCreatePopupMenu(ConnectList, "popup", NULL, 0); XtAddEventHandler(ConnectList,ButtonPressMask, False, (XtPointer)PostIt, (XtPointer)Popup); PItem[0] = XmCreatePushButtonGadget(Popup, "Talk", NULL, 0); PItem[1] = XmCreatePushButtonGadget(Popup, "Show", NULL, 0); PItem[2] = XmCreatePushButtonGadget(Popup, "Infos", NULL, 0); PItem[3] = XmCreatePushButtonGadget(Popup, "Disconnect", NULL, 0); PItem[4] = XmCreatePushButtonGadget(Popup, "Immediate Disc", NULL, 0); for (i = 0 ; i < NB_PITEM ; i++) XtAddCallback(PItem[i], XmNactivateCallback, ItemCB, (XtPointer)i); XtManageChildren(PItem,NB_PITEM); n = 0; /* XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; */ XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; StatusLabel = XmCreateLabel(StatForm, "status_label", args, n); XtManageChild(StatusLabel); n = 0; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL);n++; XtSetArg(args[n], XmNshowArrows, False);n++; Jauge = XmCreateScrollBar(StatForm, "jauge", args, n); XtManageChild(Jauge); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNtopWidget, StatusLabel);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftOffset, 2);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightOffset, 2);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);n++; XtSetArg(args[n], XmNbottomWidget, Jauge);n++; XtSetArg(args[n], XmNshadowThickness, 1);n++; XtSetArg(args[n], XmNshadowType, XmSHADOW_IN);n++; FormRC = XmCreateForm(StatForm, "stat_Flist", args, n); XtManageChild(FormRC); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);n++; XtSetArg(args[n], XmNpacking, XmPACK_COLUMN);n++; XtSetArg(args[n], XmNnumColumns, 2);n++; StatList = XmCreateRowColumn(FormRC, "stat_list", args, n); XtManageChild(StatList); n = 0; XtSetArg(args[n], XmNmarginHeight, 1);n++; TxtUsed = XmCreateLabel(StatList, "txt_used", args, n); AddRT(TxtUsed); XtManageChild(TxtUsed); TxtGMem = XmCreateLabel(StatList, "txt_gmem", args, n); AddRT(TxtGMem); XtManageChild(TxtGMem); TxtDisk1 = XmCreateLabel(StatList, "txt_disk1", args, n); AddRT(TxtDisk1); XtManageChild(TxtDisk1); TxtDisk2 = XmCreateLabel(StatList, "txt_disk2", args, n); AddRT(TxtDisk2); XtManageChild(TxtDisk2); TxtMsgs = XmCreateLabel(StatList, "txt_msgs", args, n); AddRT(TxtMsgs); XtManageChild(TxtMsgs); TxtResync = XmCreateLabel(StatList, "txt_resync", args, n); AddRT(TxtResync); XtManageChild(TxtResync); TxtState = XmCreateLabel(StatList, "txt_state", args, n); AddRT(TxtState); XtManageChild(TxtState); TxtHold = XmCreateLabel(StatList, "txt_hold", args, n); AddRT(TxtHold); XtManageChild(TxtHold); TxtPriv = XmCreateLabel(StatList, "txt_priv", args, n); AddRT(TxtPriv); XtManageChild(TxtPriv); Used = XmCreateLabel(StatList, "used", args, n); AddRT(Used); XtManageChild(Used); GMem = XmCreateLabel(StatList, "gmem", args, n); AddRT(GMem); XtManageChild(GMem); Disk1 = XmCreateLabel(StatList, "disk1", args, n); AddRT(Disk1); XtManageChild(Disk1); Disk2 = XmCreateLabel(StatList, "disk2", args, n); AddRT(Disk2); XtManageChild(Disk2); Msgs = XmCreateLabel(StatList, "msgs", args, n); AddRT(Msgs); XtManageChild(Msgs); Resync = XmCreateLabel(StatList, "resync", args, n); AddRT(Resync); XtManageChild(Resync); State = XmCreateLabel(StatList, "state", args, n); AddRT(State); XtManageChild(State); Hold = XmCreateLabel(StatList, "hold", args, n); AddRT(Hold); XtManageChild(Hold); Priv = XmCreateLabel(StatList, "private", args, n); AddRT(Priv); XtManageChild(Priv); XtManageChild(ToolBar); XtManageChild(form); /* maj_menu_options(); */ EditMessage(toplevel); EditUser(toplevel); PendingForward(toplevel); ListCnx(toplevel); /* Icone de la fenetre */ pixmap = XCreateBitmapFromData(XtDisplay(toplevel), XtScreen(toplevel)->root, fbb_bits, fbb_width, fbb_height); XtVaSetValues(toplevel, XmNiconPixmap, pixmap, NULL); XtRealizeWidget(toplevel); XtSetSensitive(MShow, FALSE); XtSetSensitive(MTalkTo, FALSE); XtSetSensitive(MDiscon, FALSE); XtSetSensitive(MImDisc, FALSE); XtSetSensitive(MInfos, FALSE); /* Initialisation sequences */ XtAppAddWorkProc(app_context, KernelWorkProc, NULL); /* Main Loop */ XtAppMainLoop(app_context); return(0); } /* char *strupr(char *str) { char *tmp = str; while (*tmp) { if (islower(*tmp)) *tmp = toupper(*tmp); ++tmp; } return str; } */ char *itoa(int val, char *buffer, int base) { sprintf(buffer, "%d", val); return buffer; } char *ltoa(long lval, char *buffer, int base) { sprintf(buffer, "%ld", lval); return buffer; } char *ultoa(unsigned long lval, char *buffer, int base) { sprintf(buffer, "%lu", lval); return buffer; } fbb-7.04j/src/X11/xfbbX.c0100644000175100017510000013005207726646105012775 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #define __MAIN__ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define TOTVOIES 256 #define SEPARATOR 0 #define BUTTON 1 #define TOGGLE 2 #define RADIO 3 #define TOOLBUTTON 4 static void HelpAct (Widget, XEvent *, String *, Cardinal *); static void ConsoleAct (Widget, XEvent *, String *, Cardinal *); static void DisconnAct (Widget, XEvent *, String *, Cardinal *); static void PendingAct (Widget, XEvent *, String *, Cardinal *); static void MonitorAct (Widget, XEvent *, String *, Cardinal *); static void SetCallAct (Widget, XEvent *, String *, Cardinal *); static void ProgTncAct (Widget, XEvent *, String *, Cardinal *); static void GatewayAct (Widget, XEvent *, String *, Cardinal *); static void TalkToAct (Widget, XEvent *, String *, Cardinal *); static void MsgScanAct (Widget, XEvent *, String *, Cardinal *); static void EditorAct (Widget, XEvent *, String *, Cardinal *); static void ListCnxAct (Widget, XEvent *, String *, Cardinal *); static void SndTextAct (Widget, XEvent *, String *, Cardinal *); static void ConnectItem (int, char *); static void makekey (char *, char *, char *); static void end_wait (void); static void cursor_wait (void); static XtActionsRec actionsTable[] = { {"Help", HelpAct}, {"Console", ConsoleAct}, {"Disconnect", DisconnAct}, {"PendingFwd", PendingAct}, {"Monitor", MonitorAct}, {"SetCall", SetCallAct}, {"ProgTnc", ProgTncAct}, {"Gateway", GatewayAct}, {"TalkTo", TalkToAct}, {"MsgScan", MsgScanAct}, {"Editor", EditorAct}, {"ListCnx", ListCnxAct}, {"SndText", SndTextAct} }; #define NB_PITEM 4 #define NB_ICON 16 #define NB_INIT_B 11 static int print = 0; static int comm_ok = 1; static int filter; static int fbb_sock = -1; static int first = 1; static XtInputId InputId = 0; static Widget MCons; static Widget MAllc; static Widget MMon; static FILE *p_fptr; static int r_index; static XtAppContext app_context; static Pixel df_pixel; static Pixel rf_pixel; static Pixel vf_pixel; static Pixel bf_pixel; static Pixel no_pixel; static Pixel rc_pixel; static Pixel vc_pixel; static Pixel bc_pixel; static XmRendition r_rend[10]; static Widget BIcon[NB_ICON]; static Widget form; static Widget Footer; static int foothelp; static Widget ConnectLabel; static Widget ConnectList; static Widget MsgsToggle; static Widget StatusToggle; static Widget MenuBar; static Widget ToolBar; static Widget MenuWindow; static Widget MenuRemote; static Widget MenuConfig; static Widget MenuHelp; static Widget ListForm; static Widget StatForm; static Widget ConnectString; static Widget StatList; static Widget MenuFile; /* Liste des widgets de status */ static Widget TxtUsed; static Widget TxtGMem; static Widget TxtDisk1; static Widget TxtDisk2; static Widget TxtMsgs; static Widget TxtResync; static Widget TxtState; static Widget TxtHold; static Widget TxtPriv; static Widget Used; static Widget GMem; static Widget Disk1; static Widget Disk2; static Widget Msgs; static Widget Resync; static Widget State; static Widget Hold; static Widget Priv; static Widget Popup; static Widget PItem[NB_PITEM]; void TalkToCB (Widget w, XtPointer client_data, XtPointer call_data); void OneChanCB (Widget w, XtPointer client_data, XtPointer call_data); void DisconnectCB (Widget w, XtPointer client_data, XtPointer call_data); int is_connected (void) { return (fbb_sock > 0); } int close_connection (void) { if (fbb_sock > 0) { HideFbbWindow (ALLCHAN, toplevel); HideFbbWindow (CONSOLE, toplevel); HideFbbWindow (MONITOR, toplevel); close (fbb_sock); fbb_sock = -1; if (InputId) XtRemoveInput (InputId); InputId = 0; } Caption (1); return 1; } static int open_connection (char *tcp_addr, int tcp_port, int mask) { int sock; struct sockaddr_in sock_addr; struct hostent *phe; if ((sock = socket (AF_INET, SOCK_STREAM, 0)) < 0) { perror ("socket_r"); return (0); } if ((phe = gethostbyname (tcp_addr)) == NULL) { perror ("gethostbyname"); return (-1); } sock_addr.sin_family = AF_INET; sock_addr.sin_port = htons (tcp_port); memcpy ((char *) &sock_addr.sin_addr, phe->h_addr, phe->h_length); if (connect (sock, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) == -1) { perror ("connect"); close_connection (); return (-1); } return (sock); } static int do_filter (char *ptr, int len) { char *scan = ptr; int lg = 0; while (len) { if ((*ptr == '\n') || isprint (*ptr)) scan[lg++] = *ptr; ++ptr; --len; } return (lg); } void Received (int channel, char *text, int len) { window_write (CONSOLE, text, len, 0, 0); } void ReceiveMonitor (int channel, char *text, int len, int color, int header) { if (channel == 255) channel = MONITOR; else channel = ALLCHAN; window_write (channel, text, len, color, header); } void ReceiveList (int channel, char *text) { ConnectItem (channel, text); } void ReceiveNbCh (int nb) { char buffer[80]; if (nb == 0) strcpy (buffer, "No connected station"); else sprintf (buffer, "%d connected station%c", nb, (nb > 1) ? 's' : '\0'); LabelSetString (ConnectLabel, buffer, NULL); } void ReceiveNbMsg (int priv, int hold, int nbmess) { static int old_nbmess = -1L; static int old_priv = -1L; static int old_hold = -1L; char texte[80]; if (!(conf[curconf].mask & FBB_MSGS)) priv = hold = nbmess = 0; if (old_nbmess != nbmess) { sprintf (texte, ": %d", nbmess); LabelSetString (Msgs, texte, NULL); old_nbmess = nbmess; } if (priv != old_priv) { sprintf (texte, ": %d", priv); LabelSetString (TxtPriv, "Priv msgs", (priv > 0) ? "RC" : NULL); LabelSetString (Priv, texte, (priv > 0) ? "RC" : NULL); old_priv = priv; } if (hold != old_hold) { sprintf (texte, ": %d", hold); LabelSetString (TxtHold, "Hold msgs", (hold > 0) ? "RC" : NULL); LabelSetString (Hold, texte, (hold > 0) ? "RC" : NULL); old_hold = hold; } } void ReceiveStatus (int lmem, int gmem, int disk1, int disk2) { static int old_lmem = -1L; static int old_gmem = -1L; static int old_disk1 = -1L; static int old_disk2 = 0L; char texte[80]; if (!(conf[curconf].mask & FBB_STATUS)) disk1 = disk2 = 9999; if (old_lmem != lmem) { sprintf (texte, ": %d", lmem); LabelSetString (Used, texte, NULL); old_lmem = lmem; } if (old_gmem != gmem) { sprintf (texte, ": %d K", gmem << 4); LabelSetString (GMem, texte, NULL); old_gmem = gmem; } if (disk1 != old_disk1) { sprintf (texte, ": %d K", disk1); LabelSetString (TxtDisk1, "Disk#1 free", (disk1 < 1000) ? "RC" : NULL); LabelSetString (Disk1, texte, (disk1 < 1000) ? "RC" : NULL); old_disk1 = disk1; } if (disk2 != old_disk2) { if (disk2 == -1L) { LabelSetString (TxtDisk2, "", NULL); LabelSetString (Disk2, "", NULL); } else { sprintf (texte, ": %d K", disk2); LabelSetString (TxtDisk2, "Disk#2 free", (disk2 < 1000) ? "RC" : NULL); LabelSetString (Disk2, texte, (disk2 < 1000) ? "RC" : NULL); } old_disk2 = disk2; } } static int orb_input (Widget w, int *sock, XtInputId * id) { int nb; char buffer[4096]; char save; unsigned int service; unsigned int len; char *scan; static int in_input = 0; static int pos = 0; if (in_input) return 0; ++in_input; nb = read (*sock, buffer + pos, sizeof (buffer) - pos); if (nb == -1) { perror ("read"); --in_input; close_connection (); return 0; } if (nb == 0) { MessageBox (0, "Connection closed", "End", MB_OK | MB_ICONEXCLAMATION); --in_input; close_connection (); return 0; } scan = buffer; nb += pos; while (nb >= 4) { /* Read header first. Be sure the 4 bytes are read */ service = (unsigned int) scan[0]; len = ((unsigned int) scan[3] << 8) + (unsigned int) scan[2]; if (nb < len + 4) break; scan += 4; nb -= 4; /* Read the data following the header. Be sure all bytes are read */ save = scan[len]; /* decodes and displays the services */ switch (service) { case FBB_CONSOLE: if (len > 3) Received (scan[0], scan + 3, len - 3); scan[len - 3] = '\0'; if (first && len == 30) MessageBox (0, scan + 3, "status", MB_OK | MB_ICONEXCLAMATION); first = 0; break; case FBB_MONITOR: if (len > 3) { int n = len; if (filter) n = do_filter (scan + 3, len - 3) + 3; ReceiveMonitor (scan[0], scan + 3, n - 3, scan[1], scan[2]); } break; case FBB_CHANNEL: if (len > 3) ReceiveMonitor (scan[0], scan + 3, len - 3, scan[1], scan[2]); break; case FBB_MSGS: { int nbPriv, nbHeld, nbTotal; scan[len] = '\0'; sscanf (scan, "%d %d %d", &nbPriv, &nbHeld, &nbTotal); ReceiveNbMsg (nbPriv, nbHeld, nbTotal); } break; case FBB_STATUS: { int MemUsed, MemAvail, Disk1, Disk2; scan[len] = '\0'; sscanf (scan, "%d %d %d %d", &MemUsed, &MemAvail, &Disk1, &Disk2); ReceiveStatus (MemUsed, MemAvail, Disk1, Disk2); } break; case FBB_NBCNX: scan[len] = '\0'; ReceiveNbCh (atoi (scan)); break; case FBB_LISTCNX: scan[len] = '\0'; ReceiveList (atoi (scan + 1), scan); break; case FBB_XFBBX: switch (scan[0]) { case 0: /* Deconnecte */ HideFbbWindow (CONSOLE, toplevel); conf[curconf].mask &= ~FBB_CONSOLE; break; case 1: /* Connecte */ conf[curconf].mask |= FBB_CONSOLE; ShowFbbWindow (CONSOLE, toplevel); break; case 2: /* Console busy */ conf[curconf].mask &= ~FBB_CONSOLE; MessageBox (0, "Remote console is already connected", "Connect", MB_OK | MB_ICONEXCLAMATION); break; } end_wait (); break; } scan[len] = save; scan += len; nb -= len; } if (nb > 0) { int i; /* All data was not received. */ /* Copy the rest to the beginning of the buffer */ for (i = 0; i < nb; i++) buffer[i] = scan[i]; } pos = nb; --in_input; return 0; } int init_orb (char *msg) { char buffer[300]; int sock; int console; int channel; int nb; char key[256]; XmListDeleteAllItems (ConnectList); cursor_wait (); /* End the current connection */ close_connection (); console = 0; channel = 0; filter = 0; sock = open_connection (conf[curconf].host, conf[curconf].port, conf[curconf].mask); if (sock == -1) { sprintf (msg, "Cannot connect xfbbd at %s:%d", conf[curconf].host, conf[curconf].port); Caption (1); end_wait (); return 0; } sprintf (buffer, "%d %d %s\n", conf[curconf].mask, channel, conf[curconf].mycall); write (sock, buffer, strlen (buffer)); nb = read (sock, buffer, 20); if (nb <= 0) { sprintf (msg, "Connection closed"); close (sock); Caption (1); end_wait (); return (0); } buffer[nb] = '\0'; sscanf (buffer, "%s", key); makekey (key, conf[curconf].pass, buffer); strcat (buffer, "\n"); write (sock, buffer, strlen (buffer)); InputId = XtAppAddInput (app_context, sock, (XtPointer) XtInputReadMask, (XtInputCallbackProc) orb_input, NULL); fbb_sock = sock; first = 1; XmToggleButtonSetState (MsgsToggle, ((conf[curconf].mask & FBB_MSGS) != 0), True); XmToggleButtonSetState (StatusToggle, ((conf[curconf].mask & FBB_STATUS) != 0), True); Caption (1); /* Open windows depending of the mask */ if (conf[curconf].mask & FBB_MONITOR) ShowFbbWindow (MONITOR, toplevel); else HideFbbWindow (MONITOR, toplevel); if (conf[curconf].mask & FBB_CHANNEL) ShowFbbWindow (ALLCHAN, toplevel); else HideFbbWindow (ALLCHAN, toplevel); end_wait (); return (1); } int console_input (char *buffer, int len) { int i; for (i = 0; i < len; i++) if (buffer[i] == '\r') buffer[i] = '\n'; write (fbb_sock, buffer, len); return (1); } #include void cursor_wait (void) { static Cursor lcursor = 0; if (lcursor == 0) { lcursor = XCreateFontCursor (XtDisplay (toplevel), XC_watch); } XDefineCursor (XtDisplay (toplevel), XtWindow (toplevel), lcursor); XFlush (XtDisplay (toplevel)); } void end_wait (void) { XUndefineCursor (XtDisplay (toplevel), XtWindow (toplevel)); } void DialogHelpCB (Widget w, XtPointer client_data, XtPointer call_data) { *((int *) client_data) = 2; } void DialogOkCB (Widget w, XtPointer client_data, XtPointer call_data) { *((int *) client_data) = 1; } void DialogCancelCB (Widget w, XtPointer client_data, XtPointer call_data) { *((int *) client_data) = 0; } void RaiseEV (Widget w, XtPointer client_data, XEvent * event) { if (event->type != VisibilityNotify) return; XRaiseWindow (XtDisplay (w), XtWindow (XtParent (w))); } int MessageBox (int sec, char *texte, char *titre, int flags) { Arg args[20]; Cardinal n; Widget dialog; XEvent event; XmString string; int type; time_t temps; int retour = -1; n = 0; XtSetArg (args[n], XmNautoUnmanage, FALSE); n++; XtSetArg (args[n], XmNtitle, titre); n++; dialog = XmCreateMessageDialog (toplevel, "Warning", args, n); XtAddCallback (dialog, XmNokCallback, DialogOkCB, (XtPointer) & retour); XtAddCallback (dialog, XmNcancelCallback, DialogCancelCB, (XtPointer) & retour); XtAddCallback (dialog, XmNhelpCallback, DialogHelpCB, (XtPointer) & retour); XtAddEventHandler (dialog, VisibilityChangeMask, FALSE, (XtEventHandler) RaiseEV, NULL); switch (flags & 0xf0) { case 0x10: type = XmDIALOG_ERROR; break; case 0x20: type = XmDIALOG_QUESTION; break; case 0x30: type = XmDIALOG_WARNING; break; case 0x40: type = XmDIALOG_INFORMATION; break; default: type = XmDIALOG_MESSAGE; break; } string = XmStringCreateSimple ("No"); n = 0; XtSetArg (args[n], XmNdialogType, type); n++; XtSetArg (args[n], XmNhelpLabelString, string); n++; XtSetValues (dialog, args, n); XmStringFree (string); flags &= 0xf; if (flags == MB_OK) { XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_HELP_BUTTON)); } else if (flags == MB_OKCANCEL) { XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_HELP_BUTTON)); } else { /* YESNO et YESNOCANCEL */ string = XmStringCreateSimple ("Yes"); n = 0; XtSetArg (args[n], XmNokLabelString, string); n++; XtSetValues (dialog, args, n); XmStringFree (string); if (flags == MB_YESNO) { XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_CANCEL_BUTTON)); } } string = XmStringCreateSimple (texte); n = 0; XtSetArg (args[n], XmNmessageString, string); n++; XtSetValues (dialog, args, n); XmStringFree (string); XtManageChild (dialog); XtAddGrab (dialog, TRUE, TRUE); if (sec > 0) { temps = time (NULL) + (time_t) sec; } else { temps = 0; } while (retour == -1) { if (XtAppPending (app_context)) { XtAppNextEvent (app_context, &event); XtDispatchEvent (&event); } else usleep (100000); if ((temps) && (temps < time (NULL))) { retour = 1; break; } } XtRemoveGrab (dialog); XtUnmanageChild (dialog); XtDestroyWidget (XtParent (dialog)); return (retour); } static void sig_fct (int sig) { int pid, pstatus; sig &= 0xff; printf ("Signal received = %d\n", sig); pid = wait (&pstatus); signal (sig, sig_fct); switch (sig) { case SIGHUP: /* reload system files */ break; case SIGTERM: /* end of session */ exit (0); break; case SIGBUS: /* end of session */ fprintf (stderr, "xfbbd : Bus error\n"); exit (5); break; case SIGSEGV: /* end of session */ fprintf (stderr, "xfbb : Segmentation violation\n"); exit (5); break; } } int SetChList (int clean) { return 1; } int GetChList (void) { return 1; } static int cherche_pos (int ch, int *items) { int i; for (i = 1; i < TOTVOIES + 1; i++) { if (items[i] == ch) return (i); } return (0); } static int insere_pos (int ch, int *items) { int i; int pos = 0; for (i = 1; i < TOTVOIES + 1; i++) { if ((items[i] > ch) || (items[i] == 0)) { pos = i; break; } } for (i = TOTVOIES; i > pos; i--) { items[i] = items[i - 1]; } items[pos] = ch; return (pos); } static void delete_pos (int position, int *items) { int i; for (i = position; i < TOTVOIES + 1; i++) { items[i] = items[i + 1]; } } void ConnectItem (int ch, char *texte) { static int items[TOTVOIES + 1]; int pos; XmString str; if (ch <= 0) return; if (*texte == '<') str = XmStringGenerate (texte + 1, NULL, XmCHARSET_TEXT, "RC"); else if (*texte == '>') str = XmStringGenerate (texte + 1, NULL, XmCHARSET_TEXT, "BC"); else str = XmStringGenerate (texte + 1, NULL, XmCHARSET_TEXT, "NO"); pos = cherche_pos (ch, items); if (texte[3]) { if (pos) { /* Mise a jour */ XmListReplaceItemsPos (ConnectList, &str, 1, pos); } else { /* Creation */ pos = insere_pos (ch, items); XmListAddItemUnselected (ConnectList, str, pos); } } else if (pos) { /* supression */ XmListDeletePos (ConnectList, pos); delete_pos (pos, items); } XmStringFree (str); } static Pixel CreeCouleur (Widget w, int couleur) { XColor tcolor; tcolor.pixel = 0; tcolor.red = ((couleur >> 16) & 0xff) << 8; tcolor.green = ((couleur >> 8) & 0xff) << 8; tcolor.blue = (couleur & 0xff) << 8; tcolor.flags = DoRed | DoGreen | DoBlue; if (XAllocColor (XtDisplay(w), DefaultColormapOfScreen(XtScreen(w)), &tcolor)) return (tcolor.pixel); return couleur; } static XmRendition CreeCouleurRendition (Widget w, Pixel couleur, char *nom) { Arg args[10]; Cardinal n; n = 0; XtSetArg (args[n], XmNrenditionForeground, couleur); n++; return XmRenditionCreate (w, nom, args, n); } void CreateRendition (Widget w) { r_index = 0; XtVaGetValues (form, XmNbackground, &df_pixel, NULL); rc_pixel = CreeCouleur (w, 0xff0000); r_rend[r_index++] = CreeCouleurRendition (w, rc_pixel, "RC"); vc_pixel = CreeCouleur (w, 0x00ff00); r_rend[r_index++] = CreeCouleurRendition (w, vc_pixel, "VC"); bc_pixel = CreeCouleur (w, 0x0000ff); r_rend[r_index++] = CreeCouleurRendition (w, bc_pixel, "BC"); no_pixel = CreeCouleur (w, 0x000000); r_rend[r_index++] = CreeCouleurRendition (w, no_pixel, "NO"); rf_pixel = CreeCouleur (w, 0x800000); r_rend[r_index++] = CreeCouleurRendition (w, rf_pixel, "RF"); vf_pixel = CreeCouleur (w, 0x008000); r_rend[r_index++] = CreeCouleurRendition (w, vf_pixel, "VF"); bf_pixel = CreeCouleur (w, 0x000080); r_rend[r_index++] = CreeCouleurRendition (w, bf_pixel, "BF"); } void ToolIcons (void) { int i; int connected = is_connected (); static int OldIconState[NB_ICON]; int IconState[NB_ICON]; static int conn = 0; static int first = 1; static Pixel TopShadow; static Pixel BottomShadow; if (!comm_ok) return; if (first) { XtVaGetValues (BIcon[0], XmNtopShadowColor, &TopShadow, XmNbottomShadowColor, &BottomShadow, NULL); XtSetSensitive (BIcon[15], TRUE); first = 0; } if (connected != conn) { conn = connected; XtSetSensitive (BIcon[0], connected); XtSetSensitive (BIcon[2], connected); XtSetSensitive (BIcon[3], connected); XtSetSensitive (MCons, connected); XtSetSensitive (MMon, connected); XtSetSensitive (MAllc, connected); } for (i = 0; i < NB_ICON; i++) IconState[i] = FALSE; IconState[0] = fenetre[CONSOLE]; IconState[2] = fenetre[MONITOR]; IconState[3] = fenetre[ALLCHAN]; IconState[15] = TRUE; for (i = 0; i < NB_ICON; i++) { if (BIcon[i] == NULL) continue; if (OldIconState[i] != IconState[i]) { if (i < 4) { if (IconState[i]) { XtVaSetValues (BIcon[i], XmNtopShadowColor, BottomShadow, XmNbottomShadowColor, TopShadow, NULL); } else { XtVaSetValues (BIcon[i], XmNtopShadowColor, TopShadow, XmNbottomShadowColor, BottomShadow, NULL); } } OldIconState[i] = IconState[i]; } } } void Caption (int update) { time_t temps; struct tm tmg; struct tm tml; char buf[80]; char conn[80]; static int lmin = -1; if (update) lmin = -1; temps = time (NULL); tmg = *(gmtime (&temps)); tml = *(localtime (&temps)); if (tmg.tm_min != lmin) { if (is_connected ()) sprintf (conn, "%s (%s:%d)", conf[curconf].name, conf[curconf].host, conf[curconf].port); else sprintf (conn, "%s : not connected", conf[curconf].name); lmin = tmg.tm_min; sprintf (buf, "XFBB - %s - %s - %02d:%02d UTC", conf[curconf].mycall, conn, tmg.tm_hour, tmg.tm_min); XtVaSetValues (toplevel, XmNtitle, buf, NULL); } } void ItemCB (Widget w, XtPointer client_data, XtPointer call_data) { } void ActiveListCB (Widget w, XtPointer client_data, XtPointer call_data) { CurrentSelection = GetChList (); } void SelectListCB (Widget w, XtPointer client_data, XtPointer call_data) { CurrentSelection = GetChList (); if (CurrentSelection != -1) { /* Selection d'un canal */ /* ShowFbbWindow(CurrentSelection, toplevel); */ } } void ConsoleCB (Widget w, XtPointer client_data, XtPointer call_data) { char buffer[3]; /* Connexion en console */ cursor_wait (); /* Demande de connexion */ if (conf[curconf].mask & FBB_CONSOLE) conf[curconf].mask &= ~FBB_CONSOLE; else conf[curconf].mask |= FBB_CONSOLE; buffer[0] = 0; buffer[1] = 0; buffer[2] = (char) conf[curconf].mask; write (fbb_sock, buffer, 3); } void GatewayCB (Widget w, XtPointer client_data, XtPointer call_data) { /* ShowFbbWindow(CONSOLE, toplevel); */ } void AllChanCB (Widget w, XtPointer client_data, XtPointer call_data) { char buffer[3]; if (!fenetre[ALLCHAN]) { conf[curconf].mask |= FBB_CHANNEL; ShowFbbWindow (ALLCHAN, toplevel); } else { conf[curconf].mask &= ~FBB_CHANNEL; HideFbbWindow (ALLCHAN, toplevel); } buffer[0] = 0; buffer[1] = 0; buffer[2] = (char) conf[curconf].mask; write (fbb_sock, buffer, 3); } void OneChanCB (Widget w, XtPointer client_data, XtPointer call_data) { } void DisconnectCB (Widget w, XtPointer client_data, XtPointer call_data) { } void DisconnectConsole (void) { HideFbbWindow (CONSOLE, toplevel); } void MonitorCB (Widget w, XtPointer client_data, XtPointer call_data) { char buffer[3]; if (!fenetre[MONITOR]) { conf[curconf].mask |= FBB_MONITOR; ShowFbbWindow (MONITOR, toplevel); } else { conf[curconf].mask &= ~FBB_MONITOR; HideFbbWindow (MONITOR, toplevel); } buffer[0] = 0; buffer[1] = 0; buffer[2] = (char) conf[curconf].mask; write (fbb_sock, buffer, 3); } void ScanSysCB (Widget w, XtPointer client_data, XtPointer call_data) { cursor_wait (); end_wait (); } void ScanMsgCB (Widget w, XtPointer client_data, XtPointer call_data) { printf ("ScanMsg = %d\n", ((XmToggleButtonCallbackStruct *) call_data)->set); } void EditFileCB (Widget w, XtPointer client_data, XtPointer call_data) { } void ListCnxCB (Widget w, XtPointer client_data, XtPointer call_data) { } void EditUsrCB (Widget w, XtPointer client_data, XtPointer call_data) { } void EditMsgCB (Widget w, XtPointer client_data, XtPointer call_data) { } void PendingCB (Widget w, XtPointer client_data, XtPointer call_data) { } void StatMemCB (Widget w, XtPointer client_data, XtPointer call_data) { /* Infos status */ int flag = (((XmToggleButtonCallbackStruct *) call_data)->set != 0); char buffer[4]; if (flag) { conf[curconf].mask |= FBB_STATUS; XtMapWidget (TxtUsed); XtMapWidget (TxtGMem); XtMapWidget (TxtDisk1); XtMapWidget (TxtDisk2); XtMapWidget (Used); XtMapWidget (GMem); XtMapWidget (Disk1); XtMapWidget (Disk2); } else { conf[curconf].mask &= ~FBB_STATUS; XtUnmapWidget (TxtUsed); XtUnmapWidget (TxtGMem); XtUnmapWidget (TxtDisk1); XtUnmapWidget (TxtDisk2); XtUnmapWidget (Used); XtUnmapWidget (GMem); XtUnmapWidget (Disk1); XtUnmapWidget (Disk2); } buffer[0] = 0; buffer[1] = 0; buffer[2] = (char) conf[curconf].mask; write (fbb_sock, buffer, 3); ReceiveStatus (0, 0, 0, 0); PutConfig (); } void StatMsgCB (Widget w, XtPointer client_data, XtPointer call_data) { /* Infos Messages */ int flag = (((XmToggleButtonCallbackStruct *) call_data)->set != 0); char buffer[4]; if (flag) { conf[curconf].mask |= FBB_MSGS; XtMapWidget (TxtMsgs); XtMapWidget (TxtHold); XtMapWidget (TxtPriv); XtMapWidget (Msgs); XtMapWidget (Hold); XtMapWidget (Priv); } else { conf[curconf].mask &= ~FBB_MSGS; XtUnmapWidget (TxtMsgs); XtUnmapWidget (TxtHold); XtUnmapWidget (TxtPriv); XtUnmapWidget (Msgs); XtUnmapWidget (Hold); XtUnmapWidget (Priv); } buffer[0] = 0; buffer[1] = 0; buffer[2] = (char) conf[curconf].mask; write (fbb_sock, buffer, 3); ReceiveNbMsg (0, 0, 0); PutConfig (); } void InfoDialog (Widget w, XtPointer client_data, XtPointer call_data) { } void RemoteCB (Widget w, XtPointer client_data, XtPointer call_data) { char msg[256]; int val = (int) client_data; int flag = (((XmToggleButtonCallbackStruct *) call_data)->set != 0); if (val == curconf) return; if (flag == 0) return; curconf = (int) client_data; PutConfig (); init_orb (msg); } void TalkToCB (Widget w, XtPointer client_data, XtPointer call_data) { } void MaintCB (Widget w, XtPointer client_data, XtPointer call_data) { } void RerunCB (Widget w, XtPointer client_data, XtPointer call_data) { } void ExitCB (Widget w, XtPointer client_data, XtPointer call_data) { exit (0); } void StopCB (Widget w, XtPointer client_data, XtPointer call_data) { } void ConnectCB (Widget w, XtPointer client_data, XtPointer call_data) { } void PrintCB (Widget w, XtPointer client_data, XtPointer call_data) { print = !print; printf ("print = %d\n", print); } void LabelSetString (Widget label, char *text, char *attr) { Arg args[10]; Cardinal n = 0; XmString string; if (text == NULL) return; if (attr) string = XmStringGenerate (text, NULL, XmCHARSET_TEXT, attr); else string = XmStringCreateSimple (text); n = 0; XtSetArg (args[n], XmNlabelString, string); n++; XtSetValues (label, args, n); XmStringFree (string); } void FHelpCB (Widget w, XtPointer client_data, XEvent * event) { static XmString prev = NULL; if (client_data) { XmString string; if (prev) XmStringFree (prev); XtVaGetValues (Footer, XmNlabelString, &prev, NULL); string = XmStringCreateSimple ((char *) client_data); XtVaSetValues (Footer, XmNlabelString, string, NULL); XmStringFree (string); foothelp = TRUE; } else { if (prev) XtVaSetValues (Footer, XmNlabelString, prev, NULL); foothelp = FALSE; } } Widget add_item (int type, Widget menu_pane, char *nom, XtCallbackProc callback, XtPointer data, char *help, XtEventHandler HelpCB) { Arg args[10]; Cardinal n = 0; Widget bouton = NULL; if ((callback == NULL) && (type != SEPARATOR) && (type != TOOLBUTTON)) { XtSetArg (args[n], XmNsensitive, False); n++; } switch (type) { case SEPARATOR: bouton = XmCreateSeparator (menu_pane, nom, args, n); break; case BUTTON: bouton = XmCreatePushButton (menu_pane, nom, args, n); if (callback) XtAddCallback (bouton, XmNactivateCallback, callback, data); break; case TOGGLE: XtSetArg (args[n], XmNvisibleWhenOff, True); n++; bouton = XmCreateToggleButton (menu_pane, nom, args, n); if (callback) XtAddCallback (bouton, XmNvalueChangedCallback, callback, data); break; case RADIO: XtSetArg (args[n], XmNvisibleWhenOff, False); n++; bouton = XmCreateToggleButton (menu_pane, nom, args, n); if (callback) XtAddCallback (bouton, XmNvalueChangedCallback, callback, data); break; case TOOLBUTTON: if (nom[0] != ' ') { XtSetArg (args[n], XmNlabelType, XmPIXMAP); n++; } XtSetArg (args[n], XmNhighlightThickness, 0); n++; XtSetArg (args[n], XmNsensitive, FALSE); n++; bouton = XmCreatePushButton (menu_pane, nom, args, n); if (callback) XtAddCallback (bouton, XmNactivateCallback, callback, data); break; } if (help) { XtAddEventHandler (bouton, EnterWindowMask, FALSE, HelpCB, (XtPointer) help); XtAddEventHandler (bouton, LeaveWindowMask, FALSE, HelpCB, NULL); } XtManageChild (bouton); return (bouton); } void AddRT (Widget w) { XmRenderTable rt; XtVaGetValues (w, XmNrenderTable, &rt, NULL, NULL); /* Make a copy so that setvalues will work correctly */ rt = XmRenderTableCopy (rt, NULL, 0); rt = XmRenderTableAddRenditions (rt, r_rend, r_index, XmMERGE_NEW); XtVaSetValues (w, XmNrenderTable, rt, NULL, NULL); XmRenderTableFree (rt); } /* Translations */ static void HelpAct (Widget w, XEvent * event, String * parms, Cardinal * num) { AboutDialog (w, NULL, NULL); } static void ConsoleAct (Widget w, XEvent * event, String * parms, Cardinal * num) { ConsoleCB (w, NULL, NULL); } static void DisconnAct (Widget w, XEvent * event, String * parms, Cardinal * num) { DisconnectCB (w, NULL, NULL); } static void PendingAct (Widget w, XEvent * event, String * parms, Cardinal * num) { } static void MonitorAct (Widget w, XEvent * event, String * parms, Cardinal * num) { MonitorCB (w, NULL, NULL); } static void SetCallAct (Widget w, XEvent * event, String * parms, Cardinal * num) { CallsignDialog (w, NULL, NULL); } static void ProgTncAct (Widget w, XEvent * event, String * parms, Cardinal * num) { } static void GatewayAct (Widget w, XEvent * event, String * parms, Cardinal * num) { GatewayCB (w, NULL, NULL); } static void TalkToAct (Widget w, XEvent * event, String * parms, Cardinal * num) { TalkToCB (w, NULL, NULL); } static void MsgScanAct (Widget w, XEvent * event, String * parms, Cardinal * num) { TalkToCB (w, NULL, NULL); } static void EditorAct (Widget w, XEvent * event, String * parms, Cardinal * num) { } static void ListCnxAct (Widget w, XEvent * event, String * parms, Cardinal * num) { } static void SndTextAct (Widget w, XEvent * event, String * parms, Cardinal * num) { printf ("SndText <%s>\n", parms[0]); } Boolean KernelWorkProc (XtPointer data) { ToolIcons (); Caption (0); usleep (10); return (FALSE); } int main (int ac, char **av) { Pixmap pixmap; Widget bouton; Arg args[20]; Cardinal n; XmString string; int i; Atom DelWindow; Widget FormRC; char msg[256]; int res; CurrentSelection = -1; p_fptr = NULL; for (i = 1; i < NSIG; i++) { signal (i, sig_fct); } XtToolkitInitialize (); app_context = XtCreateApplicationContext (); display = XtOpenDisplay (app_context, NULL, av[0], "xfbbX", NULL, 0, &ac, av); if (display == NULL) { XtWarning ("xfbb : cannot open display, exiting..."); exit (0); } XtAppAddActions (app_context, actionsTable, XtNumber (actionsTable)); toplevel = XtAppCreateShell (av[0], "xfbbX", applicationShellWidgetClass, display, NULL, 0); fenetre[CONSOLE] = fenetre[MONITOR] = fenetre[ALLCHAN] = 0; n = 0; XtSetArg (args[n], XmNallowShellResize, True); n++; XtSetArg (args[n], XmNdeleteResponse, XmDO_NOTHING); ++n; XtSetValues (toplevel, args, n); DelWindow = XInternAtom (XtDisplay (toplevel), "WM_DELETE_WINDOW", FALSE); XmAddWMProtocolCallback (toplevel, DelWindow, ExitCB, NULL); n = 0; XtSetArg (args[n], XmNmarginHeight, 5); n++; XtSetArg (args[n], XmNmarginWidth, 5); n++; form = XmCreateForm (toplevel, "form", args, n); CreateRendition (toplevel); n = 0; XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; MenuBar = XmCreateMenuBar (form, "menu_bar", args, n); XtManageChild (MenuBar); n = 0; XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNtopWidget, MenuBar); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++; ToolBar = XmCreateRowColumn (form, "tool_bar", args, n); /* Initialisation des boutons du menubar */ bouton = 0; n = 0; XtSetArg (args[0], XmNradioBehavior, True); MenuFile = XmCreatePulldownMenu (MenuBar, "file", args, 0); MenuWindow = XmCreatePulldownMenu (MenuBar, "window", args, 0); MenuRemote = XmCreatePulldownMenu (MenuBar, "remote", args, 1); MenuConfig = XmCreatePulldownMenu (MenuBar, "config", args, 0); MenuHelp = XmCreatePulldownMenu (MenuBar, "help", args, 0); XtSetArg (args[0], XmNsubMenuId, MenuFile); bouton = XmCreateCascadeButton (MenuBar, "file", args, 1); XtManageChild (bouton); XtSetArg (args[0], XmNsubMenuId, MenuWindow); bouton = XmCreateCascadeButton (MenuBar, "window", args, 1); XtManageChild (bouton); XtSetArg (args[0], XmNsubMenuId, MenuRemote); bouton = XmCreateCascadeButton (MenuBar, "remote", args, 1); XtManageChild (bouton); XtSetArg (args[0], XmNsubMenuId, MenuConfig); bouton = XmCreateCascadeButton (MenuBar, "config", args, 1); XtManageChild (bouton); XtSetArg (args[0], XmNsubMenuId, MenuHelp); bouton = XmCreateCascadeButton (MenuBar, "help", args, 1); XtManageChild (bouton); /* Bouton help a droite */ XtVaSetValues (MenuBar, XmNmenuHelpWidget, bouton, NULL); XtManageChild (MenuFile); XtManageChild (MenuWindow); XtManageChild (MenuRemote); XtManageChild (MenuConfig); add_item (BUTTON, MenuFile, "exit", ExitCB, NULL, "End of the session", (XtEventHandler) FHelpCB); MCons = add_item (BUTTON, MenuWindow, "console", ConsoleCB, NULL, "Console connection", (XtEventHandler) FHelpCB); MMon = add_item (BUTTON, MenuWindow, "monitoring", MonitorCB, NULL, "Shows monitoring", (XtEventHandler) FHelpCB); MAllc = add_item (BUTTON, MenuWindow, "all_channels", AllChanCB, NULL, "Shows the traffic of all users", (XtEventHandler) FHelpCB); for (i = 0; i < MAX_CONF; i++) { char name[20]; sprintf (name, "xfbb %d", i + 1); Rmt[i] = add_item (RADIO, MenuRemote, name, RemoteCB, (XtPointer) i, "Select remote xfbb BBS", (XtEventHandler) FHelpCB); } add_item (BUTTON, MenuConfig, "main_parameters", SetupDialog, NULL, "Main configuration of the software", (XtEventHandler) FHelpCB); add_item (BUTTON, MenuHelp, "copyright", CopyDialog, NULL, "Displays copyright informations", (XtEventHandler) FHelpCB); add_item (SEPARATOR, MenuHelp, "", NULL, NULL, NULL, NULL); add_item (BUTTON, MenuHelp, "about", AboutDialog, NULL, "Informations on WinFBB software", (XtEventHandler) FHelpCB); BIcon[0] = add_item (TOOLBUTTON, ToolBar, "B1", ConsoleCB, NULL, "Console connection", (XtEventHandler) FHelpCB); BIcon[2] = add_item (TOOLBUTTON, ToolBar, "B3", MonitorCB, NULL, "Monitoring window", (XtEventHandler) FHelpCB); BIcon[3] = add_item (TOOLBUTTON, ToolBar, "B4", AllChanCB, NULL, "Shows the traffic of all users", (XtEventHandler) FHelpCB); add_item (TOOLBUTTON, ToolBar, " ", NULL, NULL, " ", NULL); BIcon[15] = add_item (TOOLBUTTON, ToolBar, "B16", AboutDialog, NULL, "On-line help", (XtEventHandler) FHelpCB); XtVaSetValues (ToolBar, XmNmenuHelpWidget, BIcon[15], NULL); string = XmStringCreateSimple (" "); n = 0; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNlabelString, string); n++; Footer = XmCreateLabel (form, "footer", args, n); XtManageChild (Footer); XmStringFree (string); n = 0; XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNtopWidget, ToolBar); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; ConnectLabel = XmCreateLabel (form, "list_label", args, n); AddRT (ConnectLabel); XtManageChild (ConnectLabel); n = 0; XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNtopWidget, ConnectLabel); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNbottomWidget, Footer); n++; StatForm = XmCreateForm (form, "stat_form", args, n); XtManageChild (StatForm); n = 0; XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNtopWidget, ConnectLabel); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNrightWidget, StatForm); n++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNbottomWidget, Footer); n++; ListForm = XmCreateForm (form, "list_form", args, n); XtManageChild (ListForm); string = XmStringCreateSimple ("Ch Callsign Start Time Rt Buf C/Fwd"); n = 0; XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNlabelString, string); n++; ConnectString = XmCreateLabel (ListForm, "list_label", args, n); XmStringFree (string); n = 0; XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNtopWidget, ConnectString); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNhighlightThickness, 0); n++; XtSetArg (args[n], XmNscrollBarDisplayPolicy, XmSTATIC); n++; ConnectList = XmCreateScrolledList (ListForm, "connect_list", args, n); XtAddCallback (ConnectList, XmNdefaultActionCallback, SelectListCB, NULL); XtAddCallback (ConnectList, XmNbrowseSelectionCallback, ActiveListCB, NULL); AddRT (ConnectList); XtManageChild (ConnectLabel); XtManageChild (ConnectString); XtManageChild (ConnectList); Popup = XmCreatePopupMenu (ConnectList, "popup", NULL, 0); PItem[0] = XmCreatePushButtonGadget (Popup, "Talk", NULL, 0); PItem[1] = XmCreatePushButtonGadget (Popup, "Show", NULL, 0); PItem[2] = XmCreatePushButtonGadget (Popup, "Infos", NULL, 0); PItem[3] = XmCreatePushButtonGadget (Popup, "Disconnect", NULL, 0); for (i = 0; i < NB_PITEM; i++) XtAddCallback (PItem[i], XmNactivateCallback, ItemCB, (XtPointer) i); XtManageChildren (PItem, NB_PITEM); n = 0; XtSetArg (args[n], XmNborderWidth, 0); n++; XtSetArg (args[n], XmNshadowThickness, 0); n++; XtSetArg (args[n], XmNhighlightThickness, 0); n++; XtSetArg (args[n], XmNmarginHeight, 1); n++; XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNindicatorOn, XmINDICATOR_CHECK_BOX); n++; XtSetArg (args[n], XmNvisibleWhenOff, True); n++; StatusToggle = XmCreateToggleButton (StatForm, "status_toggle", args, n); XtAddCallback (StatusToggle, XmNvalueChangedCallback, StatMemCB, NULL); XtManageChild (StatusToggle); n = 0; XtSetArg (args[n], XmNborderWidth, 0); n++; XtSetArg (args[n], XmNshadowThickness, 0); n++; XtSetArg (args[n], XmNhighlightThickness, 0); n++; XtSetArg (args[n], XmNmarginHeight, 1); n++; XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNleftWidget, StatusToggle); n++; XtSetArg (args[n], XmNindicatorOn, XmINDICATOR_CHECK_BOX); n++; XtSetArg (args[n], XmNvisibleWhenOff, True); n++; MsgsToggle = XmCreateToggleButton (StatForm, "message_toggle", args, n); XtAddCallback (MsgsToggle, XmNvalueChangedCallback, StatMsgCB, NULL); XtManageChild (MsgsToggle); n = 0; XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNtopWidget, StatusToggle); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNleftOffset, 2); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightOffset, 2); n++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNshadowThickness, 1); n++; XtSetArg (args[n], XmNshadowType, XmSHADOW_IN); n++; FormRC = XmCreateForm (StatForm, "stat_Flist", args, n); XtManageChild (FormRC); n = 0; XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNpacking, XmPACK_COLUMN); n++; XtSetArg (args[n], XmNnumColumns, 2); n++; StatList = XmCreateRowColumn (FormRC, "stat_list", args, n); XtManageChild (StatList); n = 0; XtSetArg (args[n], XmNmarginHeight, 1); n++; XtSetArg (args[n], XmNmappedWhenManaged, 0); n++; TxtUsed = XmCreateLabel (StatList, "txt_used", args, n); AddRT (TxtUsed); XtManageChild (TxtUsed); TxtGMem = XmCreateLabel (StatList, "txt_gmem", args, n); AddRT (TxtGMem); XtManageChild (TxtGMem); TxtDisk1 = XmCreateLabel (StatList, "txt_disk1", args, n); AddRT (TxtDisk1); XtManageChild (TxtDisk1); TxtDisk2 = XmCreateLabel (StatList, "txt_disk2", args, n); AddRT (TxtDisk2); XtManageChild (TxtDisk2); TxtResync = XmCreateLabel (StatList, "", args, n); AddRT (TxtResync); XtManageChild (TxtResync); TxtState = XmCreateLabel (StatList, "", args, n); AddRT (TxtState); XtManageChild (TxtState); TxtMsgs = XmCreateLabel (StatList, "txt_msgs", args, n); AddRT (TxtMsgs); XtManageChild (TxtMsgs); TxtHold = XmCreateLabel (StatList, "txt_hold", args, n); AddRT (TxtHold); XtManageChild (TxtHold); TxtPriv = XmCreateLabel (StatList, "txt_priv", args, n); AddRT (TxtPriv); XtManageChild (TxtPriv); Used = XmCreateLabel (StatList, "used", args, n); AddRT (Used); XtManageChild (Used); GMem = XmCreateLabel (StatList, "gmem", args, n); AddRT (GMem); XtManageChild (GMem); Disk1 = XmCreateLabel (StatList, "disk1", args, n); AddRT (Disk1); XtManageChild (Disk1); Disk2 = XmCreateLabel (StatList, "disk2", args, n); AddRT (Disk2); XtManageChild (Disk2); Resync = XmCreateLabel (StatList, "", args, n); AddRT (Resync); XtManageChild (Resync); State = XmCreateLabel (StatList, "", args, n); AddRT (State); XtManageChild (State); Msgs = XmCreateLabel (StatList, "msgs", args, n); AddRT (Msgs); XtManageChild (Msgs); Hold = XmCreateLabel (StatList, "hold", args, n); AddRT (Hold); XtManageChild (Hold); Priv = XmCreateLabel (StatList, "private", args, n); AddRT (Priv); XtManageChild (Priv); XtManageChild (ToolBar); XtManageChild (form); /* Icone de la fenetre */ pixmap = XCreateBitmapFromData (XtDisplay (toplevel), XtScreen (toplevel)->root, fbb_bits, fbb_width, fbb_height); XtVaSetValues (toplevel, XmNiconPixmap, pixmap, NULL); XtRealizeWidget (toplevel); XtSetSensitive (MCons, FALSE); XtSetSensitive (MMon, FALSE); XtSetSensitive (MAllc, FALSE); window_init (); set_win_colors (); curconf = 0; if (!GetConfig ()) SetupDialog (NULL, NULL, NULL); else { res = init_orb (msg); if (res == 0) { MessageBox (0, msg, "Client connection", MB_OK | MB_ICONEXCLAMATION); comm_ok = 0; /* return (res); */ } } /* Initialisation sequences */ XtAppAddWorkProc (app_context, KernelWorkProc, NULL); /* Main Loop */ XtAppMainLoop (app_context); /* Never reached */ return 0; } char *itoa (int val, char *buffer, int base) { sprintf (buffer, "%d", val); return buffer; } char *ltoa (long lval, char *buffer, int base) { sprintf (buffer, "%ld", lval); return buffer; } #define PROTOTYPES 1 #include "global.h" #include "md5.h" static void MD5String (unsigned char *dest, unsigned char *source) { int i; MD5_CTX context; unsigned char digest[16]; unsigned int len = strlen (source); MD5Init (&context); MD5Update (&context, source, len); MD5Final (digest, &context); *dest = '\0'; for (i = 0; i < 16; i++) { char tmp[5]; sprintf (tmp, "%02X", digest[i]); strcat (dest, tmp); } } static void makekey (char *cle, char *pass, char *buffer) { char source[1024]; strcpy (source, cle); strcat (source, pass); MD5String (buffer, source); } fbb-7.04j/src/X11/xfbbXabtd.c0100644000175100017510000003113707726646105013634 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include #include #include #include static Widget about_dialog = NULL; static Widget copy_dialog = NULL; static Widget call_dialog = NULL; static XmString StringCreate (char *text) { XmString xmstr; char *deb; if ((text == NULL) || (text[0] == '\0')) { return (XmStringCreateSimple ("")); } xmstr = (XmString) NULL; deb = text; while (*text) { if (*text == '\n') { *text = '\0'; xmstr = XmStringConcat (xmstr, XmStringCreateSimple (deb)); xmstr = XmStringConcat (xmstr, XmStringSeparatorCreate ()); *text++ = '\n'; deb = text; } else ++text; } if (*deb) { xmstr = XmStringConcat (xmstr, XmStringCreateSimple (deb)); } return (xmstr); } char *date (void) { return (__DATE__); } char *version (void) { static char buffer[20]; #ifdef BETA sprintf (buffer, "%d.%02d%c%d", MAJEUR, MINEUR, LETTRE, BETA); #else #ifdef LETTRE sprintf (buffer, "%d.%02d%c", MAJEUR, MINEUR, LETTRE); #else sprintf (buffer, "%d.%02d", MAJEUR, MINEUR); #endif #endif return (buffer); } static char *XVersion (int dat) { static char prodVersion[80]; char sdate[30]; if (dat) sprintf (sdate, " (%s)", date ()); else *sdate = '\0'; sprintf (prodVersion, "%s%s", version (), sdate); return (prodVersion); } static void CancelCB (Widget w, XtPointer client_data, XtPointer call_data) { Widget *pw; pw = (Widget *) client_data; XtUnmanageChild (*pw); XtDestroyWidget (XtParent (*pw)); *pw = NULL;; } static int is_call (char *call) { int nb; char *trait; char *ptr; trait = strchr (call, '-'); if (trait) *trait = '\0'; nb = 0; ptr = call; while (*ptr) { if (!isalnum (*ptr)) return (0); ++ptr; ++nb; } if ((nb < 4) || (nb > 6)) return (0); if (trait == NULL) return (1); *trait = '-'; nb = 0; ptr = trait + 1; while (*ptr) { if (!isdigit (*ptr)) return (0); ++ptr; } nb = atoi (trait + 1); if ((nb < 0) || (nb > 15)) return (0); return (1); } static void OkCB (Widget w, XtPointer client_data, XtPointer call_data) { Widget *pw; Widget wt; char *ptr; pw = (Widget *) client_data; wt = XmSelectionBoxGetChild (*pw, XmDIALOG_TEXT); ptr = XmTextGetString (wt); if (!is_call (ptr)) { char texte[80]; sprintf (texte, "%s is not a valid callsign !", ptr); MessageBox (60, texte, "Change callsign", MB_ICONEXCLAMATION | MB_OK); } else { strcpy (conf[curconf].mycall, ptr); XtUnmanageChild (*pw); XtDestroyWidget (XtParent (*pw)); *pw = NULL;; Caption (1); } XtFree (ptr); } void CallsignDialog (Widget w, XtPointer client_data, XtPointer call_data) { Arg args[20]; Cardinal n; printf ("calldialog\n"); if (call_dialog) { /* Dialog deja ouvert, on le passe devant */ XRaiseWindow (XtDisplay (call_dialog), XtWindow (XtParent (call_dialog))); printf ("calldialog up\n"); return; } n = 0; XtSetArg (args[n], XmNautoUnmanage, FALSE); n++; XtSetArg (args[n], XmNmessageAlignment, XmALIGNMENT_CENTER); n++; call_dialog = XmCreatePromptDialog (toplevel, "callsign", args, n); XtUnmanageChild (XmSelectionBoxGetChild (call_dialog, XmDIALOG_HELP_BUTTON)); XtAddCallback (call_dialog, XmNokCallback, OkCB, (XtPointer) & call_dialog); XtAddCallback (call_dialog, XmNcancelCallback, CancelCB, (XtPointer) & call_dialog); /* get_callsign(buffer); */ XmTextSetString (XmSelectionBoxGetChild (call_dialog, XmDIALOG_TEXT), conf[curconf].mycall); XtManageChild (call_dialog); } typedef struct { Widget wdial; Widget wname; Widget whost; Widget wport; Widget wcall; Widget wpass; } wid_t; static void S_CancelCB (Widget w, XtPointer client_data, XtPointer call_data) { wid_t *pw; pw = (wid_t *) client_data; XtUnmanageChild (pw->wdial); XtDestroyWidget (XtParent (pw->wdial)); pw->wdial = NULL; } int GetConfig (void) { int i; int ret = 0; char *home = getenv ("HOME"); memset(conf, 0, sizeof(conf)); for (i = 0 ; i < MAX_CONF ; i++) { sprintf(conf[i].name, "Remote %d", i); strcpy(conf[i].host, "localhost"); conf[i].port = 3286; conf[i].mask = FBB_NBCNX | FBB_LISTCNX | FBB_XFBBX; } if (home) { FILE *fptr; char buf[256]; sprintf (buf, "%s/.xfbbX", home); fptr = fopen (buf, "r"); if (fptr) { for (i = 0 ; i < MAX_CONF ; i++) { fgets (buf, sizeof(buf), fptr); sscanf (buf, "%*s %[^\n]", conf[i].name); fgets (buf, sizeof(buf), fptr); sscanf (buf, "%*s %s\n", conf[i].host); fgets (buf, sizeof(buf), fptr); sscanf (buf, "%*s %d\n", &conf[i].port); fgets (buf, sizeof(buf), fptr); sscanf (buf, "%*s %d\n", &conf[i].mask); fgets (buf, sizeof(buf), fptr); sscanf (buf, "%*s %[^\n]", conf[i].pass); fgets (buf, sizeof(buf), fptr); sscanf (buf, "%*s %s\n", conf[i].mycall); LabelSetString (Rmt[i], conf[i].name, NULL); } fscanf (fptr, "%*s %d\n", &curconf); if (curconf >= MAX_CONF) curconf = 0; fclose (fptr); ret = 1; } } for (i = 0 ; i < MAX_CONF ; i++) LabelSetString (Rmt[i], conf[i].name, NULL); /* Set the current config */ XmToggleButtonSetState(Rmt[curconf], True, False); return ret; } int PutConfig (void) { int i; char *home = getenv ("HOME"); if (home) { FILE *fptr; char filename[256]; sprintf (filename, "%s/.xfbbX", home); fptr = fopen (filename, "w"); if (fptr) { for (i = 0 ; i < MAX_CONF ; i++) { int mask = conf[i].mask; mask &= ~(FBB_CONSOLE); fprintf (fptr, "name_%d: %s\n", i, conf[i].name); fprintf (fptr, "host_%d: %s\n", i, conf[i].host); fprintf (fptr, "port_%d: %d\n", i, conf[i].port); fprintf (fptr, "mask_%d: %d\n", i, mask); fprintf (fptr, "pass_%d: %s\n", i, conf[i].pass); fprintf (fptr, "call_%d: %s\n", i, conf[i].mycall); } fprintf (fptr, "curr_c: %d\n", curconf); fclose (fptr); return 1; } } return 0; } static void S_OkCB (Widget w, XtPointer client_data, XtPointer call_data) { wid_t *pw; char *name; char *host; char *port; char *pass; char *call; char msg[256]; pw = (wid_t *) client_data; /* confname */ name = XmTextFieldGetString (pw->wname); /* hostname */ host = XmTextFieldGetString (pw->whost); /* port */ port = XmTextFieldGetString (pw->wport); /* password */ pass = XmTextFieldGetString (pw->wpass); /* callsign */ call = XmTextFieldGetString (pw->wcall); if (!is_call (call)) { char texte[80]; sprintf (texte, "%s is not a valid callsign !", call); MessageBox (60, texte, "Change callsign", MB_ICONEXCLAMATION | MB_OK); } else { strcpy (conf[curconf].name, name); strcpy (conf[curconf].host, host); strcpy (conf[curconf].pass, pass); strcpy (conf[curconf].mycall, call); conf[curconf].port = atoi (port); LabelSetString (Rmt[curconf], conf[curconf].name, NULL); PutConfig (); XtUnmanageChild (pw->wdial); XtDestroyWidget (XtParent (pw->wdial)); pw->wdial = NULL; close_connection (); sleep(2); if (!init_orb (msg)) { MessageBox (0, msg, "Client connection", MB_OK | MB_ICONEXCLAMATION); } } } void SetupDialog (Widget w, XtPointer client_data, XtPointer call_data) { Arg args[20]; Cardinal n; Widget work_area; int conf_ok; static wid_t wid = {NULL, NULL, NULL, NULL, NULL}; if (wid.wdial) { /* Dialog deja ouvert, on le passe devant */ XRaiseWindow (XtDisplay (wid.wdial), XtWindow (XtParent (wid.wdial))); return; } conf_ok = GetConfig (); n = 0; XtSetArg (args[n], XmNautoUnmanage, FALSE); n++; XtSetArg (args[n], XmNmessageAlignment, XmALIGNMENT_CENTER); n++; wid.wdial = XmCreatePromptDialog (toplevel, "setup", args, n); XtUnmanageChild (XmSelectionBoxGetChild (wid.wdial, XmDIALOG_HELP_BUTTON)); XtUnmanageChild (XmSelectionBoxGetChild (wid.wdial, XmDIALOG_TEXT)); XtUnmanageChild (XmSelectionBoxGetChild (wid.wdial, XmDIALOG_SELECTION_LABEL)); XtAddCallback (wid.wdial, XmNokCallback, S_OkCB, (XtPointer) & wid); XtAddCallback (wid.wdial, XmNcancelCallback, S_CancelCB, (XtPointer) & wid); n = 0; work_area = XmCreateWorkArea (wid.wdial, "workarea", args, n); n = 0; XtManageChild (XmCreateLabel (work_area, "confname", NULL, 0)); wid.wname = XmCreateTextField (work_area, "txt_host", NULL, 0); XmTextFieldSetString (wid.wname, conf[curconf].name); XtManageChild (wid.wname); XtManageChild (XmCreateLabel (work_area, "hostname", NULL, 0)); wid.whost = XmCreateTextField (work_area, "txt_host", NULL, 0); XmTextFieldSetString (wid.whost, conf[curconf].host); XtManageChild (wid.whost); XtManageChild (XmCreateLabel (work_area, "portnb", NULL, 0)); wid.wport = XmCreateTextField (work_area, "txt_port", NULL, 0); { char txt[80]; sprintf (txt, "%d", conf[curconf].port); XmTextFieldSetString (wid.wport, txt); } XtManageChild (wid.wport); XtManageChild (XmCreateLabel (work_area, "callsign", NULL, 0)); wid.wcall = XmCreateTextField (work_area, "txt_call", NULL, 0); XmTextFieldSetString (wid.wcall, conf[curconf].mycall); XtManageChild (wid.wcall); XtManageChild (XmCreateLabel (work_area, "password", NULL, 0)); wid.wpass = XmCreateTextField (work_area, "txt_pass", NULL, 0); XmTextFieldSetString (wid.wpass, conf[curconf].pass); XtManageChild (wid.wpass); XtManageChild (work_area); XtManageChild (wid.wdial); } void AboutDialog (Widget w, XtPointer client_data, XtPointer call_data) { char buffer[512]; Arg args[20]; Cardinal n; XmString string; if (about_dialog) { /* Dialog deja ouvert, on le passe devant */ XRaiseWindow (XtDisplay (about_dialog), XtWindow (XtParent (about_dialog))); return; } sprintf (buffer, "xfbbX (Linux version)\n\nVersion %s\n\n" "Copyright 1986-1998. All rights reserved." #ifdef BETA "\n\n" "This version is only for test purpose.\n" "Do not distribute without the author's agreement." #endif "\n", XVersion (TRUE)); string = StringCreate (buffer); n = 0; XtSetArg (args[n], XmNautoUnmanage, FALSE); n++; XtSetArg (args[n], XmNmessageAlignment, XmALIGNMENT_CENTER); n++; XtSetArg (args[n], XmNmessageString, string); n++; about_dialog = XmCreateMessageDialog (toplevel, "about", args, n); XmStringFree (string); XtUnmanageChild (XmMessageBoxGetChild (about_dialog, XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild (about_dialog, XmDIALOG_HELP_BUTTON)); XtAddCallback (about_dialog, XmNokCallback, CancelCB, (XtPointer) & about_dialog); XtManageChild (about_dialog); } void CopyDialog (Widget w, XtPointer client_data, XtPointer call_data) { char buffer[1024]; Arg args[20]; Cardinal n; XmString string; if (copy_dialog) { /* Dialog deja ouvert, on le passe devant */ XRaiseWindow (XtDisplay (copy_dialog), XtWindow (XtParent (copy_dialog))); return; } sprintf (buffer, "\n" " AX25 BBS software - XFBB version %s\n" " (C) F6FBB 1986-1998 (%s)\n\n" "This software is in the public domain. It can be copied or\n" "installed only for amateur use abiding by the laws.\n\n" "All commercial or professional use is prohibited.\n\n" "F6FBB (Jean-Paul ROUBELAT) declines any responsibilty\n" "in the use of XFBB software.\n\n" "This software is free of charge, but a 100 FF or 20 US $\n" "(or more) contribution will be appreciated.\n\n", XVersion (0), date () ); string = StringCreate (buffer); n = 0; XtSetArg (args[n], XmNautoUnmanage, FALSE); n++; XtSetArg (args[n], XmNmessageString, string); n++; copy_dialog = XmCreateMessageDialog (toplevel, "copyright", args, n); XmStringFree (string); XtUnmanageChild (XmMessageBoxGetChild (copy_dialog, XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild (copy_dialog, XmDIALOG_HELP_BUTTON)); XtAddCallback (copy_dialog, XmNokCallback, CancelCB, (XtPointer) & copy_dialog); XtManageChild (copy_dialog); } fbb-7.04j/src/X11/xfbbXcnsl.c0100755000175100017510000005612207726646105013665 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* Index des couleurs */ #define W_SNDT 0 /* Envoie data */ #define W_RCVT 1 /* Recoit data */ #define W_CHNI 2 /* Canal Information */ #define W_MONH 3 /* Monitoring header */ #define W_MOND 4 /* Monitoring data */ #define W_CNST 5 /* Console text */ #define W_BACK 6 /* Background */ #define W_STAT 7 /* Fenetre de status */ #define W_DEFL 8 /* Couleur Fenetre haute */ #define W_VOIE 9 /* Couleur voie */ #define W_NCOL 10 /* Nombre de couleurs definies */ typedef struct { char text[82]; int pos_bis; long color; long color_bis; } Line; typedef struct { Widget drawing; Widget scroll; Widget frame; Widget edit; Widget line1; Widget line2; Widget line3; int premier; int nblignes; int scrollpos; int totlignes; int curligne; int curcol; Line *winbuf; } WinInfo; static WinInfo *cnsl[MAXFEN]; static XFontStruct *fontinfo = NULL; static GC dgc = NULL; static long ColorVal[W_NCOL]; static int sysop_on = FALSE; static Widget CallDialog; #define NB_HISTO 20 static int histo_pos; static char history[NB_HISTO][82]; int SEND = 0; int RECV = 2; int INDIC = 3; int UI = 4; int CONS = 5; int FOND_VOIE = 6; int HEADER = 2; void alloc_buffer (int numero, int nblig); void resizeCB (Widget w, XtPointer data, XtPointer call) { Arg args[20]; Cardinal n; Dimension val; int pos; WinInfo *info = (WinInfo *) data; n = 0; XtSetArg (args[n], XmNheight, &val); n++; XtGetValues (info->drawing, args, n); info->nblignes = val / (fontinfo->ascent + fontinfo->descent); if (info->premier == info->curligne) { pos = info->totlignes - info->nblignes; } else { int offset; offset = info->curligne - info->premier; if (offset < 0) offset += info->totlignes; if (offset > (info->totlignes - info->nblignes)) { offset = info->totlignes - info->nblignes; info->premier = info->curligne - offset; if (info->premier < 0) info->premier += info->totlignes; } pos = info->totlignes - info->nblignes - offset; if (pos < 0) pos += info->totlignes; } n = 0; XtSetArg (args[n], XmNpageIncrement, info->nblignes); n++; XtSetArg (args[n], XmNsliderSize, info->nblignes); n++; XtSetArg (args[n], XmNmaximum, info->totlignes); n++; XtSetArg (args[n], XmNvalue, pos); n++; XtSetValues (info->scroll, args, n); XClearArea (display, XtWindow (info->drawing), 0, 0, 0, 0, TRUE); } void refreshCB (Widget w, XtPointer data, XtPointer call) { int height; int offset; int i; int pos; WinInfo *info = (WinInfo *) data; offset = fontinfo->ascent; height = fontinfo->ascent + fontinfo->descent; pos = info->premier - info->nblignes + 1; if (pos < 0) pos += info->totlignes; for (i = 0; i < info->nblignes; i++) { char *ptr = info->winbuf[pos].text; if (info->winbuf[pos].pos_bis == 0) { XSetForeground (display, dgc, info->winbuf[pos].color); XDrawImageString (display, XtWindow (w), dgc, 5, offset + i * height, ptr, 80); } else { int largeur; /* 1ere couleur */ XSetForeground (display, dgc, info->winbuf[pos].color); XDrawImageString (display, XtWindow (w), dgc, 5, offset + i * height, ptr, info->winbuf[pos].pos_bis); largeur = XTextWidth (fontinfo, ptr, info->winbuf[pos].pos_bis); /* 2eme couleur */ ptr = info->winbuf[pos].text + info->winbuf[pos].pos_bis; XSetForeground (display, dgc, info->winbuf[pos].color_bis); XDrawImageString (display, XtWindow (w), dgc, 5 + largeur, offset + i * height, ptr, 80 - info->winbuf[pos].pos_bis); } ++pos; if (pos >= info->totlignes) pos = 0; } } void scrollCB (Widget w, XtPointer data, XtPointer call) { Arg args[20]; Cardinal n; int val; int offset; WinInfo *info = (WinInfo *) data; n = 0; XtSetArg (args[n], XmNvalue, &val); n++; XtGetValues (w, args, n); offset = info->totlignes - (val + info->nblignes); info->premier = info->curligne - offset; if (info->premier < 0) info->premier += info->totlignes; XClearArea (display, XtWindow (info->drawing), 0, 0, 1, 1, TRUE); } void quitCB (Widget w, XtPointer data, XtPointer call) { } void scroll_window (WinInfo * info) { Arg args[20]; Cardinal n; int pos; int modscroll = 1; if (info->premier == info->curligne) { /* debut de buffer (ligne courante) */ ++info->premier; if (info->premier == info->totlignes) info->premier = 0; modscroll = 0; } ++info->curligne; if (info->curligne == info->totlignes) info->curligne = 0; pos = info->curligne + info->nblignes - 1; if (pos > info->totlignes) pos -= info->totlignes; if (info->premier == pos) { /* fin de buffer */ ++info->premier; if (info->premier == info->totlignes) info->premier = 0; modscroll = 2; } if (modscroll != 1) { if (info->frame) { refreshCB (info->drawing, (XtPointer) info, NULL); } } else if (info->frame) { /* mettre le scrollbar a jour */ int pos; int offset; offset = info->curligne - info->premier; if (offset < 0) offset += info->totlignes; pos = info->totlignes - info->nblignes - offset; if (pos < 0) pos += info->totlignes; n = 0; XtSetArg (args[n], XmNvalue, pos); n++; XtSetValues (info->scroll, args, n); } } static void x_write (char *data, int len, int color, int numero) { int pos; int cr; int i; int c; int reste = 1; char *ptr; long xcolor = ColorVal[color]; WinInfo *info = cnsl[numero]; if (info == NULL) return; pos = info->curcol; ptr = info->winbuf[info->curligne].text; cr = 0; if (info->frame) { XSetForeground (display, dgc, xcolor); } if ((pos) && (xcolor != info->winbuf[info->curligne].color)) { info->winbuf[info->curligne].color_bis = xcolor; info->winbuf[info->curligne].pos_bis = pos; } else info->winbuf[info->curligne].color = xcolor; for (i = 0; i < len; i++) { c = *data++; if (c == '\n') continue; if (c == '\r') { int cpos; if (*data == '\n') { --len; ++data; } cpos = info->curligne + 1; if (cpos >= info->totlignes) cpos = 0; ptr = info->winbuf[cpos].text; ptr[80] = '\0'; memset (ptr, 0x20, 80); info->winbuf[cpos].color = xcolor; info->winbuf[cpos].pos_bis = 0; reste = 0; scroll_window (info); pos = 0; } else { reste = 1; ptr[pos] = c; ++pos; if (pos == 80) { int cpos; cpos = info->curligne + 1; if (cpos >= info->totlignes) cpos = 0; ptr = info->winbuf[cpos].text; ptr[80] = '\0'; memset (ptr, 0x20, 80); info->winbuf[cpos].color = xcolor; info->winbuf[cpos].pos_bis = 0; reste = 0; scroll_window (info); pos = 0; } } } info->curcol = pos; if ((info->frame) && (info->premier == info->curligne) && reste) { char *cptr = info->winbuf[info->curligne].text; int offset = fontinfo->ascent; int height = fontinfo->ascent + fontinfo->descent; XDrawImageString (display, XtWindow (info->drawing), dgc, 5, offset + (info->nblignes - 1) * height, cptr, 80); } } void window_write (int numero, char *data, int len, int color, int header) { int i; for (i = 0; i < len; i++) if (data[i] == '\n') data[i] = '\r'; x_write (data, len, color, numero); } long dos2pixel (int couleur) { static int xcolor[16] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };; couleur &= 0xf; if (xcolor[couleur] == -1) { Colormap cmap; XColor color; unsigned long mask; int r, g, b; int val; unsigned long pixel; val = (couleur & 0x8) ? 0xff : 0x80; if (couleur == 7) r = g = b = 0xc0; else if (couleur == 8) r = g = b = 0x80; else { r = g = b = 0; if (couleur & 1) r = val; if (couleur & 2) g = val; if (couleur & 4) b = val; } cmap = DefaultColormap (display, DefaultScreen (display)); if (XAllocColorCells (display, cmap, FALSE, &mask, 0, &pixel, 1)) { color.pixel = pixel; color.red = r << 8; color.green = g << 8; color.blue = b << 8; color.flags = DoRed | DoGreen | DoBlue; XStoreColor (display, cmap, &color); xcolor[couleur] = pixel; } else { xcolor[couleur] = (r << 16) + (g << 8) + b ; } } return (xcolor[couleur]); } void set_win_colors (void) { ColorVal[W_SNDT] = dos2pixel (SEND); ColorVal[W_RCVT] = dos2pixel (RECV); ColorVal[W_CHNI] = dos2pixel (INDIC); ColorVal[W_MONH] = dos2pixel (HEADER); ColorVal[W_MOND] = dos2pixel (UI); ColorVal[W_CNST] = dos2pixel (CONS); ColorVal[W_BACK] = dos2pixel (FOND_VOIE); ColorVal[W_VOIE] = dos2pixel (INDIC); /* Couleur voies */ } void window_connect (int numero) { char buf[80]; WinInfo *info; if (cnsl[numero] == NULL) alloc_buffer (numero, 100); info = cnsl[numero]; switch (numero) { case 0: strcpy (buf, "Console"); break; case 1: strcpy (buf, "Monitoring"); break; case 2: strcpy (buf, "All channels"); break; default: buf[0] = '\0'; break; } if (info->frame) { Arg args[1]; XtSetArg (args[0], XmNtitle, buf); XtSetValues (info->frame, args, 1); } } void window_disconnect (int numero) { WinInfo *info = cnsl[numero]; if (info == NULL) return; if (numero == CurrentSelection) CurrentSelection = -1; } void window_close (int numero) { switch (numero) { case 0: ConsoleCB (NULL, NULL, NULL); break; case 1: MonitorCB (NULL, NULL, NULL); break; case 2: AllChanCB (NULL, NULL, NULL); break; } } void window_init (void) { int i; for (i = 0; i < MAXFEN; i++) { cnsl[i] = NULL; } display = XtDisplay (toplevel); } int get_win_lig (int numero) { WinInfo *info = cnsl[numero]; if (info) return (info->nblignes); return (25); } void free_buffer (int numero) { if (cnsl[numero]) { free (cnsl[numero]->winbuf); free (cnsl[numero]); cnsl[numero] = NULL; } } void alloc_buffer (int numero, int nblig) { int i; if (cnsl[numero] == NULL) { WinInfo *info = (WinInfo *) calloc (sizeof (WinInfo), 1); if (info == NULL) { printf ("cannot allocate buffer for channel %d\n", numero); exit (2); } info->winbuf = (Line *) calloc (sizeof (Line), nblig); info->totlignes = nblig; info->nblignes = 25; for (i = 0; i < nblig; i++) { info->winbuf[i].text[80] = '\0'; memset (info->winbuf[i].text, 0x20, 80); info->winbuf[i].color = 0; info->winbuf[i].color_bis = 0; info->winbuf[i].pos_bis = 0; } cnsl[numero] = info; } } static void CallOkCB (Widget w, XtPointer client_data, XtPointer call_data) { } static void CallCancelCB (Widget w, XtPointer client_data, XtPointer call_data) { sysop_end (); } void sysop_end (void) { if (sysop_on) { XtUnmanageChild (CallDialog); XtDestroyWidget (CallDialog); sysop_on = FALSE; } } void sysop_call (char *texte) { Arg args[20]; Cardinal n; XmString string; if (!sysop_on) { sysop_on = TRUE; string = XmStringCreateSimple (texte); /* Cree la fenetre de l'appel */ n = 0; XtSetArg (args[n], XmNautoUnmanage, FALSE); n++; XtSetArg (args[n], XmNtitle, "Sysop call"); n++; XtSetArg (args[n], XmNmessageString, string); n++; CallDialog = XmCreateMessageDialog (toplevel, "call_dialog", args, n); XtAddCallback (CallDialog, XmNokCallback, CallOkCB, NULL); XtAddCallback (CallDialog, XmNcancelCallback, CallCancelCB, NULL); XtUnmanageChild (XmMessageBoxGetChild (CallDialog, XmDIALOG_HELP_BUTTON)); XtManageChild (CallDialog); XmStringFree (string); } } static void deleteCB (Widget w, XtPointer data, XtPointer call) { int numero = (int) data; window_close (numero); } static void editCB (Widget w, XtPointer data, XtPointer call) { char *ptr; char buffer[82]; WinInfo *info = (WinInfo *) data; ptr = XmTextFieldGetString (info->line2); XmTextFieldSetString (info->line3, ptr); ptr = XmTextFieldGetString (info->line1); XmTextFieldSetString (info->line2, ptr); ptr = XmTextFieldGetString (info->edit); XmTextFieldSetString (info->line1, ptr); XmTextFieldSetString (info->edit, ""); strcpy (buffer, ptr); if (++histo_pos == NB_HISTO) histo_pos = 0; strcpy (history[histo_pos], buffer); strcat (buffer, "\r"); window_write (CONSOLE, buffer, strlen (buffer), W_CNST, 0); console_input (buffer, strlen (buffer)); } static void KeyEV (Widget w, XtPointer data, XKeyEvent * event) { int i; int lg; int code; char *ptr; XmTextPosition pos; WinInfo *info = (WinInfo *) data; code = event->keycode; if (event->state & 1) code |= 0x100; /* shift */ if (event->state & 4) code |= 0x400; /* control */ if (event->state & 8) code |= 0x800; /* alt */ switch (event->keycode) { case 0x009: /* escape */ ptr = XmTextFieldGetString (info->edit); if (strlen (ptr) == 0) { /* commande Esc */ /* console_inbuf("\033\r", 2); */ } else { /* Efface la commande en cours */ XmTextFieldSetString (info->edit, ""); } XtFree (ptr); break; case 0x062: /* UP */ case 0x162: /* Shift-UP */ /* ligne precedente */ for (i = 0; i < NB_HISTO; i++) { char *ptr = history[histo_pos]; if (histo_pos == 0) histo_pos = NB_HISTO; --histo_pos; if (*ptr) { XmTextFieldSetString (info->edit, ptr); XmTextFieldSetInsertionPosition (info->edit, 80); break; } } break; case 0x068: /* DW */ case 0x168: /* Shift-DW */ /* ligne suivante */ for (i = 0; i < NB_HISTO; i++) { if (++histo_pos == NB_HISTO) histo_pos = 0; if (*history[histo_pos]) { XmTextFieldSetString (info->edit, history[histo_pos]); XmTextFieldSetInsertionPosition (info->edit, 80); break; } } break; case 0x462: /* Ctrl-UP */ /* Scroll UP */ break; case 0x468: /* Ctrl-DW */ /* scroll DW */ break; case 0x063: /* PUP */ case 0x163: /* Shift-PUP */ break; case 0x069: /* PDW */ case 0x169: /* Shift-PDW */ break; case 0x463: /* Ctrl-PUP */ break; case 0x469: /* Ctrl-PDW */ break; } /* Teste la fin de ligne */ pos = XmTextFieldGetInsertionPosition (info->edit); lg = XmTextFieldGetMaxLength (info->edit); if (pos == lg) { char *scan; ptr = XmTextFieldGetString (info->edit); scan = strrchr (ptr, ' '); if (scan) { *scan++ = '\0'; } XmTextFieldSetString (info->edit, ptr); editCB (w, info, NULL); if ((scan) && (*scan)) { XmTextFieldSetString (info->edit, scan); XmTextFieldSetInsertionPosition (info->edit, 80); } XtFree (ptr); } } WinInfo *xcnsl (int numero, Widget pere, int nblig, Arg * argp, Cardinal np) { Arg args[20]; Cardinal n; Pixel foreground; Pixel background; Widget form; WinInfo *info; int mask; XGCValues values; Dimension hg; Widget separe = NULL; int console = (numero == CONSOLE); if (cnsl[numero] == NULL) alloc_buffer (numero, nblig); info = cnsl[numero]; form = XmCreateForm (pere, "form", argp, np); if (display == NULL) display = XtDisplay (form); if (fontinfo == NULL) fontinfo = XLoadQueryFont (display, "6x10"); if (console) { XmFontList fontlist; memset (history, 0, NB_HISTO * 82); fontlist = XmFontListCreate (fontinfo, XmSTRING_DEFAULT_CHARSET); n = 0; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNmarginHeight, 0); n++; XtSetArg (args[n], XmNmaxLength, 78); n++; XtSetArg (args[n], XmNshadowThickness, 0); n++; XtSetArg (args[n], XmNhighlightThickness, 0); n++; XtSetArg (args[n], XmNfontList, fontlist); n++; info->edit = XmCreateTextField (form, "edit", args, n); XtManageChild (info->edit); n = 0; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNbottomWidget, info->edit); n++; XtSetArg (args[n], XmNeditable, FALSE); n++; XtSetArg (args[n], XmNmarginHeight, 0); n++; XtSetArg (args[n], XmNshadowThickness, 0); n++; XtSetArg (args[n], XmNhighlightThickness, 0); n++; XtSetArg (args[n], XmNcursorPositionVisible, FALSE); n++; XtSetArg (args[n], XmNfontList, fontlist); n++; info->line1 = XmCreateTextField (form, "line1", args, n); XtManageChild (info->line1); XtSetKeyboardFocus (info->line1, info->edit); n = 0; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNbottomWidget, info->line1); n++; XtSetArg (args[n], XmNeditable, FALSE); n++; XtSetArg (args[n], XmNmarginHeight, 0); n++; XtSetArg (args[n], XmNshadowThickness, 0); n++; XtSetArg (args[n], XmNhighlightThickness, 0); n++; XtSetArg (args[n], XmNcursorPositionVisible, FALSE); n++; XtSetArg (args[n], XmNfontList, fontlist); n++; info->line2 = XmCreateTextField (form, "line2", args, n); XtManageChild (info->line2); XtSetKeyboardFocus (info->line2, info->edit); n = 0; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNbottomWidget, info->line2); n++; XtSetArg (args[n], XmNeditable, FALSE); n++; XtSetArg (args[n], XmNmarginHeight, 0); n++; XtSetArg (args[n], XmNshadowThickness, 0); n++; XtSetArg (args[n], XmNhighlightThickness, 0); n++; XtSetArg (args[n], XmNcursorPositionVisible, FALSE); n++; XtSetArg (args[n], XmNfontList, fontlist); n++; info->line3 = XmCreateTextField (form, "line3", args, n); XtManageChild (info->line3); XtSetKeyboardFocus (info->line3, info->edit); n = 0; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNbottomWidget, info->line3); n++; separe = XmCreateSeparator (form, "separator", args, n); XtManageChild (separe); XtAddCallback (info->edit, XmNactivateCallback, editCB, (XtPointer) info); XtAddEventHandler (info->edit, KeyPressMask, FALSE, (XtEventHandler) KeyEV, (XtPointer) info); XmFontListFree (fontlist); XtSetKeyboardFocus (form, info->edit); } n = 0; if (console) { XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNbottomWidget, separe); n++; } else { XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; } XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNmaximum, nblig); n++; info->scroll = XmCreateScrollBar (form, "scroll", args, n); XtManageChild (info->scroll); n = 0; if (console) { XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNbottomWidget, separe); n++; } else { XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; } XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_WIDGET); n++; XtSetArg (args[n], XmNrightWidget, info->scroll); n++; XtSetArg (args[n], XmNwidth, 500); n++; XtSetArg (args[n], XmNheight, 200); n++; info->drawing = XmCreateDrawingArea (form, "drawing", args, n); XtManageChild (info->drawing); XtManageChild (form); XtSetKeyboardFocus (info->drawing, info->edit); n = 0; XtSetArg (args[n], XmNforeground, &foreground); n++; XtSetArg (args[n], XmNbackground, &background); n++; XtSetArg (args[n], XmNheight, &hg); n++; XtGetValues (info->drawing, args, n); /* info->premier = 0; */ mask = GCForeground | GCBackground | GCFont; values.background = background; values.foreground = foreground; values.font = fontinfo->fid; if (dgc == NULL) dgc = XtGetGC (info->drawing, mask, &values); XtAddCallback (info->scroll, XmNvalueChangedCallback, scrollCB, info); XtAddCallback (info->scroll, XmNdragCallback, scrollCB, info); XtAddCallback (info->drawing, XmNexposeCallback, refreshCB, info); XtAddCallback (info->drawing, XmNresizeCallback, resizeCB, info); info->nblignes = hg / (fontinfo->ascent + fontinfo->descent); n = 0; XtSetArg (args[n], XmNpageIncrement, info->nblignes); n++; XtSetArg (args[n], XmNsliderSize, info->nblignes); n++; XtSetArg (args[n], XmNmaximum, info->totlignes); n++; XtSetArg (args[n], XmNvalue, info->totlignes - info->nblignes); n++; XtSetValues (info->scroll, args, n); return (info); } void ShowFbbWindow (int numero, Widget parent) { WinInfo *info; if (cnsl[numero] == NULL) alloc_buffer (numero, 100); info = cnsl[numero]; if (info->frame) { if (XtIsManaged (info->frame)) { XRaiseWindow (XtDisplay (info->frame), XtWindow (info->frame)); } else XtManageChild (info->frame); } else { Arg args[20]; Cardinal n; Atom DelWindow; char buf[80]; if (numero == CONSOLE) { sprintf (buf, "Console"); } else if (numero == MONITOR) { sprintf (buf, "Monitoring"); } else if (numero == ALLCHAN) { sprintf (buf, "All channels"); } n = 0; XtSetArg (args[n], XmNdeleteResponse, XmDO_NOTHING); ++n; XtSetArg (args[n], XmNtitle, buf); ++n; info->frame = XmCreateDialogShell (parent, "cnsl", args, n); xcnsl (numero, info->frame, 100, NULL, 0); XtManageChild (info->frame); DelWindow = XInternAtom (display, "WM_DELETE_WINDOW", FALSE); XmAddWMProtocolCallback (info->frame, DelWindow, deleteCB, (XtPointer) numero); } fenetre[numero] = 1; } void HideFbbWindow (int numero, Widget parent) { if ((cnsl[numero]) && (cnsl[numero]->frame) && (XtIsManaged (cnsl[numero]->frame))) { XtUnmanageChild (cnsl[numero]->frame); } fenetre[numero] = 0; } void ToggleFbbWindow (int numero, Widget parent) { if ((cnsl[numero]) && (cnsl[numero]->frame) && (XtIsManaged (cnsl[numero]->frame))) { HideFbbWindow (numero, parent); } else { ShowFbbWindow (numero, parent); } } fbb-7.04j/src/X11/res/0042755000175100017510000000000007726646105012355 5ustar abaabafbb-7.04j/src/X11/res/xfbb0100644000175100017510000003560407726646105013224 0ustar abaaba! ! Resources of XFBB Version 7.00 ! xfbb*background: #c0c0c0 *selectColor: green *indicatorSize: 14 *XmTextField.shadowThickness: 1 *XmScrollBar.shadowThickness: 1 *XmList.shadowThickness: 1 *XmPushButton.shadowThickness: 1 *XmToggleButton.shadowThickness: 1 *XmCascadeButton.shadowThickness: 1 *XmToggleButton.indicatorOn: INDICATOR_CHECK *highlightThickness: 1 *XmForm.marginHeight: 1 *XmForm.marginWidth: 1 ! ! Key translations ! ! *translations : #override \ NoneF1: Help() \n\ CtrlF2: Console() \n\ NoneF3: Disconnect() \n\ NoneF4: PendingFwd() \n\ NoneF5: Monitor() \n\ NoneF6: SetCall() \n\ NoneF7: ProgTnc() \n\ NoneF9: Gateway() \n\ NoneF10: TalkTo() \n\ AltF3: MsgScan() \n\ AltF5: Editor() \n\ AltF7: ListCnx() \n\ CtrlF1: SndText(1) \n\ CtrlF2: SndText(2) \n\ CtrlF3: SndText(3) \n\ CtrlF4: SndText(4) \n\ CtrlF5: SndText(5) \n\ CtrlF6: SndText(6) \n\ CtrlF7: SndText(7) \n\ CtrlF8: SndText(8) \n\ CtrlF9: SndText(9) \n\ CtrlF10: SndText(0) \n ! ! Menues ! *menu_bar.file.labelString: File *file.scan_sys.labelString: Scan system files *file.scan_msg.labelString: Scan messages *file.maintenance.labelString: Maintenance *file.re_run.labelString: Re-run *file.exit.labelString: Exit *file.exit.accelerator: Metax *file.exit.acceleratorTex: Alt+X *menu_bar.user.labelString: User *user.talk.labelString: Talk to *user.show.labelString: Show *user.infos.labelString: Infos *user.disconnect.labelString: Disconnect *user.last_connections.labelString: Last connections *menu_bar.edit.labelString: Edit *edit.user.labelString: User *edit.message.labelString: Message *edit.forwarding.labelString: Forwarding *edit.system_file.labelString: System file *menu_bar.window.labelString: Window *window.console.labelString: Console *window.gateway.labelString: Gateway *window.monitoring.labelString: Monitoring *window.all_channels.labelString: All channels *menu_bar.options.labelString: Options *options.editor.labelString: Full page editor *options.justification.labelString: Justification *options.connection_bip.labelString: Connection beep *options.sysop_call.labelString: Sysop call *options.gateway.labelString: Gateway *options.banners.labelString: Banners *options.soundcard.labelString: Sound card *options.inexport.labelString: Import/Export display *menu_bar.config.labelString: Config *config.tnc_parameters.labelString: TNC parameters *config.console_callsign.labelString: Console callsign *config.main_parameters.labelString: Main parameters *config.fonts.labelString: Fonts *menu_bar.help.labelString: Help *help.contents.labelString: Contents *help.copyright.labelString: Copyright *help.about.labelString: About ! ! Strings of standard buttons ! *close.labelString: Close *apply.labelString: Apply ! ! Console callsign dialog ! *callsign_popup.title: Edit User *callsign*selectionLabelString: Callsign-SSID ! ! Edit User dialog ! *edit_user_popup.title: Edit User *edit_user*add_user.labelString: Add user *edit_user*del_user.labelString: Del user *edit_user*name.labelString: Name *edit_user*password.labelString: Password *edit_user*zip_code.labelString: Zip code *edit_user*private_dir.labelString: Private dir *edit_user*home_bbs.labelString: Home BBS *edit_user*read_all.labelString: Read all *edit_user*paging.labelString: Paging *edit_user*bbs.labelString: BBS *edit_user*pms.labelString: PMS *edit_user*sysop.labelString: Sysop *edit_user*expert.labelString: Expert *edit_user*local.labelString: Local *edit_user*excluded.labelString: Excluded *edit_user*modem.labelString: Modem *edit_user*unproto.labelString: Unproto *edit_user*private_msg.labelString: Private mail ! ! Edit Message dialog ! *edit_msg_popup.title: Edit Message *edit_msg*edit_fwd.labelString: Edit fwd *edit_msg*edit_text.labelString: Edit text *edit_msg*msg.labelString: Msg *edit_msg*from.labelString: From *edit_msg*bid.labelString: BID *edit_msg*to.labelString: To *edit_msg*via.labelString: Via *edit_msg*title.labelString: Title *edit_msg*sent.labelString: Sent *edit_msg*recv.labelString: Recv *edit_msg*size.labelString: Size *edit_msg*type.labelString: Type *edit_msg*status.labelString: Status *edit_msg*rcData.bottomOffset: 10 *edit_msg*data.labelString: Data ! ! Edit Forward dialog ! *edit_fwd_popup.title: Edit Forward *edit_fwd*apply.leftOffset: 20 *edit_fwd*close.leftOffset: 20 *edit_fwd*fwd_toggle.highlightThickness:0 *edit_fwd*fwd_toggle.shadowThickness: 0 *edit_fwd*fwd_rc.spacing: 0 *edit_fwd*fwd_toggle.marginHeight: 0 *edit_fwd*fwd_toggle_exd.highlightThickness:0 *edit_fwd*fwd_toggle_exd.shadowThickness:0 *edit_fwd*fwd_toggle_exd.set: true *edit_fwd*fwd_toggle_exw.highlightThickness:0 *edit_fwd*fwd_toggle_exw.shadowThickness:0 *edit_fwd*fwd_toggle_exw.marginHeight: 0 *edit_fwd*fwd_toggle_exw.set: true *edit_fwd*fwd_toggle_exd.sensitive: false *edit_fwd*fwd_toggle_exw.sensitive: false *edit_fwd*fwd_toggle_exw.indicatorOn: true *edit_fwd*fwd_toggle_exw.selectColor: red *edit_fwd*fwd_toggle_exd.indicatorOn: INDICATOR_CHECK_BOX *edit_fwd*fwd_toggle_exd.labelString: *edit_fwd*fwd_toggle_exw.labelString: *edit_fwd*fwd_label_exd.labelString: Fwd Done *edit_fwd*fwd_label_exw.labelString: Fwd waiting ! Pending forward dialog ! *pending_fwd_popup.title: Pending Forward *pending_fwd*fwd_list.bottomOffset: 5 *pending_fwd*stop_fwd.labelString: Stop fwd *pending_fwd*start_fwd.labelString: Start fwd *pending_fwd*start_all.labelString: Start all *pending_fwd*import_fwd.labelString: Import fwd *pending_fwd*export_fwd.labelString: Export fwd ! ! Connection list dialog ! *cnx_dialog_popup.title: Last Connections *cnx_dialog*toggle_filter.highlightThickness: 0 *cnx_dialog*toggle_filter.labelString: SubString *cnx_dialog*toggle_filter.shadowThickness: 0 *cnx_dialog*toggle_filter.marginWidth: 0 *cnx_dialog*toggle_filter.indicatorOn: INDICATOR_CHECK_BOX *cnx_dialog*toggle_filter.set: true *cnx_dialog*text_filter.columns: 6 *cnx_dialog*text_filter.maxLength: 6 *cnx_dialog*text_filter.marginHeight: 4 *cnx_dialog*combo_ports.shadowThickness: 1 *cnx_dialog*combo_ports.Text.marginHeight: 1 *cnx_dialog*combo_ports.Text.columns: 10 *cnx_dialog*combo_ports.Text.editable: False *cnx_dialog*combo_ports.Text.autoShowCursorPosition : False ! ! User informations dialog ! *infos_popup.title: Informations *infos*rc_info.bottomOffset: 5 *infos*show.labelString: Show *infos*l_separator.labelString: *infos*r_separator.labelString: *infos*callsign.labelString: Callsign : *infos*digis.labelString: Digis : *infos*name.labelString: Name : *infos*home_bbs.labelString: Home BBS : *infos*channel.labelString: Channel : *infos*port.labelString: Port : *infos*n1_n2_n3.labelString: N1,N2,N3 : *infos*flags.labelString: Flags : *infos*paclen.labelString: Paclen : *infos*status.labelString: Status : *infos*mem_used.labelString: Memory used : *infos*buffers.labelString: Buffers : *infos*retries.labelString: Retries : *infos*priv_msg.labelString: Private messages : *infos*unread_msg.labelString: Unread messages : *copyright_popup.title: Copyright *about_popup.title: About *menu_bar.shadowThickness: 1 *tool_bar.topOffset: 3 *tool_bar.shadowThickness: 0 *tool_bar.spacing: 0 *tool_bar.marginWidth: 0 *tool_bar.marginHeight: 0 *B1.labelPixmap: console.xpm *B2.labelPixmap: gateway.xpm *B3.labelPixmap: monitor.xpm *B4.labelPixmap: allchan.xpm *B5.labelPixmap: onechan.xpm *B6.labelPixmap: userinf.xpm *B7.labelPixmap: disconn.xpm *B8.labelPixmap: talkto.xpm *B9.labelPixmap: listcnx.xpm *B10.labelPixmap: edituser.xpm *B11.labelPixmap: editmsg.xpm *B12.labelPixmap: pending.xpm *B13.labelPixmap: editsysf.xpm *B14.labelPixmap: print.xpm *B15.labelPixmap: stop.xpm *B16.labelPixmap: help.xpm *B1.labelInsensitivePixmap: consol_u.xpm *B2.labelInsensitivePixmap: gatew_u.xpm *B3.labelInsensitivePixmap: monit_u.xpm *B4.labelInsensitivePixmap: allchn_u.xpm *B5.labelInsensitivePixmap: onechn_u.xpm *B6.labelInsensitivePixmap: usrinf_u.xpm *B7.labelInsensitivePixmap: discon_u.xpm *B8.labelInsensitivePixmap: talkto_u.xpm *B9.labelInsensitivePixmap: listcn_u.xpm *B10.labelInsensitivePixmap: editus_u.xpm *B11.labelInsensitivePixmap: editm_u.xpm *B12.labelInsensitivePixmap: pend_u.xpm *B13.labelInsensitivePixmap: edit_u.xpm *B14.labelInsensitivePixmap: print_u.xpm *B15.labelInsensitivePixmap: stop_u.xpm *B16.labelInsensitivePixmap: help_u.xpm *list_label.labelString: No connected station *status_label.labelString: Status *txt_used.labelString: Used memory *txt_gmem.labelString: Data memory *txt_disk1.labelString: Disk#1 free *txt_disk2.labelString: Disk#2 free *txt_msgs.labelString: Messages *txt_resync.labelString: Resynchro *txt_state.labelString: State *txt_hold.labelString: Hold msgs *txt_priv.labelString: Priv msgs *used.labelString: : 0 *disk1.labelString: : 0 *disk2.labelString: : 0 *msgs.labelString: : 0 *resync.labelString: : 0 *state.labelString: : Idle *hold.labelString: : 0 *private.labelString: : 0 *stat_list.marginWidth: 0 *stat_list.marginHeight: 0 *stat_list.spacing: 0 *callsign_list.listMarginWidth: 5 *language_list.listMarginWidth: 5 *message_list.listMarginWidth: 5 *jauge.height: 25 *jauge.sliderSize : 100 *footer.alignment: ALIGNMENT_BEGINNING *toggle_b.highlightThickness: 0 *toggle_b.shadowThickness: 0 *toggle_b.indicatorOn: INDICATOR_CHECK_BOX *rcType.XmToggleButton.indicatorType: ONE_OF_MANY_ROUND *rcType.XmToggleButton.shadowThickness: 0 *rcType.XmToggleButton.selectColor: red *rcType.XmToggleButton.indicatorSize: 12 *rcStat.XmToggleButton.indicatorType: ONE_OF_MANY_ROUND *rcStat.XmToggleButton.shadowThickness: 0 *rcStat.XmToggleButton.selectColor: red *rcStat.XmToggleButton.indicatorSize: 12 ! Editor Work Window Resources *MainWin.mainWindowMarginWidth: 5 *MainWin.mainWindowMarginHeight: 5 *TextWinSW.topOffset: 3 *TextWin.shadowThickness: 1 *TextWin.highlightThickness: 0 *TextWin.fontList: 6x10 *TextWin.editMode: MULTI_LINE_EDIT *TextWin.rows: 25 *TextWin.columns: 82 *TextWin.resizeWidth: False *TextWin.wordWrap: True ! Editor toolbar pixmaps *Open.labelPixmap: open.xpm *Save.labelPixmap: save.xpm *Cut.labelPixmap: cut.xpm *Copy.labelPixmap: copy.xpm *Paste.labelPixmap: paste.xpm *Find.labelPixmap: find.xpm *Replace.labelPixmap: replace.xpm *Justify.labelPixmap: editjust.xpm *Wrap.labelPixmap: editwrap.xpm *Deliver.labelPixmap: deliver.xpm *Help.labelPixmap: help.xpm *Open.labelInsensitivePixmap: open_u.xpm *Save.labelInsensitivePixmap: save_u.xpm *Cut.labelInsensitivePixmap: cut_u.xpm *Copy.labelInsensitivePixmap: copy_u.xpm *Paste.labelInsensitivePixmap: paste_u.xpm *Find.labelInsensitivePixmap: find_u.xpm *Replace.labelInsensitivePixmap: replac_u.xpm *Justify.labelInsensitivePixmap: just_u.xpm *Wrap.labelInsensitivePixmap: wrap_u.xpm !*Deliver.labelInsensitivePixmap: deliv_u.xpm *Help.labelInsensitivePixmap: help_u.xpm ! Editor Main Menu Resources *FileTopic.labelString: File *File_New.labelString: New *File_Open.labelString: Open... *File_Insert.labelString: Insert... *File_Save.labelString: Save *File_SaveAs.labelString: Save As... *File_Deliver.labelString: Deliver *File_Exit.labelString: Exit ! *FileTopic.mnemonic: F *File_New.mnemonic: N *File_Open.mnemonic: O *File_Insert.mnemonic: O *File_Save.mnemonic: S *File_SaveAs.mnemonic: A *File_Deliver.mnemonic: D *File_Exit.mnemonic: E ! *File_New.accelerator: Metan *File_Open.accelerator: Metao *File_Insert.accelerator: Metai *File_Save.accelerator: Metas *File_Deliver.accelerator: Ctrlz *File_Exit.accelerator: Metaq ! *File_New.acceleratorText: Alt+N *File_Open.acceleratorText: Alt+O *File_Insert.acceleratorText: Alt+I *File_Save.acceleratorText: Alt+S *File_Deliver.acceleratorText: Ctl+Z *File_Exit.acceleratorText: Alt+Q *EditTopic.labelString: Edit *Edit_Cut.labelString: Cut *Edit_Copy.labelString: Copy *Edit_Paste.labelString: Paste *Edit_Delete.labelString: Delete *Edit_Find.labelString: Find... *Edit_Repl.labelString: Replace... ! *EditTopic.mnemonic: E *Edit_Cut.mnemonic: C *Edit_Copy.mnemonic: p *Edit_Paste.mnemonic: P *Edit_Delete.mnemonic: l *Edit_Find.mnemonic: F *Edit_Repl.mnemonic: R *ViewTopic.labelString: View *View_Top.labelString: Top *View_Bot.labelString: Bottom *View_Page.labelString: Page... ! *ViewTopic.mnemonic: V *View_Top.mnemonic: T *View_Bot.mnemonic: B *View_Page.mnemonic: P *OptionTopic.labelString: Options *Option_Font.labelString: Font... *Option_Justif.labelString: Justification *Option_Wrap.labelString: Auto-Wrap ! *OptionTopic.mnemonic: O *Option_Font.mnemonic: F *HelpTopic.labelString: Help *Help_Lbl.labelString: No Help Available ! *HelpTopic.mnemonic: H ! Editor Find Dialog Resources *FindDB.width: 200 *FindDB.autoUnmanage: FALSE *FindDB.dialogTitle: Find... *FindDB.marginWidth: 0 *FindDB.*.background: Gray75 *FindDB.*.foreground: Black *FindDB.*.topShadowColor: White *FindDB.*.bottomShadowColor: Gray50 *Find_Lbl.x: 10 *Find_Lbl.y: 12 *Find_Lbl.width: 40 *Find_Lbl.labelString: Find: *Find_Txt.x: 50 *Find_Txt.y: 10 *Find_Txt.width: 140 *Rep_Lbl.x: 10 *Rep_Lbl.y: 42 *Rep_Lbl.width: 40 *Rep_Lbl.labelString: Repl: *Rep_Txt.x: 50 *Rep_Txt.y: 40 *Rep_Txt.width: 140 *Find_Sep.x: 0 *Find_Sep.y: 80 *Find_Sep.width: 200 *Find_Btn1.x: 5 *Find_Btn1.y: 90 *Find_Btn1.width: 50 *Find_Btn1.recomputeSize: FALSE *Find_Btn1.showAsDefault: 1 *Find_Btn3.x: 70 *Find_Btn3.y: 90 *Find_Btn3.width: 50 *Find_Btn3.recomputeSize: FALSE *Find_Btn2.x: 135 *Find_Btn2.y: 90 *Find_Btn2.width: 50 *Find_Btn2.recomputeSize: FALSE ! Editor "Can't Find" Alert Resources *CantFind.dialogTitle: Find... *CantFind.messageString: Search Complete ! Editor Standard File Dialog Resources *StdFile.*.background: Gray75 *StdFile.*.foreground: Black *StdFile.*.topShadowColor: White *StdFile.*.bottomShadowColor: Gray50 *StdFile.listVisibleItemCount: 5 ! Editor "Quit without Sending?" Alert Resources *SendAlert.dialogTitle: Warning *SendAlert.messageString: Quit without Sending the message? *SendAlert.defaultButtonType: DIALOG_CANCEL_BUTTON *SendAlert.helpLabelString: Quit ! Editor "Quit without Saving?" Alert Resources *SaveAlert.dialogTitle: Warning *SaveAlert.messageString: Quit without Saving? *SaveAlert.defaultButtonType: DIALOG_CANCEL_BUTTON *SaveAlert.helpLabelString: Quit *SaveAlert.okLabelString: Save ! CDE stuff *enableBtn1Transfer: True *enableEtchedInMenu: True *enableButtonTab: True *enableMenuInCascade: True *defaultButtonEmphasis: internal_highlight *enableToggleColor: True *enableDragIcon: True fbb-7.04j/src/X11/res/bitmaps/0042750000175100017510000000000007726646105014007 5ustar abaabafbb-7.04j/src/X11/res/bitmaps/allchan.xpm0100640000175100017510000000123607726646105016135 0ustar abaaba/* XPM */ static char * allchan_xpm[] = { /* width height num_colors chars_per_pixel */ "20 20 4 1", /* colors */ " c #C0C0C0C0C0C0", ". c black", "X c #ffff00", "o c white", /* pixels */ " ", " .............. ", " .XoXoXoXoXoXo. ", " .o.o.o.o.o.oX. ", " ...XoXoXoXoXoXo. ", " .o.o.o.o.o.oXoX. ", " .X.XoXoXoXoXoXo. ", " ...o.o.o.o.oXoXoX. ", " .X.X.XoXoXoXoXoXo. ", " .o.o.o.o.o.o.oXoX. ", " .X.X.XoXoXoXoXoXo. ", " .o.o.............. ", " .X.XoXoXoXoXoXo. ", " .o.oXoXoXoXoXoX. ", " .X.............. ", " .oXoXoXoXoXoX. ", " .XoXoXoXoXoXo. ", " .............. ", " ", " "}; fbb-7.04j/src/X11/res/bitmaps/allchn_u.xpm0100640000175100017510000001444307726646105016324 0ustar abaaba/* XPM */ static char *allchn_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", ".....##############.", ".....##a#a#a#a#a#a#a", ".....#a#.#.#.#.#.##a", "...####.#.#.#.#.#.#a", "...#a#a#.#.#.#.#.##a", "...####.#.#.#.#.#.#a", ".###a#a#.#.#.#.#.##a", ".######.#.#.#.#.#.#a", ".#a#a#a#.#.#.#.#.##a", ".######.#.#.#.#.#.#a", ".#a#a##############a", ".####.#a#a#a#a#a#aaa", ".#a#a#.#.#.#.#.##a..", ".################a..", ".#a#a#a#a#a#a##aaa..", ".##.#.#.#.#.#.#a....", ".##############a....", "..aaaaaaaaaaaaaa....", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/channel.xpm0100640000175100017510000001446107726646105016147 0ustar abaaba/* XPM */ static char *channel[] = { /* width height num_colors chars_per_pixel */ " 20 20 4 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ffff00", "b c #ffffff", /* pixels */ "####################", "####...............#", "####.ababababababa.#", "####.b.b.b.b.b.b.b.#", "####.ababababababa.#", "####.b.b.b.b.babab.#", "####.ababababababa.#", "####.b.b.b.bababab.#", "####.ababababababa.#", "####.b.b.b.b.b.bab.#", "####.ababababababa.#", "####...............#", "##########.#.#######", "##########...#######", "##########...#######", "##########.#.#######", "#########.#.#.######", "######...........###", "####################", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/consol_u.xpm0100640000175100017510000001444307726646105016360 0ustar abaaba/* XPM */ static char *consol_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "....###############.", "....##a#a#a#a#a#a##a", "....#a#.#.#.#.#.#.#a", "....##.#.#.#.#.#.##a", "....#a#.#.#.#.#.#.#a", "....##.#.#.#.#.#.##a", "....#a#.#.#.#.#.#.#a", "....##.#.#.#.#.#.##a", "....#a#.#.#.#.#.#.#a", "....##.#.#.#.#.#.##a", "....###############a", ".....aaaaaaaaaaaaaaa", "....###############.", "...################a", "...###############aa", "..###############aa.", "..###############a..", "...aaaaaaaaaaaaaaa..", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/console.xpm0100640000175100017510000001450007726646105016173 0ustar abaaba/* XPM */ static char *console[] = { /* width height num_colors chars_per_pixel */ " 20 20 5 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ffff00", "b c #00ffff", "c c #ffffff", /* pixels */ "####################", "####...............#", "####.acacacacacaca.#", "####.c.c.c.c.c.c.c.#", "####.acacacacacaca.#", "####.c.c.c.c.cacac.#", "####.acacacacacaca.#", "####.c.c.c.cacacac.#", "####.acacacacacaca.#", "####.c.c.c.c.c.cac.#", "####.acacacacacaca.#", "####...............#", "####################", "####...............#", "###..b.b.b.b.b.b.b.#", "###.b.b.b.b.b.b.b.##", "##.b.b.b.b.b.b.b.###", "##...............###", "####################", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/copy-up.xpm0100640000175100017510000000200007726646105016115 0ustar abaaba/* XPM */ static char * copy[] = { "28 28 4 1", "X c Gray75 s backgroundToolBarColor", "o c black", "O c white", "+ c Gray60", "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXoooooooooXXXXXXXXXXXXXX", "XXXXXoOOOOOOOooXXXXXXXXXXXXX", "XXXXXoOOOOOOOo+oXXXXXXXXXXXX", "XXXXXoOoooooOooooXXXXXXXXXXX", "XXXXXoOOOOOOOOOOoXXXXXXXXXXX", "XXXXXoOooooOOOOOoXXXXXXXXXXX", "XXXXXoOOOOOOOOOOoXXXXXXXXXXX", "XXXXXoOOOOOoooooooooXXXXXXXX", "XXXXXoOooOOoOOOOOOOooXXXXXXX", "XXXXXoOOOOOoOOOOOOOo+oXXXXXX", "XXXXXoOOOOOoOoooooOooooXXXXX", "XXXXXoOOOOOoOOOOOOOOOOoXXXXX", "XXXXXoOOOOOoOooooOOOOOoXXXXX", "XXXXXoooooooOOOOOOOOOOoXXXXX", "XXXXXXXXXXXoOOOOOOOOOOoXXXXX", "XXXXXXXXXXXoOoooooooOOoXXXXX", "XXXXXXXXXXXoOOOOOOOOOOoXXXXX", "XXXXXXXXXXXoOOOOOOOOOOoXXXXX", "XXXXXXXXXXXoOOOOOOOOOOoXXXXX", "XXXXXXXXXXXoOOOOOOOOOOoXXXXX", "XXXXXXXXXXXooooooooooooXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"}; fbb-7.04j/src/X11/res/bitmaps/copy.xpm0100640000175100017510000001447507726646105015516 0ustar abaaba/* XPM */ static char *copy[] = { /* width height num_colors chars_per_pixel */ " 20 20 5 1", /* colors */ ". c #000000", "# c #808080", "a c #c0c0c0", "b c #ffff00", "c c #ffffff", /* pixels */ "aaaaaaaaaaaaaaaaaaaa", "aaaaa#aaaaaaaaaaaa#a", "aaaa..aaaaaaaaaaa..a", "aaa.c.aaaaaaaaaa.b.a", "aa.cc.aaaaaaaaa.bc.a", "a.c.c.aaaaaaaa.c.b.a", "a..cc.aaaaaaaa..bc.a", "a.ccc.aaaa.aaa.bcb.a", "a...c.aaaa..aa...c.a", "a.ccc.a......a.bcb.a", "a...c.a......a...c.a", "a.ccc.aaaa..aa.bcb.a", "a..cc.aaaa.aaa..bc.a", "a.c.c.aaaaaaaa.b.b.a", "a.ccc.aaaaaaaa.cbc.a", "a#.cc.aaaaaaaa#.cb.a", "aa#.c.aaaaaaaaa#.c.a", "aaa#..aaaaaaaaaa#..a", "aaaa##aaaaaaaaaaa##a", "aaaaaaaaaaaaaaaaaaaa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/cut.xpm0100640000175100017510000001447407726646105015336 0ustar abaaba/* XPM */ static char *cut[] = { /* width height num_colors chars_per_pixel */ " 20 20 5 1", /* colors */ ". c #000000", "# c #000080", "a c #808080", "b c #c0c0c0", "c c #ffffff", /* pixels */ "bbbbbbbbbbbbbbbbbbbb", "b..bbbbbbbbbbbbbb..b", "b.c.bbbbbbbbbbbb.c.b", "b.cc.bbbbbbbbbb.cc.b", "ba.cc.bbbbbbbb.cc.ab", "bba.cc.bbbbbb.cc.abb", "bbba.cc.bbbb.cc.abbb", "bbbba.cc.bb.cc.abbbb", "bbbbba.cc.#cc.abbbbb", "bbbbbba.cc.c.abbbbbb", "bbbbbbba.###abbbbbbb", "bbbbbbb##cc##bbbbbbb", "bbbbbb########bbbbbb", "bbbba####aa####abbbb", "bbba#bb##bba#bb#abbb", "bba#bbb#bbbb#bbb#abb", "bba#bbc#bbbb#cbb#abb", "bba#cc##bbbb##cc#abb", "bbb####bbbbbb####bbb", "bbbbbbbbbbbbbbbbbbbb" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/deliver.xpm0100640000175100017510000001451707726646105016173 0ustar abaaba/* XPM */ static char *deliver[] = { /* width height num_colors chars_per_pixel */ " 20 20 6 1", /* colors */ ". c #000000", "# c #008000", "a c #c0c0c0", "b c #00ff00", "c c #ffff00", "d c #ffffff", /* pixels */ "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaa............aaaa", "aaa.cdcdcdcdc.cd.aaa", "aa.cdcdcdcdc.cd..aaa", "aa.acacacaca...a.aaa", "aa.cacacacac.cac.aaa", "aa.acacacaca.ac.aaaa", "aa.............aaaaa", "aaaaaaaa..aaaaaaaaaa", "aaaaaaaa..aaaaaaaaaa", "aaaaaaaa..aaaaaaaaaa", "aaaaaaaa..aaaaaaaaaa", "aaaaaaaa..aaaaaaaaaa", "aaaaaaaa..aaaaaaaaaa", "aab#b#b#..b#b#b#b#aa", "aa#b#b#....b#b#b#baa", "a#b#b#b#b#b#b#b#baaa", "aaaaaaaaaaaaaaaaaaaa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END @@@@@@@@@@@@@@@@@@@@@fbb-7.04j/src/X11/res/bitmaps/discon_u.xpm0100640000175100017510000001444307726646105016342 0ustar abaaba/* XPM */ static char *discon_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "....................", ".##.........#.......", "..####.....##a......", "..###a##..##aa......", ".#.a##.#a##aa.......", ".#a..#####aa........", ".#a...###aa.........", "..a...###a..........", ".....#####..........", "....##a#a##.........", "...##aa#a.######....", "..##aa.#a..########.", "..#aa...#..#####aaaa", "...a.....#######a...", "..........a#####a...", "...........########.", "............####aaaa", ".............aaaa...", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/disconn.xpm0100640000175100017510000001446107726646105016174 0ustar abaaba/* XPM */ static char *disconn[] = { /* width height num_colors chars_per_pixel */ " 20 20 4 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ff0000", "b c #0000ff", /* pixels */ "####################", "####################", "#aa#########a#######", "##aa..#####aa#######", "##.aa#..##aa########", "#.##aa#.#aa#########", "#.###aa.aa##########", "#.####aaa###########", "######aaa###########", "#####aa.aa##########", "####aa#.#aa#########", "###aa##.##aabbbb####", "##aa###.###aabbb...#", "##a#####.##bbbbb####", "#########..bbbbb####", "###########bbbbb####", "###########bbbbb...#", "############bbbb####", "####################", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END '''''''''''''''''''W'''''WWWW'''WWWW''''WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWfbb-7.04j/src/X11/res/bitmaps/edit_u.xpm0100640000175100017510000001444107726646105016006 0ustar abaaba/* XPM */ static char *edit_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "##############......", "##a#a#a#a#a#a#a.....", "#a#########.###.....", "##.#a#a#a#a#.#a#....", "#a#############.#...", "##.#a#a#a#a#a#a#.#..", "#a#.#.#.#.#.########", "##.#.#.#.#.#.#a#a#a#", "#a#.#.#.#.#.#.#.#.##", "##.###############.#", "#a#.#a#a#a#a#a#a#a##", "##.###############.#", "#a#.#a#a#a#a#a#a#a##", "##.###############.#", "#a#.#a#a#a#a#####a##", "##.###############.#", "#a#.#a#a#a#a#####a##", "##.###############.#", "#a#.#a#a#a#a#a#a#a##", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/editjust.xpm0100640000175100017510000001444307726646105016372 0ustar abaaba/* XPM */ static char *editjust[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #000000", "# c #808000", "a c #c0c0c0", /* pixels */ "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaa..aaaa..aaaaaa", "aaaaa.#.aaaa.#.aaaaa", "aaaa.##.aaaa.##.aaaa", "aaa.###......###.aaa", "aa.##############.aa", "a.################.a", "aa.##############.aa", "aaa.###......###.aaa", "aaaa.##.aaaa.##.aaaa", "aaaaa.#.aaaa.#.aaaaa", "aaaaaa..aaaa..aaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllfbb-7.04j/src/X11/res/bitmaps/editm_u.xpm0100640000175100017510000001444207726646105016164 0ustar abaaba/* XPM */ static char *editm_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "....................", "..################..", "..#a#a#a#a#a#a#a##a.", "..##############.#a.", "..#a#a#a#a#a#a#a##a.", "..########.#.#.#.#a.", "..#a#a#a#a#.#.#.##a.", "..############.#.#a.", "..#a#a#a#a#a#a#.##a.", "..##############.#a.", ".##a#a#a#a#a#a#a###.", ".#####.#####.#.####a", ".######.#a#a#######a", ".#########.########a", ".##################a", ".##################a", ".##################a", ".##################a", "..aaaaaaaaaaaaaaaaaa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/editmsg.xpm0100640000175100017510000001450007726646105016165 0ustar abaaba/* XPM */ static char *editmsg[] = { /* width height num_colors chars_per_pixel */ " 20 20 5 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ffff00", "b c #00ffff", "c c #ffffff", /* pixels */ "####################", "####################", "##................##", "##.cacacacacacaca.##", "##.a...........ac.##", "##.cacacacacacaca.##", "##.a......cacacac.##", "##.cacacacacacaca.##", "##.a.........acac.##", "##.cacacacacacaca.##", "##.a...........ac.##", "#..cacacacacacaca..#", "#.b..ac.....cac..b.#", "#.bbb..cacaca..bbb.#", "#.bbbbb..ac..bbbbb.#", "#.bbbbbbb..bbbbbbb.#", "#.bbbbbbbbbbbbbbbb.#", "#.bbbbbbbbbbbbbbbb.#", "#..................#", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/editor.xpm0100640000175100017510000001451607726646105016026 0ustar abaaba/* XPM */ static char *editor[] = { /* width height num_colors chars_per_pixel */ " 20 20 6 1", /* colors */ ". c #000000", "# c #000080", "a c #c0c0c0", "b c #ffff00", "c c #00ffff", "d c #ffffff", /* pixels */ "..............aaaaaa", ".bdbdbdbdbdbd.daaaaa", ".db.......bdb.bdaaaa", ".bdbdbdbdbdbd.dbdaaa", ".db.........b.bdbdaa", ".bdbdbdbdbdbd.dbdbda", ".dbdbdbdbdbdb.......", ".bdbdbdbdbdbdbdbdbd.", ".dbdbdbdbdbdbdbdbdb.", ".bd..............bd.", ".dbdbdbdbdbdbdbdbdb.", ".bd..............bd.", ".dbdbdbdbdbdbdbdbdb.", ".bd........b.....bd.", ".dbdbdbdbdbd.ccc.db.", ".bd........b.c##.bd.", ".dbdbdbdbdbd.c##.db.", ".bd........b.....bd.", ".dbdbdbdbdbdbdbdbdb.", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/editsysf.xpm0100640000175100017510000001452007726646105016365 0ustar abaaba/* XPM */ static char *editsysf[] = { /* width height num_colors chars_per_pixel */ " 20 20 6 1", /* colors */ ". c #000000", "# c #000080", "a c #c0c0c0", "b c #ffff00", "c c #00ffff", "d c #ffffff", /* pixels */ "..............aaaaaa", ".bdbdbdbdbdbd.daaaaa", ".db.......bdb.bdaaaa", ".bdbdbdbdbdbd.dbdaaa", ".db.........b.bdbdaa", ".bdbdbdbdbdbd.dbdbda", ".dbdbdbdbdbdb.......", ".bdbdbdbdbdbdbdbdbd.", ".dbdbdbdbdbdbdbdbdb.", ".bd..............bd.", ".dbdbdbdbdbdbdbdbdb.", ".bd..............bd.", ".dbdbdbdbdbdbdbdbdb.", ".bd........b.....bd.", ".dbdbdbdbdbd.ccc.db.", ".bd........b.c##.bd.", ".dbdbdbdbdbd.c##.db.", ".bd........b.....bd.", ".dbdbdbdbdbdbdbdbdb.", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/editus_u.xpm0100640000175100017510000001444307726646105016360 0ustar abaaba/* XPM */ static char *editus_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", ".......######.......", ".....##########.....", "....############....", "....#aa#aaaa#aa#a...", "..##.a###..###..##..", "..##a..#aa..#aa.##a.", "...#a...a##..a..#aa.", "...#a....##a....#a..", "....#..#..aa#..#.a..", "....#a..####.a.#a...", ".....##..aaaa##.a...", "......a######.aa....", ".......######a......", ".......######a......", "......########......", "......########a.....", "....############....", "...##############...", "....aaaaaaaaaaaaaa.." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/edituser.xpm0100640000175100017510000001453707726646105016367 0ustar abaaba/* XPM */ static char *edituser[] = { /* width height num_colors chars_per_pixel */ " 20 20 7 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ff0000", "b c #ffff00", "c c #0000ff", "d c #00ffff", "e c #ffffff", /* pixels */ "####################", "#######......#######", "#####..b.b.b...#####", "####..b.b.b.b.b.####", "####.ee.eeee.ee.####", "##..ee.c.ee.c.ee..##", "##..eee.eeee.eee..##", "###.eeeee..eeeee.###", "###.eeeee..eeeee.###", "####.ee.eeee.ee.####", "####.eee....eee.####", "#####..eeeeee..#####", "#######......#######", "#######.aaaa.#######", "#######......#######", "######.dddddd.######", "######.dddddd.######", "####..dddddddd..####", "###..............###", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END WWWW''fbb-7.04j/src/X11/res/bitmaps/editwrap.xpm0100640000175100017510000001444307726646105016356 0ustar abaaba/* XPM */ static char *editwrap[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #000000", "# c #008080", "a c #c0c0c0", /* pixels */ "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa...aaa", "aaaaaaaaaaaaa.###.aa", "aaaaaaaaaaaaa.###.aa", "aaaaaaaaaaaaa.###.aa", "aaaaaaaaaaaaa.###.aa", "aaaaaaaaaaaaa.###.aa", "aaaaaa..aaaaa.###.aa", "aaaaa.#.aaaaa.###.aa", "aaaa.##.aaaaa.###.aa", "aaa.###.......###.aa", "aa.##############.aa", "a.###############.aa", "aa.##############.aa", "aaa.###..........aaa", "aaaa.##.aaaaaaaaaaaa", "aaaaa.#.aaaaaaaaaaaa", "aaaaaa..aaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTfbb-7.04j/src/X11/res/bitmaps/export.xpm0100640000175100017510000001447707726646105016067 0ustar abaaba/* XPM */ static char *export[] = { /* width height num_colors chars_per_pixel */ " 20 20 5 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ff0000", "b c #ffff00", "c c #ffffff", /* pixels */ "####################", "#..................#", "#.b..cbcbcbcbcb..c.#", "#.cbc..bcbcbc..bcb.#", "#.bcbcb..cb..cbcbc.#", "#.cbcbcbc..bcbcbcb.#", "#.bcbcbcbcbcbcbcbc.#", "#..................#", "####################", "#..#################", "#..#################", "#..#################", "#..#.###...........#", "#..#..##.#########.#", "#......#.#aa######.#", "##.....#.#########.#", "####..##.#########.#", "####.###...........#", "####################", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END WWfbb-7.04j/src/X11/res/bitmaps/findnext.xpm0100640000175100017510000001453707726646105016362 0ustar abaaba/* XPM */ static char *findnext[] = { /* width height num_colors chars_per_pixel */ " 20 20 7 1", /* colors */ ". c #000000", "# c #800000", "a c #808080", "b c #c0c0c0", "c c #ff0000", "d c #ffff00", "e c #ffffff", /* pixels */ "bb..bbbbbbbbbbbbbbbb", "b.ee.bbbbbbbbbbbbbbb", ".beee.cbbbbbbbbbbbbb", ".bbeee.cbbbbbbbbbbbb", "b.bbeee.bbbbbbbbbbbb", "bb.bbeee..bbbbbbbbbb", "bbb.bbeeee...bbbbbbb", "bbbb.bbeecccc.bbbbbb", "bbbbb.bb#ccc.eeeeeee", "bbbbb.a###c.dededede", "bbbbbb.##a.eeeeeeeee", "bbbbbb.#a.dedededede", "bbbbbb.#.eeeeeeeeeee", "bbbbbbb.dededededede", "bbbbbbbbeeeeeeeeeeee", "bbbbbbbbdededededede", "bbbbbbbbeeeeeeeeeeee", "bbbbbbbbd..ed..ed..e", "bbbbbbbbe..ee..ee..e", "bbbbbbbbdededededede" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END ,,,,,,,W,WWWWWWWWWfbb-7.04j/src/X11/res/bitmaps/gatew_u.xpm0100640000175100017510000001444207726646105016171 0ustar abaaba/* XPM */ static char *gatew_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "....................", "....................", "....................", "...#............#...", "..###..........###..", "..##a#........#.##a.", ".#.#a##......##a#a#.", ".#a#a#a#....#.#a#a#a", "#.a#a#a.####.a#a#a.#", "#a.#a#a.#aa#a.#a#a.#", "#a.#a#a.#a.#a.#a#a.#", "####################", ".aa#aaaaaaaaaaaa#aaa", "...#a...........#a..", "..###..........###..", "####################", "####################", "####################", ".aaaaaaaaaaaaaaaaaaa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/gateway.xpm0100640000175100017510000001446107726646105016200 0ustar abaaba/* XPM */ static char *gateway[] = { /* width height num_colors chars_per_pixel */ " 20 20 4 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #808080", "b c #0000ff", /* pixels */ "####################", "####################", "####################", "####################", "###.############.###", "##a.a##########a.a##", "##a.#a########a#.a##", "#a#.#aa######aa#.#a#", "#a#.#a#a####a#a#.#a#", "a##.#a##aaaa##a#.##a", "a##.#a##a##a##a#.##a", "a##.#a##a##a##a#.##a", "aaa.aaaaaaaaaaaa.aaa", "###.############.###", "###.############.###", "##...##########...##", "bb...bbbbbbbbbb...bb", "bbbbbbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbbbbbb", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END ''''''''''''''''''''''''''''''''''''''''''''''''''''''fbb-7.04j/src/X11/res/bitmaps/help.xpm0100640000175100017510000001445607726646105015473 0ustar abaaba/* XPM */ static char *help[] = { /* width height num_colors chars_per_pixel */ " 20 20 4 1", /* colors */ ". c #000000", "# c #008080", "a c #c0c0c0", "b c #00ffff", /* pixels */ "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaa......aaaaaaa", "aaaaaa.bbbbbb.aaaaaa", "aaaaa.bbb..##b.aaaaa", "aaaaa.bb.aa.b#.aaaaa", "aaaaaa..aaa.b#.aaaaa", "aaaaaaaaaa.b#.aaaaaa", "aaaaaaaaa.b#.aaaaaaa", "aaaaaaaa.b#.aaaaaaaa", "aaaaaaaa.b#.aaaaaaaa", "aaaaaaaa.b#.aaaaaaaa", "aaaaaaaaa..aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaa..aaaaaaaaa", "aaaaaaaa.b#.aaaaaaaa", "aaaaaaaaa..aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END TTTTTTTTTTfbb-7.04j/src/X11/res/bitmaps/help_u.xpm0100640000175100017510000001444107726646105016011 0ustar abaaba/* XPM */ static char *help_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "....................", ".......######.......", "......#aaaaaa#a.....", ".....#.a.##aa.#a....", ".....#a.#..#a.#a....", "......##...#a.#a....", "..........#a.#.a....", ".........#a.#.a.....", "........#a.#.a......", "........#a.#........", "........#a.#a.......", ".........##aa.......", "..........aaa.......", ".........##a........", "........#aa#a.......", ".........##.a.......", "..........aaa.......", "....................", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/import.xpm0100640000175100017510000001447707726646105016060 0ustar abaaba/* XPM */ static char *import[] = { /* width height num_colors chars_per_pixel */ " 20 20 5 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ff0000", "b c #ffff00", "c c #ffffff", /* pixels */ "####################", "####################", "#...........########", "#.#########.########", "#.#aa######.#...####", "#.#########.#....###", "#.#########.###..###", "#...........###..###", "#############......#", "##############....##", "###############..###", "####################", "#..................#", "#.b..cbcbcbcbcb..c.#", "#.cbc..bcbcbc..bcb.#", "#.bcbcb..cb..cbcbc.#", "#.cbcbcbc..bcbcbcb.#", "#.bcbcbcbcbcbcbcbc.#", "#..................#", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END WWfbb-7.04j/src/X11/res/bitmaps/listcn_u.xpm0100640000175100017510000001444307726646105016357 0ustar abaaba/* XPM */ static char *listcn_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "....####............", "..########..........", "..##aaaa##a.........", ".##aa....##.........", ".##a.....##a........", "..aa.....##a........", "...#####.##a........", "..#.aaaa##aa........", "..#a..####a.........", "..#a.####aa.........", "..#a.##a#a..####....", "..#a.##a#a.########.", "..#a..aa#a.#####aaaa", "..#a.##..#######a...", "..#a.##a..a#####a...", "..#a..aa...########.", ".##a........####aaaa", "..aa.........aaaa...", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/listcnx.xpm0100640000175100017510000001446107726646105016223 0ustar abaaba/* XPM */ static char *listcnx[] = { /* width height num_colors chars_per_pixel */ " 20 20 4 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ff0000", "b c #0000ff", /* pixels */ "####################", "####aaaa############", "##aaaaaaaa##########", "##aa####aa##########", "#aa######aa#########", "#aa######aa#########", "#########aa#########", "###.....#aa#########", "##.#####aa##########", "##.###aaaa##########", "##.##aaa.###########", "##.##aa#.###bbbb####", "##.##aa#.##bbbbb...#", "##.#####.##bbbbb####", "##.##aa##..bbbbb####", "##.##aa####bbbbb####", "##.########bbbbb...#", "#..#########bbbb####", "####################", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END '''''''''WW'''''WW''''''''''WW'''''WW''''WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWfbb-7.04j/src/X11/res/bitmaps/monit_u.xpm0100640000175100017510000001444207726646105016210 0ustar abaaba/* XPM */ static char *monit_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "..........#......#..", ".........#.a....#.a.", "........#.a....#.a..", ".....#.#.a..#.#.a...", ".....##.a...##.a....", ".....###....###.....", "......aaa....aaa....", "....#...#....#...#..", "....#a..#a...#a..#a.", "...#.a.#.a..#.a.#.a.", "...##############a..", "...#aaa#a#aa#aaa#a..", "..#.a.#.a#a#.a.#.a..", "..#a..#a.#a#a..#a...", "...a...a.#a.a...a...", ".........#a.........", ".........#a.........", ".........#a.........", "..........a........." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/monitor.xpm0100640000175100017510000001444207726646105016225 0ustar abaaba/* XPM */ static char *monitor[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #0000ff", /* pixels */ "####################", "##########a######a##", "#########a######a###", "########a######a####", "#####a#a####a#a#####", "#####aa#####aa######", "#####aaa####aaa#####", "####################", "####.###.####.###.##", "####.###.####.###.##", "###.###.####.###.###", "###..............###", "###.###.#.##.###.###", "##.###.##.#.###.####", "##.###.##.#.###.####", "#########.##########", "#########.##########", "#########.##########", "#########.##########", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END ''''''''''''''''''''fbb-7.04j/src/X11/res/bitmaps/new.xpm0100640000175100017510000001445507726646105015333 0ustar abaaba/* XPM */ static char *new[] = { /* width height num_colors chars_per_pixel */ " 20 20 4 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #00ffff", "b c #ffffff", /* pixels */ "####################", "##########.#########", "##.#######.######.##", "###.############.###", "#####.......########", "#####.ababa..#######", "#####.babab.a.######", "#####.ababa....#####", "#####.babababa.#####", "#..##.abababab.#####", "#####.babababa.##..#", "#####.abababab.#####", "#####.babababa.#####", "#####.abababab.#####", "#####.babababa.#####", "#####..........#####", "###.############.###", "##.######.#######.##", "#########.##########", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/next.xpm0100640000175100017510000001426707726646105015521 0ustar abaaba/* XPM */ static char *next[] = { /* width height num_colors chars_per_pixel */ " 19 17 2 1", /* colors */ ". c #000000", "# c #c0c0c0", /* pixels */ "###################", "###################", "###################", "###################", "###########..######", "###########...#####", "###............####", "###.............###", "###..............##", "###.............###", "###............####", "###########...#####", "###########..######", "###################", "###################", "###################", "###################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 19 NAXIS2 = 17 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/onechan.xpm0100640000175100017510000001446107726646105016152 0ustar abaaba/* XPM */ static char *onechan[] = { /* width height num_colors chars_per_pixel */ " 20 20 4 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ffff00", "b c #ffffff", /* pixels */ "####################", "####...............#", "####.ababababababa.#", "####.b.b.b.b.b.b.b.#", "####.ababababababa.#", "####.b.b.b.b.babab.#", "####.ababababababa.#", "####.b.b.b.bababab.#", "####.ababababababa.#", "####.b.b.b.b.b.bab.#", "####.ababababababa.#", "####...............#", "##########.#.#######", "##########...#######", "##########...#######", "##########.#.#######", "#########.#.#.######", "######...........###", "####################", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/onechn_u.xpm0100640000175100017510000001444307726646105016335 0ustar abaaba/* XPM */ static char *onechn_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "....###############.", "....##a#a#a#a#a#a##a", "....#a#.#.#.#.#.#.#a", "....##.#.#.#.#.#.##a", "....#a#.#.#.#.#.#.#a", "....##.#.#.#.#.#.##a", "....#a#.#.#.#.#.#.#a", "....##.#.#.#.#.#.##a", "....#a#.#.#.#.#.#.#a", "....##.#.#.#.#.#.##a", "....###############a", ".....aaaaa#a#aaaaaaa", "..........###a......", "..........###a......", "..........#a#a......", ".........#.#.#......", "......###########...", ".......aaaaaaaaaaa..", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/open.xpm0100640000175100017510000001453307726646105015500 0ustar abaaba/* XPM */ static char *open[] = { /* width height num_colors chars_per_pixel */ " 20 20 7 1", /* colors */ ". c #000000", "# c #000080", "a c #808080", "b c #c0c0c0", "c c #ff0000", "d c #00ffff", "e c #ffffff", /* pixels */ "bbbbbbbbbbbbbbbbbbbb", "bbbbbbbbbbb......bbb", "bbbbbbbbbbb.dede..bb", "bbbbbbb.bbb.e##d...b", "bbbbbbb..bb.dedede.b", "bbbba.....b.e####d.b", "bbba......b.dedede.b", "bbb..ab..bb.e####d.b", "bbb..bb.bbb.dedede.b", "bbb..bbbbbb........b", "bbb..bbbbbbbbbbbbbbb", "bbb..bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbbbbbb", "b...........bbbbbbbb", "b.eeeeeeeeb.bbbbbbbb", "b.eccbbbbba.bbbbbbbb", "b.ebbbbbbba.bbbbbbbb", "b.baaaaaaaa.bbbbbbbb", "b...........bbbbbbbb", "bbbbbbbbbbbbbbbbbbbb" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END WWfbb-7.04j/src/X11/res/bitmaps/paste.xpm0100640000175100017510000001453407726646105015654 0ustar abaaba/* XPM */ static char *paste[] = { /* width height num_colors chars_per_pixel */ " 20 20 7 1", /* colors */ ". c #000000", "# c #000080", "a c #808080", "b c #c0c0c0", "c c #0000ff", "d c #00ffff", "e c #ffffff", /* pixels */ "bbbbbbbbbbbbbbbbbbbb", "bbbbbc#c.bbbbbbbbbbb", "bbbbc#c#c.bbbbbbbbbb", "bb..#c#c#...bbbbbbbb", "b.ee......ee.bbbbbbb", "b.ebbbbbbbbb.abbbbbb", "b.ebbbbbbbbb.abbbbbb", "b.ebb.bbbbbb.abbbbbb", "b.eb...bbbbb.abbbbbb", "b.ebb...b.bb.abbbbbb", "b.ebbb....b......bbb", "b.ebbbb...b.dede..bb", "b.ebbb....b.e##d...b", "b.ebbbbbbbb.dedede.b", "b.ebbbbbbbb.e####d.b", "b.ebbbbbbbb.dedede.b", "bb..........e####d.b", "bbbaaaaaaaa.dedede.b", "bbbbbbbbbbb........b", "bbbbbbbbbbbbbbbbbbbb" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END '''''''fbb-7.04j/src/X11/res/bitmaps/pend_u.xpm0100640000175100017510000001444107726646105016007 0ustar abaaba/* XPM */ static char *pend_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", ".##################.", ".####a#a#a#a#a###a#a", ".#a#a###.#.#.###a##a", ".##.#.###.###.#a#.#a", ".#a#.#.#a###a#.#.##a", ".##.#.#.#.#a#.#.#.#a", ".#a#.#.#.#.#.#.#.##a", ".##################a", ".#a#a#a#a#a#a#a#a##a", ".##################a", ".#a#a#a#a#a#a#a#a##a", ".##################a", ".#a#a#a#a#a#a#a#a##a", ".##################a", ".#a#a#a#a#a#a#a#a##a", ".##################a", ".#a#a#a#a#a#a#a#a##a", ".##################a", "..aaaaaaaaaaaaaaaaaa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/pending.xpm0100640000175100017510000001446107726646105016163 0ustar abaaba/* XPM */ static char *pending[] = { /* width height num_colors chars_per_pixel */ " 20 20 4 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ffff00", "b c #ffffff", /* pixels */ "####################", "#..................#", "#.a..bababababa..b.#", "#.bab..ababab..aba.#", "#.ababa..ba..babab.#", "#.bababab..abababa.#", "#.abababababababab.#", "#.babababababababa.#", "#..................#", "#.babababababababa.#", "#..................#", "#.babababababababa.#", "#..................#", "#.babababababababa.#", "#..................#", "#.babababababababa.#", "#..................#", "#.babababababababa.#", "#..................#", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/previous.xpm0100640000175100017510000001427307726646105016414 0ustar abaaba/* XPM */ static char *previous[] = { /* width height num_colors chars_per_pixel */ " 19 17 2 1", /* colors */ ". c #000000", "# c #c0c0c0", /* pixels */ "###################", "###################", "###################", "###################", "######..###########", "#####...###########", "####............###", "###.............###", "##..............###", "###.............###", "####............###", "#####...###########", "######..###########", "###################", "###################", "###################", "###################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 19 NAXIS2 = 17 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/print.xpm0100640000175100017510000001451507726646105015673 0ustar abaaba/* XPM */ static char *print[] = { /* width height num_colors chars_per_pixel */ " 20 20 6 1", /* colors */ ". c #000000", "# c #000080", "a c #808080", "b c #c0c0c0", "c c #ff0000", "d c #ffffff", /* pixels */ "bbbbbbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbbbbbb", "bbbbbbb..........bbb", "bbbbbbb.dddddddd.bbb", "bbbbbb.dd#d#d#d.bbbb", "bbbbbb.d#d#d#dd.bbbb", "bbbbb.dddddddd.bbbbb", "ba................ab", "b.bbbbbbbbbbbbb.aa.b", "b.bcccbbbbbbbbb.aa.b", "b.bbbbbbbbbbbbb.aa.b", "b.bbbbbbbbbbbbb.aa.b", "ba................bb", "bb.aaaaaaaaaaa.aa.bb", "bb.bbbbbbbbbbb.aa.bb", "bba..............abb", "bbbbbbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbbbbbb" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END WWWfbb-7.04j/src/X11/res/bitmaps/print_u.xpm0100640000175100017510000001444207726646105016216 0ustar abaaba/* XPM */ static char *print_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "....................", "....................", ".......##########...", ".......#aaaaaaaa#a..", "......#.a#.#.#.#.a..", "......#a#.#.#.a#a...", ".....#.a.a.a.a#.a...", ".##################.", ".#aaaaaaaaaaaaa####a", ".#a###.........####a", ".#a.aaa........####a", ".#a............####a", ".#################aa", "..################a.", "..#aaaaaaaaaaa####a.", "..################a.", "...aaaaaaaaaaaaaaaa.", "....................", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/replace.xpm0100640000175100017510000001453607726646105016155 0ustar abaaba/* XPM */ static char *replace[] = { /* width height num_colors chars_per_pixel */ " 20 20 7 1", /* colors */ ". c #000000", "# c #800000", "a c #c0c0c0", "b c #808080", "c c #ff0000", "d c #ffff00", "e c #ffffff", /* pixels */ "aa..aaaaaaaaaaaaaaaa", "a.ee.aaaaaaaaaaaaaaa", ".aeee.caaaaaaaaaaaaa", ".aaeee.caaaaaaaaaaaa", "a.aaeee.aaaaaaaaaaaa", "aa.aaeee..aaaaaaaaaa", "aaa.aaeeee...aaaaaaa", "aaaa.aaeecccc.aaaaaa", "aaaaa.aa#ccc.eeeeeee", "aaaaa.b###c.dededede", "aaaaaa.##b.eeeeeeeee", "aaaaaaa#b.dedededede", "aaaaaaa#.eeeeeeeeeee", "aa...aa.de.ede....de", "a.....aaee..ee..e..e", "a..a..a......e....de", "a.....a......e..e..e", "a..a..aade..de..d..e", "a..a..aaee.eee....ee", "aaaaaaaadededededede" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END ,,,,,,,W,WWWWWWWWWfbb-7.04j/src/X11/res/bitmaps/save.xpm0100640000175100017510000001453307726646105015475 0ustar abaaba/* XPM */ static char *save[] = { /* width height num_colors chars_per_pixel */ " 20 20 7 1", /* colors */ ". c #000000", "# c #000080", "a c #808080", "b c #c0c0c0", "c c #ff0000", "d c #00ffff", "e c #ffffff", /* pixels */ "bbbbbbbbbbbbbbbbbbbb", "b......bbbbbbbbbbbbb", "b.dede..bbbbbbbbbbbb", "b.e##d...bbbbbbbbbbb", "b.dedede.b....abbbbb", "b.e####d.b.....abbbb", "b.dedede.bbbba..bbbb", "b.e####d.bbbbb..bbbb", "b.dedede.bbbbb..bbbb", "b........bbb......bb", "bbbbbbbbbbbbb....bbb", "bbbbbbbbbbbbbb..bbbb", "bbbbbbbbbbbbbbbbbbbb", "bbbbbbbb...........b", "bbbbbbbb.eeeeeeeeb.b", "bbbbbbbb.eccbbbbba.b", "bbbbbbbb.ebbbbbbba.b", "bbbbbbbb.baaaaaaaa.b", "bbbbbbbb...........b", "bbbbbbbbbbbbbbbbbbbb" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END WWfbb-7.04j/src/X11/res/bitmaps/stop.xpm0100640000175100017510000001443707726646105015527 0ustar abaaba/* XPM */ static char *stop[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #ff0000", "a c #ffffff", /* pixels */ ".........##.........", ".......######.......", ".....##########.....", "...##############...", ".##################.", "####################", "####################", "##aaa#aaa##aa##aaa##", "#a#####a##a##a#a##a#", "##aa###a##a##a#a##a#", "####a##a##a##a#aaa##", "####a##a##a##a#a####", "#aaa###a###aa##a####", "####################", "####################", ".##################.", "...##############...", ".....##########.....", ".......######.......", ".........##........." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWfbb-7.04j/src/X11/res/bitmaps/stop_u.xpm0100640000175100017510000001451707726646105016052 0ustar abaaba/* XPM */ static char *stop[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ ".........##a........", ".......#a...#a......", ".....#a.......#a....", "...#a...........#a..", ".#a...............#a", "#..................#", "#..................#", "#.###a###a.##a.###a#", "##aaaa.#a.#aa#a#aa##", "#.##a..#a.#a.#a#a.##", "#...#a.#a.#a.#a#####", "#...#a.#a.#a.#a#aaa#", "####a..#a..##a.#a..#", "#aaa...a....a..a...#", "#a.................#", ".#a...............#a", "...#a...........#a..", ".....#a.......#a....", ".......#a...#a......", ".........##a........" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW fbb-7.04j/src/X11/res/bitmaps/talkto.xpm0100640000175100017510000001446007726646105016034 0ustar abaaba/* XPM */ static char *talkto[] = { /* width height num_colors chars_per_pixel */ " 20 20 4 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ffff00", "b c #ffffff", /* pixels */ "####################", "######........######", "###...babababa...###", "##.bababababababa.##", "#.ba.ababab.b.baba.#", "#.ab..ab..a.a.a.ab.#", "#.ba.bb.b.b.b..aba.#", "#.ab..ab..a.a.b.ab.#", "##.ababababababab.##", "###...ababababa..###", "######...abab..#####", "#########.ab.#######", "#########.b.########", "########...#########", "#######..###########", "######..############", "####..##############", "###.################", "####################", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/talkto_u.xpm0100640000175100017510000001444307726646105016361 0ustar abaaba/* XPM */ static char *talkto_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "......########......", "...###.#a#a#a####...", "..#.#a#.#.#.#.#a##..", ".#.###.#.#.#.#.#.##.", ".##.###.#########.#a", ".#a##aa#.#a#a###a##a", ".##.###.######a##.#a", "..##.#a#.#a#a#a#a#.a", "...####.#.#.#.###.a.", "....aa####.#.##aaa..", ".......aa##.#.aa....", ".........#a#.a......", "........###.a.......", ".......##aaa........", "......##aa..........", "....##.aa...........", "...#.aa.............", "....a...............", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/undo.xpm0100640000175100017510000001443707726646105015507 0ustar abaaba/* XPM */ static char *undo[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #00ff00", /* pixels */ "####################", "####################", "######.#############", "#####..#############", "####.a.......#######", "###.aaaaaaaaa..#####", "##.aaaaaaaaaaaa.####", "###.aaaaaaaaaaaa####", "####.a.......aaa.###", "#####..######..a.###", "######.########..###", "#############..a.###", "########.....aaa.###", "########.aaaaaaa####", "########.aaaaaa.####", "########.aaaa..#####", "########.....#######", "####################", "####################", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/usercnx.xpm0100640000175100017510000001453607726646105016231 0ustar abaaba/* XPM */ static char *usercnx[] = { /* width height num_colors chars_per_pixel */ " 20 20 7 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ff0000", "b c #ffff00", "c c #0000ff", "d c #00ffff", "e c #ffffff", /* pixels */ "####################", "############aaaa####", "##########aaaaaaaa##", "##########aa####aa##", "#########aa######aa#", "#########aa######aa#", "####.....########aa#", "##...bb.bb.######aa#", "##.e.eee.e.#####aa##", "#.eec.e.cee.##aaaa##", "#.eeee.eeee.#aaa####", "#.eeee.eeee.#aa#####", "##.ee...ee.##aa#####", "###.eeeee.##########", "####.....####aa#####", "####.....####aa#####", "####ddddd###########", "####ddddd###########", "##.........#########", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END WWWWWWWWWWW''WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWfbb-7.04j/src/X11/res/bitmaps/usrcnx_u.xpm0100640000175100017510000001444307726646105016405 0ustar abaaba/* XPM */ static char *usrcnx_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "....####............", "..########..........", "..##aaaa##a.........", ".##aa....##.........", ".##a.....##a........", "..aa.....##a........", "...#####.##a........", "..#.aaaa##aa........", "..#a..####a.........", "..#a.####aa.........", "..#a.##a#a..####....", "..#a.##a#a.########.", "..#a..aa#a.#####aaaa", "..#a.##..#######a...", "..#a.##a..a#####a...", "..#a..aa...########.", ".##a........####aaaa", "..aa.........aaaa...", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/find.xpm0100640000175100017510000001453307726646105015457 0ustar abaaba/* XPM */ static char *find[] = { /* width height num_colors chars_per_pixel */ " 20 20 7 1", /* colors */ ". c #000000", "# c #800000", "a c #c0c0c0", "b c #808080", "c c #ff0000", "d c #ffff00", "e c #ffffff", /* pixels */ "aa..aaaaaaaaaaaaaaaa", "a.ee.aaaaaaaaaaaaaaa", ".aeee.caaaaaaaaaaaaa", ".aaeee.caaaaaaaaaaaa", "a.aaeee.aaaaaaaaaaaa", "aa.aaeee..aaaaaaaaaa", "aaa.aaeeee...aaaaaaa", "aaaa.aaeecccc.aaaaaa", "aaaaa.aa#ccc.eeeeeee", "aaaaa.b###c.dededede", "aaaaaa.##b.eeeeeeeee", "aaaaaa.#b.dedededede", "aaaaaa.#.eeeeeeeeeee", "aaaaaaa.dededededede", "aaaaaaaaeeeeeeeeeeee", "aaaaaaaadededededede", "aaaaaaaaeeeeeeeeeeee", "aaaaaaaadededededede", "aaaaaaaaeeeeeeeeeeee", "aaaaaaaadededededede" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END ,,,,,,,W,WWWWWWWWWfbb-7.04j/src/X11/res/bitmaps/usrinf_u.xpm0100640000175100017510000001444307726646105016371 0ustar abaaba/* XPM */ static char *usrinf_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "............####....", "..........########..", "..........##aaaa##a.", ".........##aa....##.", ".........##a.....##a", "....#####.aa.....##a", "..#########......##a", "..#a#aaa#a#a....##aa", ".#.a##.##a.#..####a.", ".#a..a#.aa.#a###aaa.", ".#a...#a...#a##aa...", "..#..###..#.a##a....", "...#..aaa#.a..aa....", "....#####.a..##.....", "....#####a...##a....", "....#####a....aa....", "....#####a..........", "..#########.........", "...aaaaaaaaa........" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/userinf.xpm0100640000175100017510000001453607726646105016215 0ustar abaaba/* XPM */ static char *usercnx[] = { /* width height num_colors chars_per_pixel */ " 20 20 7 1", /* colors */ ". c #000000", "# c #c0c0c0", "a c #ff0000", "b c #ffff00", "c c #0000ff", "d c #00ffff", "e c #ffffff", /* pixels */ "####################", "############aaaa####", "##########aaaaaaaa##", "##########aa####aa##", "#########aa######aa#", "#########aa######aa#", "####.....########aa#", "##...bb.bb.######aa#", "##.e.eee.e.#####aa##", "#.eec.e.cee.##aaaa##", "#.eeee.eeee.#aaa####", "#.eeee.eeee.#aa#####", "##.ee...ee.##aa#####", "###.eeeee.##########", "####.....####aa#####", "####.....####aa#####", "####ddddd###########", "####ddddd###########", "##.........#########", "####################" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END WWWWWWWWWWW''WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWfbb-7.04j/src/X11/res/bitmaps/copy_u.xpm0100640000175100017510000001444107726646105016033 0ustar abaaba/* XPM */ static char *copy_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", ".....#............#.", "....##a..........##a", "...#.#a.........###a", "..#.a#a........##a#a", ".#.#.#a.......#.###a", ".##.a#a.......###a#a", ".#aa.#a...#...##a##a", ".###.#a...##..###.#a", ".#aaa#a######.##a##a", ".###.#a######a###.#a", ".#aaa#a.aa##aa##a##a", ".##..#a...#aa.###.#a", ".#a#.#a....a..#####a", ".#a.a#a.......#a#a#a", ".##..#a.......##.##a", "..##.#a........##.#a", "...###a.........###a", "....##a..........##a", ".....aa...........aa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/cut_u.xpm0100640000175100017510000001444007726646105015653 0ustar abaaba/* XPM */ static char *cut_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", ".##..............##.", ".#a#............#.#a", ".#a.#..........#.a#a", ".##..#........#.a##a", "..##..#......#.a##aa", "...##..#....#.a##aa.", "....##..#..#.a##aa..", ".....##..##.a##aa...", "......##..#a##aa....", ".......######aa.....", ".......##aa##a......", "......########......", "....############....", "...##aa##aa##aa##...", "..##aa.#aa..#a..##..", "..##a..#a...#a..##a.", "..##a.##a...##..##a.", "...####aa....####aa.", "....aaaa......aaaa.." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/find_u.xpm0100640000175100017510000001444107726646105016001 0ustar abaaba/* XPM */ static char *find_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "..##................", ".#.a#...............", "#.a..##.............", "#a....##............", ".#.....#a...........", "..#.....##..........", "...#.....a###.......", "....#....#####......", ".....#..#####aa.....", ".....########a#.#.#.", "......#####aaa.a.a.a", "......#####a#.#.#.#.", "......###aaa.a.a.a.a", ".......##a#.#.#.#.#.", "........aa.a.a.a.a.a", "........#.#.#.#.#.#.", ".........a.a.a.a.a.a", "........#.#.#.#.#.#.", ".........a.a.a.a.a.a", "........#.#.#.#.#.#." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/just_u.xpm0100640000175100017510000001444107726646105016046 0ustar abaaba/* XPM */ static char *just_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "....................", "....................", "....................", "......##....##......", ".....###a...###.....", "....####a...####....", "...##############...", "..################..", ".##################.", "..################aa", "...##############aa.", "....####aaaa####aa..", ".....###a...###aa...", "......##a...##aa....", ".......aa....aa.....", "....................", "....................", "....................", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/next_u.xpm0100640000175100017510000001444107726646105016037 0ustar abaaba/* XPM */ static char *next_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "..##................", ".#.a#...............", "#.a..##.............", "#a....##............", ".#.....#a...........", "..#.....##..........", "...#.....a###.......", "....#....#####......", ".....#..#####aa.....", ".....########a#.#.#.", "......#####aaa.a.a.a", "......#####a#.#.#.#.", "......###aaa.a.a.a.a", ".......##a#.#.#.#.#.", "........aa.a.a.a.a.a", "........#.#.#.#.#.#.", ".........a.a.a.a.a.a", "........###.###.###.", ".........##a.##a.##a", "........#.#a#.#a#.#a" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/open_u.xpm0100640000175100017510000001444107726646105016022 0ustar abaaba/* XPM */ static char *open_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "...........######...", "...........##a#a##..", ".......#...#a######.", ".......##..##.#a#a#a", "....######.#a######a", "...#######a##.#a#a#a", "...###a##aa#a######a", "...##aa#aa.##.#a#a#a", "...##a..a..########a", "...##a......aaaaaaaa", "...##a..............", "....aa..............", ".###########........", ".#aaaaaaaaa#a.......", ".#a##.....##a.......", ".#a.aa....##a.......", ".#a#########a.......", ".###########a.......", "..aaaaaaaaaaa......." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/paste_u.xpm0100640000175100017510000001444207726646105016176 0ustar abaaba/* XPM */ static char *paste_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", ".....####...........", "....######..........", "..##########........", ".#.a######aa#.......", ".#a..aaaaaa.##......", ".#a.........##a.....", ".#a..#......##a.....", ".#a.###.....##a.....", ".#a..###.#..##a.....", ".#a...####a######...", ".#a....###a##a#a##..", ".#a...####a#a######.", ".#a....aaaa##.#a#a#a", ".#a........#a######a", ".#a........##.#a#a#a", "..##########a######a", "...##########.#a#a#a", "....aaaaaaa########a", "............aaaaaaaa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/replac_u.xpm0100640000175100017510000001444307726646105016331 0ustar abaaba/* XPM */ static char *replac_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "..##................", ".#.a#...............", "#.a..##.............", "#a....##............", ".#.....#a...........", "..#.....##..........", "...#.....a###.......", "....#....#####......", ".....#..#####aa.....", ".....########a#.#.#.", "......#####aaa.a.a.a", ".......####a#.#.#.#.", ".......##aaa.a.a.a.a", "..###..##a#.#.#####.", ".#####..aa##.a##a##a", ".##a##a######.#####a", ".#####a######a##a##a", ".##a##a.#a###a#####a", ".##a##a..a#aaa####aa", "..aa.aa.#.#a#.#a#a#." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/save_u.xpm0100640000175100017510000001444107726646105016017 0ustar abaaba/* XPM */ static char *save_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", ".######.............", ".##a#a##............", ".#a######...........", ".##.#a#a#a#####.....", ".#a######a######....", ".##.#a#a#a.aa###a...", ".#a######a....##a...", ".##.#a#a#a....##a...", ".########a..######..", "..aaaaaaaa...####aa.", "..............##aa..", "...............aa...", "........###########.", "........#aaaaaaaaa#a", "........#a##.....##a", "........#a.aa....##a", "........#a#########a", "........###########a", ".........aaaaaaaaaaa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/undo_u.xpm0100640000175100017510000001444107726646105016026 0ustar abaaba/* XPM */ static char *undo_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "....................", "......#.............", ".....##a............", "....#########.......", "...############.....", "..##############....", "...#############a...", "....#############...", ".....##aaaaaa####a..", "......#a......a##a..", ".......a.....####a..", "........#########a..", "........########aa..", "........########a...", "........#######aa...", "........#####aaa....", ".........aaaaa......", "....................", "...................." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/wrap_u.xpm0100640000175100017510000001444107726646105016032 0ustar abaaba/* XPM */ static char *wrap_u[] = { /* width height num_colors chars_per_pixel */ " 20 20 3 1", /* colors */ ". c #c0c0c0", "# c #808080", "a c #ffffff", /* pixels */ "....................", "....................", "..............###...", ".............#####..", ".............#####a.", ".............#####a.", ".............#####a.", ".............#####a.", "......##.....#####a.", ".....###a....#####a.", "....####a....#####a.", "...###############a.", "..################a.", ".#################a.", "..################a.", "...##############aa.", "....####aaaaaaaaaa..", ".....###a...........", "......##a...........", ".......aa..........." }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 20 NAXIS2 = 20 HISTORY Written by XV 3.10 END fbb-7.04j/src/X11/res/bitmaps/xm_error0100640000175100017510000000166407726646105015572 0ustar abaaba/* * @OSF_COPYRIGHT@ * COPYRIGHT NOTICE * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc. * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for * the full copyright text. */ /* * HISTORY * $Log: xm_error,v $ * Revision 1.2.4.2 1993/07/22 17:51:50 yak * Expended copyright marker * [1993/07/22 17:46:56 yak] * * Revision 1.2.2.2 1993/02/19 22:50:06 yak * Added Copyrights * [1993/02/19 22:36:39 yak] * * $EndLog$ */ #define xm_error_width 20 #define xm_error_height 20 static char xm_error_bits[] = { 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0xf0, 0x3a, 0x00, 0x58, 0x55, 0x00, 0x2c, 0xa0, 0x00, 0x56, 0x40, 0x01, 0xaa, 0x80, 0x02, 0x46, 0x81, 0x01, 0x8a, 0x82, 0x02, 0x06, 0x85, 0x01, 0x0a, 0x8a, 0x02, 0x06, 0x94, 0x01, 0x0a, 0xe8, 0x02, 0x14, 0x50, 0x01, 0x28, 0xb0, 0x00, 0xd0, 0x5f, 0x00, 0xa0, 0x2a, 0x00, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; fbb-7.04j/src/X11/res/bitmaps/xm_information0100640000175100017510000000160107726646105016755 0ustar abaaba/* * @OSF_COPYRIGHT@ * COPYRIGHT NOTICE * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc. * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for * the full copyright text. */ /* * HISTORY * $Log: xm_information,v $ * Revision 1.2.4.2 1993/07/22 17:52:18 yak * Expended copyright marker * [1993/07/22 17:47:22 yak] * * Revision 1.2.2.2 1993/02/19 22:50:41 yak * Added Copyrights * [1993/02/19 22:37:07 yak] * * $EndLog$ */ #define xm_information_width 11 #define xm_information_height 24 static char xm_information_bits[] = { 0x00, 0x00, 0x78, 0x00, 0x54, 0x00, 0x2c, 0x00, 0x54, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x2a, 0x00, 0x5c, 0x00, 0x28, 0x00, 0x58, 0x00, 0x28, 0x00, 0x58, 0x00, 0x28, 0x00, 0x58, 0x00, 0x28, 0x00, 0x58, 0x00, 0xae, 0x01, 0x56, 0x01, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00}; fbb-7.04j/src/X11/res/bitmaps/xm_question0100640000175100017510000000174707726646105016312 0ustar abaaba/* * @OSF_COPYRIGHT@ * COPYRIGHT NOTICE * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc. * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for * the full copyright text. */ /* * HISTORY * $Log: xm_question,v $ * Revision 1.2.4.2 1993/07/22 17:52:44 yak * Expended copyright marker * [1993/07/22 17:47:50 yak] * * Revision 1.2.2.2 1993/02/19 22:51:20 yak * Added Copyrights * [1993/02/19 22:37:34 yak] * * $EndLog$ */ #define xm_question_width 22 #define xm_question_height 22 static char xm_question_bits[] = { 0xf0, 0x3f, 0x00, 0x58, 0x55, 0x00, 0xac, 0xaa, 0x00, 0xd6, 0x5f, 0x01, 0xea, 0xbf, 0x02, 0xf6, 0x7f, 0x01, 0xea, 0xba, 0x02, 0xf6, 0x7d, 0x05, 0xea, 0xba, 0x0a, 0x56, 0x7d, 0x15, 0xaa, 0xbe, 0x1e, 0x56, 0x5f, 0x01, 0xac, 0xaf, 0x02, 0x58, 0x57, 0x01, 0xb0, 0xaf, 0x00, 0x60, 0x55, 0x01, 0xa0, 0xaa, 0x00, 0x60, 0x17, 0x00, 0xa0, 0x2f, 0x00, 0x60, 0x17, 0x00, 0xb0, 0x2a, 0x00, 0x50, 0x55, 0x00}; fbb-7.04j/src/X11/res/bitmaps/xm_warning0100640000175100017510000000153007726646105016076 0ustar abaaba/* * @OSF_COPYRIGHT@ * COPYRIGHT NOTICE * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc. * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for * the full copyright text. */ /* * HISTORY * $Log: xm_warning,v $ * Revision 1.2.4.2 1993/07/22 17:52:49 yak * Expended copyright marker * [1993/07/22 17:47:55 yak] * * Revision 1.2.2.2 1993/02/19 22:51:29 yak * Added Copyrights * [1993/02/19 22:37:39 yak] * * $EndLog$ */ #define xm_warning_width 9 #define xm_warning_height 22 static char xm_warning_bits[] = { 0x00, 0x00, 0x18, 0x00, 0x2c, 0x00, 0x56, 0x00, 0x2a, 0x00, 0x56, 0x00, 0x2a, 0x00, 0x56, 0x00, 0x2c, 0x00, 0x14, 0x00, 0x2c, 0x00, 0x14, 0x00, 0x2c, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x14, 0x00, 0x2c, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00}; fbb-7.04j/src/X11/res/bitmaps/xm_working0100640000175100017510000000176507726646105016123 0ustar abaaba/* * @OSF_COPYRIGHT@ * COPYRIGHT NOTICE * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc. * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for * the full copyright text. */ /* * HISTORY * $Log: xm_working,v $ * Revision 1.2.4.2 1993/07/22 17:52:55 yak * Expended copyright marker * [1993/07/22 17:48:00 yak] * * Revision 1.2.2.2 1993/02/19 22:51:36 yak * Added Copyrights * [1993/02/19 22:37:43 yak] * * $EndLog$ */ #define xm_working_width 21 #define xm_working_height 23 static char xm_working_bits[] = { 0x00, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0xaa, 0xaa, 0x0a, 0x44, 0x55, 0x06, 0xcc, 0x2a, 0x02, 0x44, 0x55, 0x06, 0xcc, 0x2a, 0x02, 0x84, 0x15, 0x06, 0x8c, 0x2a, 0x02, 0x04, 0x15, 0x06, 0x0c, 0x0a, 0x02, 0x04, 0x06, 0x06, 0x0c, 0x0b, 0x02, 0x84, 0x15, 0x06, 0xcc, 0x2a, 0x02, 0x44, 0x55, 0x06, 0xcc, 0x2a, 0x02, 0x44, 0x55, 0x06, 0xcc, 0x2a, 0x02, 0x44, 0x55, 0x06, 0xfe, 0xff, 0x0f, 0x56, 0x55, 0x05, 0x00, 0x00, 0x00}; fbb-7.04j/src/X11/xfbbX0100755000175100017510000002134307726646105012561 0ustar abaaba#!/bin/sh # # Shell file for xfbbX client software # # (C)F6FBB 1986-1998 # # # Directory of xfbbX software XFBBXDIR=`dirname $0` # # Add local PATH PATH=$XFBBXDIR:$PATH # # Temporary resource files XAPPLRESDIR=/tmp/.xfbbX export XFBBDIR PATH XAPPLRESDIR XFBBX=xfbbX_cl # # Prepares the resources # [ ! -d $XAPPLRESDIR ] && mkdir $XAPPLRESDIR [ ! -d $XAPPLRESDIR/bitmaps ] && mkdir $XAPPLRESDIR/bitmaps cat > $XAPPLRESDIR/xfbbX < $XAPPLRESDIR/bitmaps/allchan.xpm < $XAPPLRESDIR/bitmaps/allchn_u.xpm < $XAPPLRESDIR/bitmaps/console.xpm < $XAPPLRESDIR/bitmaps/consol_u.xpm < $XAPPLRESDIR/bitmaps/monitor.xpm < $XAPPLRESDIR/bitmaps/monit_u.xpm < $XAPPLRESDIR/bitmaps/help.xpm < $XAPPLRESDIR/bitmaps/help_u.xpm <-p*)`^d*0 ~?rM ܢ`y6mQ!)py1 # mcz@ב' ӁOp{N` G r2x4%6W|r3^c`VCЛq0=Arc4]02 oS"nr}g"߀9ދ0~H NH/˟a:; 0qoju\> #_\ܤՕhXxflJYԇs _-5^urƷQ _Y՝5yA`A>s;;g<jz@6  ~io&@{p'ˉ k!#yNry\17;@2W&V(roqCß5bv9I{r$ȃd-{ 5pAߟ?Ar9׷ }:&.&}?'@_p;B~B{2䝠ow*@4o@g r$bgA( [y~'4OP_czj{,AY_CyηN`~?|p_5A+]93M5 W<N/ kA~J\~!&\ԇ\d(y.P2 rwU? e>VWWZolR>dd31~.QSAN6u9^Y <!^< /\A r7UyC~ $. |AE?w?O9P_)\q9\?䃐^SX/B~DoW 8H/7o8+<Ã~?~z}٠o0)E\ &8<Jp7?q71~!׷|' 0M<~O+g/6W [ 4tDXo# *KSge&暓r̉l31#ġ <*qLt1*.1nQQRbZfYJL H1嘦M99IMn] DNc2IIf, NճAs9 32$gK9*fe2ܬi&k"9GJj2J)11<;۔8EMNLx\6# L7M22l`V"e!㧳wF325WoVi<4BaɕANIJ&>J3؜5]/9+2 oO2'bcMIiϛRQ6ediLQ8IISMrZF xF䘠 !9+shs63M0bH*I154fHX0(8bn#M&IV.MeG٤62-)#k*F*a4KL0HPS IfVSrR-$&);!-3%k4+%@ Tlg-n#,9 l^6HH:H:ްg@{ "3`߅vC h?"IhO}ڰq96,菣%I'^.In'IgІ y@ hOG{1?ц aXhhد@=hv?KNG{?ڰ\hsxhg@=h0hG;hG{8?M~ mhhwG;hqh-hhB폶hG6~hA Lh#6lц AAv+hA 3hgC?ݡn6+W~mܗ *B7`i(fT&.<0UI ,f/ml7HmTm2 Ϯk٤y~V^ g%T^V:$_Iqq_^L2V2*/"g-YqXddHL.$&I'g[ du2*?8 dJ*?8UT{(,qy8;:Or18[(Gy8{x^^@2ry$l.C9IO'4?3T~SSobIHIjIBrɕ(o ?$WQGr5?$FGy2Ȓ/S憱0nW<`zSY_ x͚o+z +JrFA^RB`cyvaZ\.՜,D,r1P 0XJPW\zhC]K[A!Vs{Bow'=[1₤\V# nP"z0pp~A.R/td hOXrK,_1T $.փ>7XßC C\m{$=v?gi*_C5UdZNhq=Ǡo-=g1:bnU&9* ʕYt~ֻ5榶ʊj{|ޅeujkc;z.sfK6*f7# psåjKS;˽́0gVcJGBHz0`ejP|Bk alo0 6fWL4Ӏy|ymu>8sF/* el Uka,կ/s_ж݂F k,qmV](͵m0M k0Lɒ2A686 0 gUPVXX; B<҆GmcayWbcU>EЛ~}$'cTId >GH.1|<ūZIQcXڙ3CyPۦI~ XDAh WR/pڂcT ϪWkj-ɓ8F.)85B55r6NF^9 Ʀ< ]ˮ_c"[@Q ?0܆=o[D}zLs&m]>œУK/,)ӅZjppDkJ}_uZZԿU 6J;zf>nto]oeJfz[o0"GU[o.6 }- OdӠ|^$^X|,+Ru}mDV0Ka)bA5Κg .U0-(+ҜoP>erשO7 e3L2ѕj?VJcNXCLZaVյle u gV!+IGtノb6^RR~pT =!8 j[-ц=o F6bCIKo_ +:/Xh!)$^Z/%e{*!q? k~M6xP|뜱uGpS_ڰtaR٣%quViw9]9p斷J`MZDrx,AYF}D\PI;xA(;s o3:A1y`)#p"9֟ԍ+^i _J,Qi8,}I/f5S.ڮեk dKlĵ-4TQCwC aU,l,Q42HQٸp?s+?c2 ٖD#va=d;cׯ>$kc|b?i.i}ڕe͟4%7ˡwP ~yr1é{t?it3J*X|pi])&PeMYrFXCXZJ ^܆jic+ͯc\yTr ;ct)5l[\/m=5?(#VnÁs $X岏:IQHPSr%m%(}Itx1:2%NFJPTyTI3PZb~Zn[9큞tpYEU-KE[Ujhb @V c-X g5`:MP6RcvMe<=#AKs{ /I $bj<;a*bVl*]YIة `J9)CkiN֑퀋՘LctA+ )5XtnpE MXBwT?J7sY&9P^KY2ȝR0e ?Е7Q;Sin wc3ܗy Jj9f2>2{d߱YO+׍Ne=VWAjrOu>zeVw̟hz2r*|oKgi@TxB~%.`5 lQհ7ώty=%sl9s[c{ _|AG'7 O`u)6_ѭ 1v..^oiYȩMbfFݠ>eY4vn*[eI wlRK~W}8~CG cBfʊzuZhb 6XcJ4i\QX2"^v;ȗ0we*bP2*07CWxooZz5!Y6BXq oIa˂a&,`ayP A001 ,!|ѨDb AaX:2Q YTXfm 0Ya 0UA0޸ |HWYthV렝m6>RN jhz e'q@"<5mafp tI>~ekBˏ?y9bm릻R-+m-9zafŅd)F8L8;p^O]~5){ð+8zsA\`R5P *ڊ kUua`oh8_0h6']굋Ũ\lZή_u ONW^lT]dN["t-H¢. q1wuh'2n({[o# _]˓31{y^8+p)ܪt(j?cҽJֻ_쪂pg(aoYn>ý_ws^cz0\gGݓJDO|PVP|\k)YBjǸss ܵ_aF/\>q-{PͰTyS6pˇsmCK+zSKkܞC_yZ:[2ip7:9QDRƯ̯OC6 3ogCv@Ic$Ə;Un(-ȟ;gw??qOβ$}<0>TYQ#x?˻:u_yZWX⪫)պvOUWCΫu?=֕S/9Յ2W]|NNeb]=ʧeZwN<Ej7!bk_aTNJ퇅d9fgeO7&ǵ^Ma?g1O} P~{gX;vRaTQrȟ $Ə;o~wu\O>/PKxD~rԲvPObYA-թ'WY5O&5?%y6mEZiK&|-^cv0*豖U|xw& $ CKp[%ćބ:˯B *9 / pt/&t̯8T31~c1>c}Ù/&'g]Wi toe7%MyMՊ) fn( YI1W,'kqJ(J.&P'CxrKO'Z( *2(i'|YDчp}D`G ITi7-RQp HIOWV \#5mw[OTzz0бoTYQ ELƙ8e=<0SَOh?.N7؊7&83bRT\֊7ݤ;1=))OK)|-,_k!? _2;DZZOnડje*s|RT}fܚ'J([9OX$%ozw|&7Z-][[ غ:+Z9UZOs:o,:NE -ȟmտ&w:G 0-j:Qs(x@uN$fFw5l2&fjFڏFs6Z#!XԠ<® &GxPj+VMTFB=G4nB<*ԌRvƞw_P`:TT4\I˘_^+86P$mjXPjf`+{ݙ7ϳ4d;d+ N=ᇩklS%QsۋbP#X,f6:;]&?0=ST_I\u 1] Qto&]u?̞\s! PW+Z 11X $ޟw &ξQ;di; -X=ȲΙt?G B `tF:5x r4u׃bz0!EB~#.X{!"b1&(m wէ3rJi?]Ȓ4kmۿZ~pq=>|7ڇJJ=<9iv2׳fDi't )'h `HPJ6=Gsvz TXeG+s?3%4tkO>擮sD@Xx.ۍ~%=>osybf]A?¯44W~V"G點#>j9}6o}-fozc^6oW خuVyd{+vk=kS%jζf;~;=fcwJIvYۑ['Ue;6ӜDmwUT8ϯ~XsvL: ;Z BӐh/uHyt)5I R<&/M!oEݧ@LqHIRl߬`o@+[sV1;oiɒdG~Vn+G!vYڕ펴qNϨuS:Yr R>ӮqTg2]G%%^ ?v³KJ:ΞJ?)/9O%=FUěl]I~; P2o!Ņ ϸO$xI"x_ڹI RܧxR|nO RBo@^IXjC?xdMub%tTWK2*gg;5%~Ums/4f (h~O/)cCg<;C|c3˟oIy뉟F֍ro=7Ƭ@{VP?T+bNucVrtݘ@^mhk mvb{ܥ1CW5G|b68bVm3>FɁ7h#^eWkFxء5Z+%FaEub 0 xzN !WT?oͻq~ !o&-ʯlcoɪB5Pv)?B~ 7 fuR:[uR)_@ {N}ߕ"D+ z^ikZijfjf]côs$ć55Zi謇=tIMK% ƪ%%!Kbh璆AzX *Q/i+D[xb*|l]I> %eRVؐ~<cr%ڥ%eReښSU>z־!9 .)1~ar/ն^9$XS[ w1 ,, ;S\y?gnVSf}\SSƛ-{JJ28cIotaؾe|BE/dUڳ (R>L {4ҧZ$e睊م٣U ~̨Db/5ޗ*o>Ic-1 $ۃ_4(>A{Ji)l-05:s!kZ;)>Tш?X29 ,M'Bʠ:mTxc Op[(]@e VD9YeU~%;1_?vVZF|CO$+"[X.}oab76P׋* 5(S[?3{aҎ|{zI?UX O=i3][H$A}L'}ɳ#v#<7T$g>o&\e("aIno}1gUu0c3w>.Icٻ}*[RǗ iT{ԥs՟go)?[·7%V$$['7Yl'5 cCmT{e1-$oIJBw>,V|z/x@xwXaV%Ea>cJ$E^Vy#dMEww%-ǯ6ɟ6 O|wC.Ԛ* ^'R7YYGruNS; fX*DI`3*T? ;+0x9 ]zPo63'z%KB_/@E{B*k*pQ7|әAֶ~x_ۍ(o˘, "`؆5k3y||iĒDA& Jm"6>EtHثH-JpBo+&<äɭ}]Bݗ'n<^,XN2㷙Ï'\mE{;ˮ] |mM18|x8ކ/nzB}aE_0Y# l|k|ؕAx&v;_Yoӗ]t7 m\~Mڂi*NDGZ75};ovt yIf3# jr-o+vX^>{O685SsߧbSG㍠B[Xbb]S/8cE݆Nb5-D(q.ϴ1G]fv@n23 S)1H)`/z`Un[x2EGn-UL%uƪXӶiY4i،ϡ^zzPb=Ar+f" mO~z$䰮M>?bTnlbvrj ȚZ<ax>JUmOۇ Eݘ>&Hs4 C.ua{ G%}hoG`ܐ8bG7Fb˲',=t/C_βTVHWCjvQ/% qn"X+ⱅ q3}*Aބ/=T{>Nמ{~Ȟ<-{T $vePm=<&TԀ1As8ٗ&b51Wj1U}GOMeuVP'WQWzUWyBu ۑ*my^#cp~VyJk~ e>/Dw rڪDYFӟ= Ve6( zuʈ{&|g$L ֘[$t)TZaAxⲏ\ B*0 | PjU=FZ ~?}ϡ]ߞ*>s84\m\9)ݐOP %._XakBxTՀ@|) cּ_MU]%۳!TcDw ΫJG4J7@{_S Ыְ[/P_L[cgy֚-gXVs}e@>>! C'zbXSL:\!f &Pl=0y<{wcaIc쟾UFj:2 Wiz͆[y0q#%?w^S_x1Tsͷ5|kH*r];B\+^^lOcP y:+b+dA٨,XO;wOW3㝇yt(g0(𓺥NGPi ?ܳ8Aʦ<_ ܵVv7Vs)0 \0JXkF?*n.LP^M}3^~J[U1sK]{j,^l{{5=fHmh]wMxAa9Zr9kEf=V.Z -UQKM> w%E|dpD$D|1pL؇B[I\[e.GC': u_B]*e@TkTjeT+SW:koA}šݯ)Xx4ŗ8>iFH3oK惭//gh^kBUfj~nVD~܃zX-9[twj8pL ,)(akpNua,i$[hjvР=)E`'&|6y$s4Vri?~TMV^zT0[/%%t9D9X}ܜB^틓…W}A fb5;c/mkp+Y8W5\cCuvﲧ$}-a VnI1V*]ʦRC_`;~B}-Kb'+IZp^Zɤ5c֥ӑl aq_}bӫC}F=]w`Q^!O%T W>Yd^Ǥ O&Lʰ#;^.ran6_|#*}/]iV 1?V)UJ4*ϯp6LXe{E K_>;܋RHWB_n_ xWbdIGi#}* W}=~ ]=>|FEyc-Ft:wqmgvO>!;y2TJu zJۯVx]xF [D~?^ށFA6V92|NqKjŕ]g^Ų@Ωr `[xX ɣ+~>gɮ# ?*OOW66#-(#RAֆ!TexTg:ߒ=ҚZg1ɛ̢Qg4|}z/#۠j ?G͙c#a_wn8B_{6pz f)^d`t%\77𢏿|C Z QƂ녜CQ=d;d3?EH؉/lge9ÿG<0`x$+M,_2lS>%-7;#iv7iVGRBLbdԨĄ#$!vLܘ1RjVt ǒ8%)G2geeA睙5 3vԴ=z>+UoM\Sn.vXL흵{HF9kf~:5B`朤ԴdLޒkɕe()#()2u7!F$eY,9{8˔jcJbvR W3Y_$\#{vNT٬Or%7\PC iأ\'Mɲ!ΩjJϛdH/iHoICodvH4驙X@eH0O&f$M1e|H]8S0>.mI5MG<&*mɦZ(N欩S#M4)+<˜h tB]ԓfNQ3$ LY I Ed"w@o оа0gNg!`RyUIIipUpVi;̩&5[`%3lLLs憤2I=؜#uꚫ4YIp~F^;'g rӓr\fE,99L~]ffLD3]9Y{A\0)1-J ~*>hTZe~ oH2;f;5C-կ~0LA LEpm'CCXͲ23fa`ͦ\>ے WޑYԚП9iS, 3`Q`1ēdWҩpVo>kHOקji\A*:/+*`'1wٖ)0 dC?܌ L(8˟Sɒ>iJ.SfSI3sBO7$Ch9Y캒D=f)ifm$K>v̸!QSL8Afʆeg{r`0ӏgn&TLTS7=4 А}t4g~Q;xzV).kViP.lXä%eA?S%)5_aCGbIM5PsVٹY4IfIj®}gH&XJXkۓ~{krss ܌YX'0_uMͅUoo]'JWR?5oeJk۾z_osmKk ͚loeTlGߙs7_H~k|/-t΃6~dj؇.sO ؕ`qm` v8دb<``<`/<8/k?w}9:-S'3qAT?g봺`^յL0#Ly0K n0s0o@x0]30`Z0s Y0&L0#Ly0K n0s0 <`ft0σY f-m`v9,`.`f `<f)` `.-+`F&`Y f`9 2;`7Bx0]30`Z0s Y0 ƒ ?`&I<`ւf7c`΂ LW03a:mv?7` }'4Ā<X 0α+yZn/iu82!` yz-x?1si+ 0N冀FC~e0ͱGe\5 :mVf'w{ N8OxE+KXN~N}_ʽ/pw=U!x3_~0؜sF^x#\' ͜3K87Iw>jTgyk܁qGĝ"txb:Җ2(1UM1:7Q&ꘪlM1զ:z5UȦI&@<:^^n^x3W_} >I<(;4/8x0q:kSig/%fRęĻO}CtFA?}Ͻ~@|}l?^SAi I?s~ؿM3Dz$f;!-xqq<:#f'[7Sb3u{wgcC rC\SO$''?W{6W&^(!>H>_ ' lm/0Eh DkȖ؇ܛDonKiQuOx }Nh"gg=܍']$MuA¼$ JABأо& S9LL #{OtSy;.'GO<8]ߒTǣL܅88~+(lg?ė8\i%.`'~;DՏx1q! ~"F9%"3CpWrC^2 O~Q/ii۽h&p oaAt6r"ӷ/}#>#Ƥ[_k1oRءϡ0yF:>(p=U&ePq00>Nܗt*LJ# Xsoxgn!6N:dro5Ru rˤTpO]Ŀ)  :Ǩlx3-Vķ.dؓx.1bT_8V)ĭHAgm!H4V ;V(p9q( kT 9q_CT,pq8 l0 l%E:;_ǒ{xaNxӤ~OV ȉ3(A/$NauNJ|Fi19ܟ sFJ#&^O<o:~<;wT9^*J8tAdʃ/2!-;X %WHn':{&>O|ѳ8_ 7bg{\ĝ)lԇ݃3ݥ0WOV9Me7OV?M̤?OB~15Cqi2171x;Ij,=$GsuS&pdNR7/gIe擢a⹥{sS0,;'G<8x>b{S:Eq2KD!}J[/!֥"XވۉӻitbP]Ft':UmK!?~-Щj{ Sn*IIFyZR%r'9^Xžd519JN:w<"ITH#!"8[V'¼D|gi* l"HHp?H|m22T.6ܕ@O-gz';qP&Q}g?ExIĚ,XYj>ǑxyIgF' x& fv|/+=#>⥤>G>/ӂ:[pMU\U@{U@,tm[?$>OPV\ڢUA|P9,T ~woI37&~qqGn{?Cܛx51; fƳU~R,7 xbb>1.CbbXbv\FL%KOL\FEKbM| 1{h1{Fb#1{>zPb=ݦhYlM>#~MMkR1;2׌!չ]/O_$>Gn)lm f{^4vv Σj~QU K*OH`m~>MHe~ɽ 훈$fׅW!~q7v_c1p?G-_ȟ :gI4\#]zd|'״HܝuG!%T-J?-r |A஫EE!lx1{eN5*oQ6<5Ug |_*x1{L lb]aT#fϕ-&Y/Ξy{ʑ?/+o?=<8`>t qE.ۮvz"xI"A0 STb˂i[ ׊'^f{|zG/bv)YwglߑЇ5B #6C>RN}7ywk%UNtgkA;.,̥wk_'"fs$NlFJ3xKSu [RbK }O_naxNxQ݇ F\AO%.D)bn~ȓ* 8%(5C>W9R|L_/!Â{oUMl%F?>̞kvZu_Bܯ^SMW΀T?!w_n0~Z p3XX!W a8Y.~O.x,@' _ÞWy3PK{(ԃ> m[r-oT`Ux+>D|S$nX|S/ [r _W3H|3y.{H_EUg/ Sy.XwIH_ w]PN.Rr}?kg<(93sYwme?Ep,e;\Af:x167!KϤݾt?5u:-T/pU ,aUFચ?;U?jm 6\?/i]5kx¯Ow5U:xAU:Co0}IR U WGa[y!O_пvs{SwtoB(UA?{y=h ۿM*\˫iUAmyf" N@oi@Drpxfal +i}Eܥ~j[x#q^Y_i]׎V|M>׭<'k>Zb,M2>ݟ=RQ' {C!VB՟(r !& ػ#Z}z槥+eKR}abƏq R*p5^ǴQ.s~6j=+lH' 'n0 i׼m<c< ˀ7Hۓ9c>PK!BYNN7 f|fSYw%-C8%2HO91 eLjwo}TK]U,2w uoݧ:(mxG º@ug/ KP }/e) +?M/Wzƕ_X蛨=9c= "M—WG_z`= a8 R%ԃ~U'ׄt]R#Mcj!}'gIHҭ8ӽ%{KH3~Cj=W -;B;VUщb-BΒ+O|^`gT.*QEtj4j=4jzgx~$I#pjɆ 4n HH[FM4c\TR`0Eycƚ~5Fc1o4ea7?[gdj~ yn)乙..nQZF_m4]VG5N34;jff;k>pqͧ.vcC.9]C[!XJT~s1$win-qs2m󎎲xN{oPtP& /j@/TA P )*60q"iRsffG~kw}٧qQM.FQ1%(^D|ÏXĹ mv\ExW}qcsc൲5N\"~B "n)ۈIb1q;_;OĝDcgQ$**?/b_^=x^MfCelFj$q-1ǭ|qAnM'ۖ~Gd}G>۸`}o "x4\T$~Yt"cUQ"xH%'&Y|""xXOB/ck_CBgHboA=5,x󠯳|C|%T4#b.})w"{qGK|\\%I7|J<@o YQxQ7Q"|I{#?D3+Dk?S7D/us]O{n\Sc/ {q?96Xy'6t7|XC:ic5Wݮ^gְ{=_gc'A{=_xs/gwм6uqz]n,Q]n6AF$ ąe+C'qq9L#.-w?l4ߖGRe9 121H\Y6'*!&Gɱ:y8N~{QOhNuegr(2MHf'lrq3Un,%y?'H7q({mr$-[/Br'$R݀R>,pk++'v~CHDzpvhxi*|:5m6"Ѷe nՉv4ΫOwͫrVr|Ӯ(˚GJ>|';=x\sLSriI|ПVAI %G|Q^-?ƣ7Zݮs}2g|>΍/Oߐ,w7\7 ]y'e7`xSF߆V<wP*RTvOXeW5l[^{H[GPֱ1CXTq)^3V7Rakk)lilvp-"|Mvex=38ܞeA7Q|na0^wcͿ|շYmttuU]Χx/o{OTT beyo<a2ا`*S'ϋ\`;g~2I{c.iӠ3*Bτ̂usv;?PQˈ;y|%x伺{-}jv"|g}Zm;8tɵR%./̈́ Z+~gcjIY{&[T7a,d/Sv7wwT+(Q[R~x:J|@">~!>.8E*Hm~T Q=L|By|9Ս7SĿ\bc-g:.ke*}0֎Uo*+΄rB(Jn§9T{LRnű\Ta5vx}O{o8smwTۃ>/iLj=}.Lm{ݵ%}vs|YegWT9}|ӵ51ShCki۰ iiҜK)y ܶǵ]ˊ;͇t"i"Y4͢날osQNA%@_ ˅': :˃~y/@14h6q oh~.Vw${cM:ImGNqJyTxW<+ NjͺY4fFLcK$j6Ӊ5B'?޼H fkڞfo{uQwuOTPPP${4;,lA=hv͎!'f'\g;XL>s<]<]<]<ς LoOo2ķķ/Eo?o@q6[5uv3CAAC݇@ռ6OȜ5\gakam78'kZF|D;w ױl7.'`[r6.tė2fO:4OI< ?iy3 Yu+iyocԒւWxVM$[i*hD]]PcbH pu*iy4hrui^ky 4!-A7A&h[yov\4"0Úa5 k Ú]LiL6ijԠAӀi0H34A34 }<9ٰ+„fa#(|]W*f8wZv)we 13-OG/7fr㨰+; ~/v HAEwQ=69 M5Cۿ"ET6yڤ}xUg(hKuyXS|Vi݀8yx9}Hf*q}cw*j`̖ ˶#2ض\66{uxۆ \ۦs \Npf?r؜GR]C,pjs߫ztZsd87Y=ӆs˝L*3f2y!b9] +&~ps |/Mƣ=@Ol6c51`3oގxyx dL `﨧{7_1fHx9@<|O3_9ߺ9$!W&x{>k&/k'B_s M4cI&o_8-ȶv[ՕUS\s7f{*gjݧ73d.E s}m#i/q< ^ U ^Cb !4?{ y;#x)!.敔l/#ιcĥ=^SeđDyC`?v~4wD{ۋ( "&{$&'xSky k{ۈzyLj{Wx7z:ȍ`A%7{mMdVL'm=HJwO%$}F;N{cu\ȥP.5#1ȥ90HP\" CLB-4HEABo~ߵLN?s㈳Gu":g=I|J/!>w5l]ϗty:%[ 7u_beYyrbm6OUB`ACM)⢦ qqF|%.aZ4Kdf}&G\dW1_'j0kk&ĵLsGL;GM?!(C:ufq}8$n`G3 }yHa$nhǚ{zčM4qyM@I"nn L!O%~,"~ʼGEڸ1)JyPȫ y-LM q@Fwӟ8L!hfw6 MBo'jvh!n.0׈{]ަqS8ф3O y+!oG߼@~^E>euqfH- seZf?ž{CBz88zFN3{;fpN5 ⅆ+^lciX;ߝfovab< -G,m\yX<:#φf@ ͑B+S!4fyBiy9"kyb𖷎w3+wQxG߮&*8C ω7 >&`s-m<^r\]p['{Hmmr>AwGpT-}Pdwmn>hBĭnOE8l7w6#µE.tswe=D|ݞ&0v}\;v3=oo3B5pyn #,(O|B{cxa*O> C|3+z| x4< T&> 3^Ŀi4 8E' wJz|<fqxm$߄Ġv+u8HNGu` q^KU{bw4joMjq!E\L@$ CތCd]ڊͰ̶Oxv7CTٓ!}(q&!ߍ]SKWZrn?)^GOĦ.…W|ƿ幝\mrORxowo[UMnC*s } }>$) yBJ;yGTG}{]z*8'Ա.꒍\O^_!tRBG8Q"^tC(Wxm!zFx~O~+_rz5QWԫz8WSQDž^)Ʀrz5Wǻ*Mz5EqJ.^wsUZU>wz9}$J};X[u,ȷ"X vY0}i[Ev2ݐo";yZ[ڡ+xJ/ߜ9s/|Js:n=T($r)z3P?z0-=.:7Po^vE祭\><Pf) "|m;dozWH?g[ӭnf3<}6.}R\R±JBlo:n r~6ik4>9:Otsc֭-lu[vuo0QO7 Rm=G|ڡ;e]rO1 ,Fon͡vlJ5tuKn4tu+l(0Hw% 17xP y2R"'oym*07׶&{;:FYn uO8/wa&= 3:S|1vH;b5]R#lh3Wv2CLJ\)LJ̭րˉ< m>y6oн#?+KγRжY߶km ۮ]'l1# 8&V[oW!l9z}kY>x7p=883>}_r<-D۴~(gٷfc#q< <"yDQa]=!ՓWOv_nW{`B_vsbWqA/DEx (I\@K\P*Leaq'B9"c_Uݯge*N5.5F\R&[-&.҉| {˩+M!wޞ_Ї{q\1ȿ•\q'Ÿ7M[e?txەԈoWsDUDv5km k*nj+g(\c*bVs"Y:J@]u%Q)qzq#ߪxqNo>*ڋj|FՕ|Fng̣96~}؉IsZegӛ0Mųn-ډ9Ƽ uvRˮmMciV(*?ƻc<9 g1^~DUL/r>W9OM'yp_m+"PՕxhD^Qʝ 8bS?csO,nU&ގ' vbaz‡G -|5)bm5)"g$[sh9>Bq(0WqTxJ@nZ8"`(>J/Uw˅OPubE>UבתCT^>TE72ěTmq-sFlUq4OQڡ2?U_T-OQn\N2 [c<@s{*rao|}uxL᫙W3OW_+r@+S:)|ֳ_P8[L|Iq0gYn}(pOuηs!&YFWUW;_v*|S9('Eu'.4TP(3QꞠB.LۼlЧȉS!@o]}kmoֶym}glkm[,Oou NU55|)fX_:ssuv韷[Nkg6ٌ^Ȯ(+ٖ֭ؕ4keNym್y&#{6ayӂcn'8%qn"xir[|Yhbt;w,9,igB;!ݔ/Tl"6u}}Ow&=pЋ+Z7d\U"B7!瘜prN "Z_}C:01w=B-cْc=8l} ,$}{I'3Nw'4t^B9#>g : 8nseu?w:>(pju$|{/?խ{ԩS˭r| _;?,w| UW|w9_^y#ԛL8?89YO^q9ObsN^k}]i~Ctٲ&oBt233sp]d>nF!.Oz{v;xFFO&v?:8N|~_rFx&kKtx޷MJ5?V缙zM&ͯ\;wtu0Wou$}fa'r [^kna֓ΓY=Bd ѓ-DO=yؖ${Ğ 'HdCo߈|9}9j^O-Figg_zM_?۲Aj)g.2YSԳ;]df7iwߐoH9O8 `d*gd^Gp- x?2ޟ^Ad^h0ũ0?a|85#GC ʰ8=x;=߇y o"<9}d.Zu/N. {~LP?kt~%)k]eqb0+]2\k}!?R-32&kAvۢ(Yh&v st;U K̰~xәYfJe&ql}8^}X?te{#+[G=`xg;{E|D'&g˾ƞ3WT]׻zU~ֳW-=  e9~?Uq0݇2#fӔ?v4%þ| 0ܟzx?"`uwGt `cC9|69h-ϑ\]aId8%24 CTicH9m©Dc^q/t ? K9~xOqT{;ŀ[9U  Ĺw\qq&Yj1{=9S_іғ^]Wʟ8=)pbOHݶs745lll\^{ :8Pe~{=|7`G qaWx 1`1b6y̍`trZ7X}giC]\͇\~Y4LGbZdV_ePyї>L`8NKx- `Ca١$pS З!8g~Z ub-`O^4'Lj8v1x$pxKxl~0M`.w8K msfq0EQ7Nq;D+y| 8#pfVyq'xpI[l#P| _aEbDTK2w.,_..|[_%R<j o޹p*$^# $|#řo&̢R2-|x}=./ w4<*!=g,D+Ź?F1RO_~FY/WI%g_*0? u1"Mxxxh%$϶9[%~[YA5"wF/~_l]|C~A (CSxh!Oh-K%?9D_^ {"~?ܚjL4VULŸ]mCr86?'9\qPtԞj$k|Pߋ5>J|)83Cc7PSlj/[8] :}^ؖa<.ul}j}o@ q~lk G`.Ϋ qq|z.?}YC >10e$.F&;='o}p.9$.ݚA&!hw$F.~Hp%|j/jWn/'J?9G8f~[Ato,VyO7՟SBg џS] Ocuqi. nqO%n]ɦإe> M M M$At{Ouqtw,:SӦ'4M^*Jx<<:5DMFUp8(+ď5%ihsU*n;2&d+$CdܞI Bñr0<dT<ӤH=]N|e0eiqꗽKڝK'M,g˩L93-ony@Kt7I%;RR*IaQ.LuʐlY_nHllَtgDiQ^$+ oTMTi|M%5۩&Ui6ٰa/(Ǔ1;6وfdedkaih-d; ,iV ޕK,L:!s5lYG9L*XL_"Q&^jXjO#́f0"!dN Kax"dEЩ[l :Lh/T2\IcPAxaA4SxbTOIT)(֘XܡU &M=7sX>Ww$d7Di+6DbxgZ}IXTh2ڋiڰT6iL/lPc[XHRR'&0(yeѳOʢHB $y}ƋFsĂr"uLʖ ii& lF?:+H5}H))Jmn$C oDa{Er@'-I(ki}IF5)Nh=TYDIoo s%ED~Ky J&oR <0 k&q3Q=ٟgxCa8 YටVe^/QNN= ~uJ)c%yIi;Z:ToR;OdGl/^U4wbOhʱʀF"O$diW'RNAɢSQލ}Q)UL׆L*QYQ̧x(FKK4i7XDd1KYy4G&WB5PC%q\:;],3a~̔y1TR礳BCzr f''n?Htm\( H2D-LlI+_x0%E~tE-Fe\ϨRQ:6ɴo/I7WYWzֹof7lVmKq.2@;l]F%e}uR*㪋a!?NFq(GΈ&S_yUnE`ZL)SJvB,+>?W UtA .KTwJ 3HeteRLh0LKscyiTBb"Yfd/_mb }V7[UKg{}|&.SҭVlNڠBM ;%ZNBF|OZҢ-M|eqKE{O2Κ/nsЃ{(>c?{0ג0Pc@0@$0}n01/^Zc` TS3{r;D{xK;LIE :ex A -O!74-a^p:)Lʎdi]hlmgx٧tKהK5ʥYct*+dK7 O-H`&T%tIjAt_ COUt(-9}dvdxR./$f}h,( pd$Lsb"ʓ5_f":bq:IPCtE8,_P̖ȭ$0I 25p!GR1{^^P`,STs2S#8eVu-RLoHWNt@utTrq(\8L,*M2F1HX#X؝P0Csr|5Mk[LOr?hN?3tqd4DZNQҜ HJ7@3gQ+%w{j"f(YpYUA 2c %̃?)L WԊ'WZX[?$-빲SY\z2bWcDʊX!aqt,Zcʹ h":pBJ6Yu4,ɡI.I"#~ A1:ˀD(s^e\e4ݾedӗܔ!χ*#HgJh9oKa;'ty`5a唼b=DgO^8`U<}V2 eBA(w^١P49at5ZT3Q(egg[A)qAj#GeTI|C<_&CgXFRpPWEZݞ$37wit$%뀖+S-5D_fw|D-pqY'AYнRD[Gz|yKyʮ2wx#ӽB^$8 ;|HG8!ԫdLq{#hDxs]Rڳ(zGqZ =2g;pTDq \~[4-/uM"=ṣcG;;eT38fJ<_=XeM/)_f}P^ sIwH2G5,-Gǣhuᑥ^`g2k>6fAh/]]xC9"RZ.罩ֹ՛ͣ׌K/GY77k8ErGiJ"xp&zO<8O_`}S.sᗍuV'ʭt[dm^-nlpI[ɝ@]9O)BG +*/j2fC;SY+wUA ԝ~Fh18ZQ[ z @ 굲)]5e y)TF _#e}}J٥Tpf}.9GGqzU _& 1C;M>W4[f.s/N&C%ϙIfQ3W> eqm5e:4ҩ5S%J#^^~AC Oi ~> p=f,.Sݳj\S詁.kw ,P=^]^Eqi V"HƂ (hs0P()C/pNNuj tHT),][郶e{6+9{]S99+3UDvyE4Ӥ-eerفcc{\!2TuM Oy8iP蒐uFk~F-Me X$*eiK(S k|#Hټvw-=iTz=rәa*ẃpKؽ*t_t'Ue?^~>Wl{6v ,E}v(,Q,H+Z:L>Q5ʖ*IN߭Bg[ے<,ps6԰p4.[6; 9[e2mK>y "D.S{@7r`<0 (uDjZLZ>aTϰsXI3~ ֝q0 xF%/R#)H a1TW}|ODGGl V` $׽crA y&1Su`LmFb^XrAQq9/G-.>F_A*1ZVjSh,LbrꢩZn[=*|:T8V$IN:Rcs>0ӸHcm< f3J-eJեO%2@}H7vw?ӊx{Ъu.#u,,^ ꫙HE$!\ߖ;wkrb֪' eVzi;H7b/|RKoƒ%h"(WItS V5"^A&p\׊x@n:q)p\* V.Pn^FW6C^WҘ*Ei?;30 *ؐȎLѧyӱ^zL#q̺(ZN$\z/ڲ>* nTxđ yJ@K\6q^{fEj|ݍ5Uvp% .\lDY3U2GQ<=|X%CK*uo@/MvMjC uP uf9bU{xM6Tj FnI2t+5o/Pr. tNF3 i2s.-㻪 jxVpJӈ-Ob8K;xBtGx̺@h8ЂcɅh2,KP 7:fN֥-,x|rN\S3n?LKfĉ7yvDK\;~IPgXrЄȪM KUEM ..z~f<؆4)+&zY$J+^!ѱHVGsؙݝnñ1WfKJ` Z". pl g;3Rtvvf v-g6G,Z<ϙ\VJ`m(99iDxmf^ޜRO#PW!( 8~(KE:DƴtpiLLO}Tf7EӃiUQC#9% 4b4/.=n2M8ljLJ!)n;es/q IWOLKe3h:MdoK G{ē#!ʪ{º#ʤAUUʛI:zs~yؗ6.Ī,LlTr[NO)Lr:sG3&KՂ7+~#B{J%K%ٌL>9k0Zaa[9̇Ut+p0KFUܐH7{plFZEP8p;gŨϑ>XZ_ ]Z u]z=j4A{Pe%0Дoc0Y 9y n&I7>pB\52 W zT.ΫZY yYym(:BjFS@gmA*R)+rRR47qh.`z#&<^.$ʴ i# xjy^raDW; 3VRMhoE8 @!lR Bn#]0H%G!azd/%kTߵxCb@=~ DؐCO/+j*0M)1]&s gp,Qˆ J?a6&OcuSsH:1lD:(ej Y< Ǜ)6υ#k=-%M/b'*}Uš-X;HcjwQ%GC;t[-EEW%Bdc.o3&h<.LĬU p]Ly_PD>) ,Hƒ*{SA)1 ) 6H.)N؟B_I27TzɱdT8ׅbÈS?4ٖdFQD!dB Rdcm0n'dpphdRp*d08,ו^ (fQd4DQibpL {ͅkR s E,EۮL;lCԚ<\bB&tW3H1h;  όD5Oi-\nUڔ0$=;r%Cf"-MQϒԒ4$BEfsvv&&ƫ2@E:b/DXfI8&hx7RuJF  #`oW"h@5CWPkB^i$,>UТ,q3AV5:VXaGBN0Rt) ZYU\16[YHU. \P֮7E${[5Lys(yE7baV7ggeJ6;::Օmd6IV 6C[wҍvNڪ}c j[t۳8O%w +Xd7RS]5t-stZ{45&@h"a<9O׼R `6EH{Ϲ Cw#g{;ٜcRVTj_,r"w.[6ˑHQOI smDݙ-բW=} M0D)YC!=4+}@ڍ+BՕTT 4xJ2!OqqbYZ/KAo>/r̈"NB'!"ߒ$cAR8 LᜆЬ],R@+[6]j":PzHNDU&#u6Q++Ūt]z] 3JI?Ϫ" ^F1bU`y[e(A5@cӌ|9[6txrQKV[yS}a[Kì#1N k9"n3U<W!0U [Clͨ(r&5MhLPLTu-zb턷A[3'3 BMAjk`OD듴h]7Ԩ@Z$4$6L wLMuE@UpvwqE~( ëeZ$1.gg-:̀Z 8LL@9+@GR7:&thr54Ʀ^nƌbAbome,4e3Z栢E"Sq?u6z?aȖJ;*8,O@W-$uQK]aM8h~6]2)zNRI傯 y!,hu6,SJǜ^qFteށd93jWUM!lnAM\,-ufۜnaIJY8ʥ$ x,x45ʩ"㌐R8#]Oxɪ0{{; aɮ~x[qj/+Qϒ3sf$SV,{e+{9Hp;Q"G䲵\Jix=YrV9t9b*7u yω~6s8ˆC|6WKywGoPgDru!jS[5뷚&!N)u l}kstAJXb1$U-8"Ncn| įMlJ}5=D FC~d>02 VϩdzD/THMb%e%*+uzZ_U Y.Y/g| e~n\j{3毘ҁ'&T;_䯘NdH;adBs:u s8>~1i4=OyJCmXL!I.qۡimawԶduIAm_R]*L@I1`6Qs>ʾC`i[6Ƚhd]k!4bt%O]bZl5bx ',+B3S 7LOn͵r?tD d QH߯aNY0~vJ؏l^Mۯq0.I0^ˤmF9DɔCxE,&s=j-r%-\Q^:d TRRtnǿ)U Rm p "{4$!zZP]-~$ڝ1-idI[qlCPǔ?LCb;xS5LwQ|RsM9dhGU%ZElAl&oed&E-; -jHɴ)cf%޵ X"2UCG;*@]i C@n\ <ԥE-1jYP+TT V7b0'e=qDL$EQqv_bM=C`q8ZrCPEvM>d@هdP}ZNь8/׭T]Яnd| QKu@Rx`2,qmqݖ %ag8y)Q@r0>&NdVzH8.#t=Ю~^%HoQjaBFfV]}1KZAj D@F+ + B<a2bQO`jTm5h;]nf(ǯ"S;S""-Wutl(n",B(2^ e \sARUxҊV ua~ >%K[$}+iJ~vYb%C "^8/i/ 5+9vq3Cbb:+T'/8k;ښ@uŹ#.ƒUͫί,ºl=~;("|awXP/^8dSnZZ5bq@LXgi҃1FXBINdz6 = ^gꬔn%w,܍ΘR0_DGEEG%DdTT V\)c+&X7ABm ]C5ZtؚndQ:"CܭRɛuB4ŜfN2jm핲1^HQv}ev G˫:qv i^4NNr4^/bfm7F ʢ 8IY;,KY+l=8vP/ [[z'n׈֮7nz&k[Ti.IVV@M6[7j'[JmM3ԮGn5ЛM;l:# Vwj;qo&32G=5ÿۡP6MYGøڿsfQj 7Im}[no# S4͖$crPT([/ V^҇"R6 G\1m-1N@/)S cˁ=G+=S\ub{h2߿ [._фȕl$r/% Kc$ƿ$y6l+ґuz/3^6B5>7=b>Y#3T*?%(Tu=4G"%~Eum嬕t^ldW* Wʮ"[} " B[;]ܚ:Nz ۫lvk";[f:HP#jQo8sk@PCPjGG!32Ÿ%'PudU6~Fcu +Fꈻa~!x `{NFfGHbJi3Zzcg+m4}}hνL,@Z7 )M$st3KXu5ZsG:(Mfd{ډkC }ԩq;=M :1CGYu 9!Οu}&dgYVll2ַa ԺVwzE7p C~k[*ud#5v 򼯇U=ayTjӋfׇ|Y;S `/EC|G_5̤B/Tl~Q]R)ZHzߕAq6xHE2Re bL*%!@f )YCz,]rp- bQCK8ݥS[%=ieyKB@^YuՓK疞Ys/CDڹ)rV/]/ME'.C#YхewiQnP$LD&`))1!0/qI;d3,,˝/-!C]E{#~yޯCS9g~kMW%I= E'PIJ%ew4-24rHE "H$*<4,Y㡮d+t>ũᒬĥ)˼<\{ϖCvWj^alt{yVHTSB4!ReJp-Xg28{힣a 盒oJ|#2gKsN9%99G/3"L:^M3/}8EZ{VU2S_WSjRM%UZ4bCt<н?VZDVɊb6#gq;^t1@*p9=\VIաR&_SYYcٌ2wP,E?n#>Y;> W:C}P+{¶YUܒ8)+ƻe86&>#?ȷ 05jS1h4qǨPX#*(րCm,EDLMI,MA)V6d>$|׉#zrn3oAmA2 ?\\֛^c9"6+$apf?@U{[Y^)J ѥG`˧Z-mf}㰴5nI"ch1hZZ~^opky7; +\RAvuq)jvFkIKxq٢ ~xUaL?Iܾݓ㔴[Nfab`كC^} l4ZtN5I@n`%;Xt+C F %$F7yȩHH&M^slլ_[Ɩ;0m`&qatL?),\jZg'n:'X ZV('k>y0z|4k] ƖB9CI/,NuXI. Cn#r~Yiʜe-QqJ!><2ku :a[Fpt߬1o$pDE aI ݘFlvNYt4tF)ypizc Z@d(Xxcr^S#/~j+oƝ˼30ƥ !'֮7t]V66MH5r;\iN wtppP*]8*X7J)m獶H!L6Lۮq>L(䁦ܽMny}X7G.mƭF@Qh*A 'x=ٚ"`"0hx46(/X)iaHhҫ!Eo!nU4Mxq1m.;'A+0ϸ#QMaw[d 0/j6wW 4W{Ws0Mn '0HmE$4a7L~A+wHq7j,rPz.2!q(O d0,AIˠ~BHG6[EE A9Yfx6{&{BҫUiO'ФAGjHdl_qI!/zFaJx$pL2U3%ͬb wWL:w?G7j&^鹷3]<iFt]#-3r_*oYU]OcOwO_zbѽ!( T: mqcG\Mr+PvwSMd¢|爿Lٻ.~uq-=/eڤk: ̎ƪ4I@-zv/$5*Y6S,Q\pf1bނn(ީun[:dOXǝBY e3mL^FQ?TO9̘)oFt+e|xIq|meJ#T)]>BNSVn,Hv1Li<kQ ly$j?ɡ-5hK'IJ[ k=On3KU[BPwol51z XuhqqZ-AಓCN!YxcwfԤIB=L=ney*zR=Qm: #攽Wq kprKnI.Lv_b /SqZ'e@TO=Yr4 KG&Os )s$ba띛[u^­`nܰ?\t/&D#%$+ZkUW Ej`:fVu)Vi&>B88mkE[Y櫙 fdC5/I1+z3x&7H6U4Hgד$-e)I/ps-R8 [_/O0{PPqڜOH.(B5첵0eQy9{C\ [NnD2zlڟ]dE.%~I'g +zXGCup( f cnM'iuX:LN}x}c8fNk&!?;s0#op4=}[[0*(0MG+0{1}O:U 6˷-G8} 4uI~р /I!q#[upqv!'-bi=(UgeqD֒ G_JPvCZ}WЦ Q%Y,e?:bfbHeI"S_\.אHpzDW]~^ !{agl*Ďp0G;>;i/'~n|2_j<(yh/TI8oL#ad%Z:Tk%*ח i!K޾g''a\o ->FDCZٹr;NW,mtH(ANW#x.$ _8Qb('%au$%zKO6S$Ñ?4rJr< -5In{ MALq}Pһti\n$PH[(>1ۓ9flBk-UdH'v4+tDThB%^P>YNhq r_Ƴ)c\ oݘ||I%xÂ4.ۊ 8L@=Vwx ;ws'M S0U)^U,=rlX0u= θ.dfy@߄"c@7ޑ8HaK\poUhwI>'WWThqj%OG ?܋g=~T%:pXF^A]Exq)- "pX H 6y1.f$2aQU!.HuoqU욂XPvz- ky2p%qj\^v%\ {ҽ݄azӨPBIeFL8hoS`N{{j7UN٭!VmD}xrO.ym٫}uڭQ$pkh lWVlttAw}k\qF)}0` !mzD0USk.=6vceq{5 U5u1SkM٦xzj $ijIۼD)'v&Qd(.qT NlSo-pSݖ -ȝmUڋ V5rv dDi,IG5xzUx)ŭjO P+6] c!8 V%,XA'0J@sʄ@dَe?*ֻTtu2+d7ԉzеw{ %|ԣrdzU!>np |ԬG݋x[;$ +)[)t=N)j sR(}׻RA_F#ф 7yƒ ], @njVeIb WYJ3;ݑ4މ@w.11۟BdED[ }|4[:H/B7 zu&yf@wN ݸކFORs?G=X-1f}6{Og2ݨ@q,58lfw8=0]d%f*.6lj3x0;+rcbqA{Eν!)NޘfSyg>% >c]4Z!ώ%jcuyќ Wx4=M-hϦbҞc/3sq2;|[̷J7&u<ܘhЕ8 QƦ,)3ײ_)| lliX/([ ZPW+:̦\`rȖ MɒWr4]oq4-rfh Trv6T VF{Z40##8.g$Yos4MY- g>?v9B6b.r|1,_/KKߗdzWbqdr90,8x baaT:<=ASt}MVx<1}O by"7m:}RqL cxvP<ڡ *e4j@J)2)d%jA/ԨﵷAMI&Z֊öH4JJcL F kV\3a7.ƚJN6^6=輣%ٺU~6}22Hݣ!% B`d;&14uv5b4Kvsw'Tp;^'Yt8uO{xŏNHF =@n|=U=̶z TCD9wKmO- ߛ,fgGFsZ %[4JւGeA<9Y$:u#M|yr͓_zIl4x(qlj+dVͨWyx4^{}DwbvU3!e0fpjƩR/TvlL mhϜ$miTng4neJQ @ XR09 $Hq:q1 n/5t- /v+;񨿤x%zh:r_@?[hβZ26!- DZb8ftLJ8,\>p]&;197eWrCK|(6r76ךގ'3Da#L5c99_HG)6bNɒtfrU:anG:{zA:ulHGv1}D@됒h5[WK%ab zS ӧKZ~fҦZ7''(vq;0Cl4'D[>u~Gg .9 7ǡs9M\:16jBʀYwΡs#;-.o3NFvY;$ 'lýbB8I:)P`/W7[E2Zv?;q<.^1ʋ 0ہ螹g ~Yoq"x9U@_ o/G<aK]ǜCFc)ݼm״`D:[h"~Ʃ ;ɝh4nl9BXn訡#+FxBhskv(E *8_G\uf's+tf-qz$,`tɪ~f&H7;ܳd0$.bss]nWJƠQڼ6Wʇ:oM Ԯ%WwP_ܔu[[iX\}$89-g#N-H@~ރpJWDlTta&[@?@UbЛM zt=";{S(ɘY$ĩf`*VY7w}ڿ Կtj?:p>i:.̾nc0 d$r]dGj+QD~ȖJuR.מ -ׁ jLv:$UD&䈆d$Z^,P\nķ >|`N9)t\Rn rށ7mNkP)J4\;3Nf+?;~KYCA;QݙŹ;{#Vg=\ryobѴ+W.%e7'pɒԄ}rnڞLy_j:e)3*9| SaPfԌBm8L$P%J!llb;ܖ-#܄,KKtͺn_7 i bvڛ$>nsW oOGtϱ;>,vsx-JP8؎o>ĆѽI;>>:]L8 1Ĵ"u3lQQh 9@:qKcc/M1=c*~ߓz"~e굂$rĶRɰz %WH^0aBZ`rhm :ʟAL`'fE a1Ѡ#kא6W/D8K i Sy3TRSC3 Ps̡F-[52||ɐ u+b<;@h0`Ϙgz1;uI8I :Lim[G-|yOYH]((, ,2p Eȗw^.6$0.2T gӍצMŬHIoy˝͐&zV҂SPEFiTb9QQ?ۍ'oAB%^ a7"~@W;eK\:pvd ԳCJ5 Ꝼ#Oa-͹vV:ȚK[ 1/ehr 4#XaW~MjfUUm8?["נaUW`~UxP8Ik#ѹ64YJ4J$ȓȩhv6mV*#㑉!K䲃bWTIRLL. 6ОRk|Y*yD5=;PdGM2Yhs#(=Y*4Hԧc1hءeH&#dewL `*mc%p)YSKa !!爥 s-w7%cU~x:͋l %~LFH 5:vk'n64aQHUʓ[#Tʗ8Gui!B*_h{'Yadrc4is*04F ܳs]|[S4~X'0*he\QX4=O^@qYr82T1Җq"nPr΍uqonTKuQ )gO ʱxw{)ˮIu)74dk5W:q!OUH9XvAC FK'HYDSI0aME]/VZ؍/՝z[;N7hĿh0yPק-+QSPr~LKU=ݸL A'\o+tu3 _0>b컬wp&NN-cI%YS z"AW/4n@ulvw/E^12t9hʆt -5[q@}RVѼ`vTA?g!%,.5L^o=%7Wcj5*cSr*c `2^l3{ Wd?=_bz_/WUي/c>^a~.z)?C 5p?OFW2%ò]VI| ~}> ߿˽V70EKo76PqCq~]W,i *{gc3f3,&mo6/pr'oO:'4|nl~f#]ދ"=C%v؜c.g%W>y]eL۳,/xߥa^?s5x Ň7_(mދGr;SK{ ^5>s2&Y~xs@S, x/g,c.N}o)gy/>P{mIR~5r¿/ߘ7_{.TS&7wrv.U_ח? 9*X50an32;ߣn~<2fy#ï' ü5Fg#3\OWK~_VeGSW௢'}u*)?K_FG'e|r0>_࿟yN  G|߃(!+r }oށ,K3?do'ޓNx13N?_x9Z*?=!xxL{wG79U_i'9pG>ec O: q"=NH_-_xې==wBټ7MwkW~ pC  Ζ=97?7x|g7_޿M2 9g8/ol~?c/y ~ l1C>-}%>C_eW~$$*ps^`|ȁ?.v'HyC;|Ł? pށ&/|' ; -}op?u7G9=?wqqŁ#r~S?>ԏg| ~K 8{džǦ;߁ ׁ"8__??c#$9owO:v_Cx7P&-G!<:o̽G~q8/76zsc[%qo Bେv.1 sOH}~?CwH/ml ~E ,+G}1s/տ9/aq~<<[%~(=4_}+Eo_~i]l/b*Ûy #(~?6sM߇8;gbyx66^~?-E)sE5!87~1`m^=ȯ#fIa^opwތ$9{cLwO~?J g~/ml~aW$&0/:76,_66 }߿b{^z祾b>?m&`~(k~wQߘF7>Yk? PV?[>d~= #ҿ?3wx"?#?M$Y~X"~~9?Ic|?""~ɡCo3&7I;~(R~~$O }?{~nl"?Ѓ/%/I{?XGG)2/8?fKx=wnir} !z?ox9+#?ϻ? 炏6ѷ7!{+_{ox(YWR' /p y|ήEx`cT-_#ˡg-?cU{?+R8>Ƈ76zKot|׳h=:;f C7X#Pߧ^9Sa'? D'kPs,U g~6_ -úso|ܮ6oEx=OO;~#v~>) [ &SXy>D{$+~YϿ!?.V_vCW;~76[)ol+ɏ=?I}~ ?*W#l?@y<r7J_e0?8 ??>Vэ|żAk_pMkcmNw]iV{j/8m\0}~=3{/O5l/$!P^9"_H{>@ (S~/Y}?xW y} |cfcTa{|i? ~?8/`s_χ-?_"?]? |sO|{5tW<7nPy%m.X1:扁zQr%87{N͎qHc4ޢv6YtnjH-]Efքcz<$.϶ρ&Id pX>lc4i|-}ڶMf?s/l];`_/ω̖RmH-6&}Ġ[>gF+n`j)?4#ןǠzC1>OHr1k0 @jS:$0V 6b5ejԗ^'o4xIM-㨫$p]Rx~_nV,q*0wkw  [ ﷷkq{w={Gp'`hVa7VHH(ǎ9 h - "R4勵+O,zh:q 7űõ"drnfLm:,zb,leBlqz!/.fbb-7.04j/src/fbb_conf.c0100644000175100017510000001245407726646105013116 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ #include #include #include #include #define FBBCONFFILE "/etc/ax25/fbb.conf" /* Default values for the fbb.conf file */ static char *defstr[] = { "conf", "/etc/ax25/fbb", "data", "/var/ax25/fbb", "mess", "/var/ax25/fbb/mail", "comp", "/var/ax25/fbb/binmail", "fbbd", "*,*,/var/ax25/fbb/fbbdos,*,*,*,*,*", "yapp", "/var/ax25/fbb/fbbdos/yapp", "docs", "/var/ax25/fbb/docs", "sysm", "", "impo", "/var/ax25/fbb/mail/mail.in", "logs", "OK", "test", "NO", "fbbf", "OK 160", "fbbc", "OK 3", "aski", "OK", "mask", "3616", "secu", "0 4 59", "warn", "255", "hous", "2", "time", "10 20", "maxd", "0 0", "loca", "0", "beac", "8", "scro", "1500 1500 1500", "fwdh", "[$c] $$:$R", "maxb", "30000", "life", "30", "wpca", "", "zipc", "000000", "unpr", "500 5 P", "upba", "", "dwba", "", "pg", "/usr/lib/fbb/pg", "fdir", "/usr/lib/fbb/filter", "sdir", "/usr/lib/fbb/server", "tdir", "/usr/lib/fbb/tool", "poph", "", NULL }; /* a keyword has a maximum of 4 characters */ typedef struct conf_list { char key[5]; char *value; struct conf_list *next; } ConfList; static ConfList *conf_head = NULL; /* Creates a list of keyword = value */ int read_fbb_conf(char *pathname) { int i; int len; FILE *fp; char *ptr; char *scan; char line[256]; ConfList *conf; if (pathname == NULL) if ((pathname = getenv("FBBCONF")) == NULL) pathname = FBBCONFFILE; if ((fp = fopen (pathname, "r")) == NULL) return 1; while (fgets (line, sizeof(line), fp)) { scan = line; /* Eats spaces */ while (isspace(*scan)) ++scan; if (*scan == '#' || *scan == '\0') continue; /* remove the leading \n */ len = strlen(scan); if (len && (scan[len-1] == '\n')) scan[len-1] = '\0'; /* allocate a new structure */ conf = malloc(sizeof(ConfList)); if (conf == NULL) return 2; /* Not enough memory */ conf->value = NULL; conf->next = conf_head; conf_head = conf; /* extract the keyword */ i = 0; ptr = conf->key; while (isgraph(*scan)) { if (i++ < 4) { *ptr++ = *scan; } ++scan; if (*scan == '=') break; } *ptr = '\0'; /* finds the '=' */ scan = strchr(scan, '='); /* Copy the value */ if (scan) { ++scan; while (isspace(*scan)) ++scan; /* if the first character is '"' then string ends with '"' */ if (*scan == '"') { ++scan; ptr = strrchr(scan, '"'); if (ptr) *ptr = '\0'; } conf->value = strdup(scan); } else { conf->value = strdup(""); } } fclose(fp); return 0; } /* returns the value of a keyword. If unknown return NULL */ char *find_fbb_conf(char *key, int next) { static ConfList *conf_next = NULL; ConfList *conf = conf_head; if (next) conf = conf_next; while (conf) { if (strncasecmp(key, conf->key, 4) == 0) { conf_next = conf->next; return strdup(conf->value); } conf = conf->next; } return NULL; } /* returns the default value of a keyword. If unknown return NULL */ char *def_fbb_conf(char *key) { int pos; for (pos = 0 ; defstr[pos] ; pos += 2) { if (strncasecmp(key, defstr[pos], 4) == 0) { return strdup(defstr[pos+1]); } } return NULL; } /* free the list of keywords */ void free_fbb_conf(void) { ConfList *conf; while (conf_head) { conf = conf_head; conf_head = conf_head->next; free(conf->value); free(conf); } } /* get the list of default values */ char *get_fbb_def(int next) { static int pos = 0; char str[512]; if (next == 0) pos = 0; if (defstr[pos]) { sprintf(str, "%s\t%s", defstr[pos], defstr[pos+1]); pos += 2; return strdup(str); } return NULL; } /* get the list of all values */ char *get_fbb_all(int next) { static int first = 1; static int pos = 0; static ConfList *conf_next = NULL; char str[512]; if (first) { first = 0; pos = 0; conf_next = conf_head; } if (next == 0) { pos = 0; conf_next = conf_head; } if (conf_next) { sprintf(str, "s %s\t%s", conf_next->key, conf_next->value); conf_next = conf_next->next; return strdup(str); } while (defstr[pos]) { if (!find_fbb_conf(defstr[pos], 0)) { sprintf(str, "d %s\t%s", defstr[pos], defstr[pos+1]); pos += 2; return strdup(str); } else { pos += 2; } } return NULL; } fbb-7.04j/src/terminal.c0100644000175100017510000002047107726646105013171 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /********************************************** * * * xfbbC : Client for xfbbd BBS daemon version * * * **********************************************/ #include #include #include #include #include #include #include #include #include #define MAX_PACKETLEN 512 #define MAX_BUFLEN 2*MAX_PACKETLEN typedef struct { WINDOW *ptr; int max_y; int max_x; char string[MAX_BUFLEN]; int bytes; int curs_pos; } t_win; t_win win_in; t_win win_out; struct wint_s { WINDOW* ptr; int fline; int lline; struct wint_s* next; }; typedef struct wint_s wint; wint wintab; #define TALKMODE 001 /* two windows (outgoing and incoming) with menu */ #define SLAVEMODE 002 /* Menu mode */ #define RAWMODE 004 /* mode used by earlier versions */ int mode = TALKMODE; WINDOW* winopen(wint *wtab, int nlines, int ncols, int begin_y, int begin_x, int border) { while (wtab->next != NULL) wtab = wtab->next; wtab->next = (wint *)malloc(sizeof(wint)); wtab = wtab->next; wtab->next = NULL; wtab->ptr = newwin(nlines, ncols, begin_y, begin_x); if (wtab->ptr == NULL) return NULL; wtab->fline = begin_y; wtab->lline = begin_y + nlines; if (border) wborder(wtab->ptr, ACS_VLINE, ACS_VLINE, ACS_HLINE, ACS_HLINE, ACS_ULCORNER, ACS_URCORNER, ACS_LLCORNER, ACS_LRCORNER); return wtab->ptr; } int start_talk_mode(wint * wintab, t_win * win_in, t_win * win_out) { int cnt; WINDOW *win; win_out->max_y = 4; /* TXLINES */ win_out->max_x = COLS; win_in->max_y = (LINES - 4) - win_out->max_y; win_in->max_x = COLS; win_out->ptr = winopen(wintab, win_out->max_y + 1, win_out->max_x, (win_in->max_y + 3), 0, FALSE); win_in->ptr = winopen(wintab, win_in->max_y + 1, win_in->max_x, 1, 0, FALSE); win = winopen(wintab, 1, win_out->max_x, win_in->max_y + 2, 0, FALSE); for (cnt = 0; cnt < COLS; cnt++) waddch(win, '-'); wrefresh(win); scrollok(win_in->ptr, TRUE); scrollok(win_out->ptr, TRUE); wclear(win_out->ptr); wrefresh(win_out->ptr); wclear(win_in->ptr); wrefresh(win_in->ptr); win_out->bytes = 0; win_out->curs_pos = 0; win_in->bytes = 0; win_out->curs_pos = 0; return 0; } static int start_screen(char *call) { int cnt; if (initscr() == NULL) return -1; attron(A_REVERSE); move(0, 0); addstr(call); for (cnt = strlen(call); cnt <= 80; cnt++) addch(' '); attroff(A_REVERSE); noecho(); raw(); refresh(); return 0; } static void writeincom(int mode, t_win *win_in, unsigned char buf[], int bytes) { int cnt; if (mode & RAWMODE) { write(STDOUT_FILENO, buf, bytes); return; } for (cnt = 0; cnt < bytes; cnt++) { switch (buf[cnt]) { case 201: case 218: waddch(win_in->ptr, ACS_ULCORNER); break; case 187: case 191: waddch(win_in->ptr, ACS_URCORNER); break; case 200: case 192: waddch(win_in->ptr, ACS_LLCORNER); break; case 188: case 217: waddch(win_in->ptr, ACS_LRCORNER); break; case 204: case 195: waddch(win_in->ptr, ACS_LTEE); break; case 185: case 180: waddch(win_in->ptr, ACS_RTEE); break; case 203: case 194: waddch(win_in->ptr, ACS_TTEE); break; case 202: case 193: waddch(win_in->ptr, ACS_BTEE); break; case 205: case 196: waddch(win_in->ptr, ACS_HLINE); break; case 186: case 179: waddch(win_in->ptr, ACS_VLINE); break; case 129: waddch(win_in->ptr, 252); /*u umlaut */ break; case 132: waddch(win_in->ptr, 228); /*a umlaut */ break; case 142: waddch(win_in->ptr, 196); /*A umlaut */ break; case 148: waddch(win_in->ptr, 246); /*o umlaut */ break; case 153: waddch(win_in->ptr, 214); /*O umlaut */ break; case 154: waddch(win_in->ptr, 220); /*U umlaut */ break; case 225: waddch(win_in->ptr, 223); /*sz */ break; default: { if (buf[cnt] > 127) waddch(win_in->ptr, '.'); else waddch(win_in->ptr, buf[cnt]); } } } wrefresh(win_in->ptr); return; } int readoutg(t_win *win_out, wint *wintab, char buf[]) { int out_cnt; int c; int ypos = 0, xpos = 0; c = getch(); if (c == ERR) return 0; switch (c) { case KEY_BACKSPACE: case 127: { getyx(win_out->ptr, ypos, xpos); if (win_out->bytes > 0) { if (win_out->curs_pos < win_out->bytes) { mvwaddnstr(win_out->ptr, ypos, --xpos, &win_out->string[win_out->curs_pos], win_out->bytes - win_out->curs_pos); waddch(win_out->ptr, ' '); memmove(&win_out->string[win_out->curs_pos - 1], &win_out->string[win_out->curs_pos], win_out->bytes - win_out->curs_pos); } else mvwaddch(win_out->ptr, ypos, --xpos, ' '); wmove(win_out->ptr, ypos, xpos); win_out->bytes--; win_out->curs_pos--; } } break; case KEY_LEFT: if (win_out->curs_pos > 0) { win_out->curs_pos--; getyx(win_out->ptr, ypos, xpos); wmove(win_out->ptr, ypos, xpos - 1); } break; case KEY_RIGHT: if (win_out->curs_pos < win_out->bytes) { win_out->curs_pos++; getyx(win_out->ptr, ypos, xpos); wmove(win_out->ptr, ypos, xpos + 1); } break; case KEY_ENTER: case (int) '\n': case (int) '\r': { if (win_out->curs_pos < win_out->bytes) { getyx(win_out->ptr, ypos, xpos); wmove(win_out->ptr, ypos, xpos + win_out->bytes - win_out->curs_pos); } waddch(win_out->ptr, '\n'); win_out->string[win_out->bytes++] = (char) '\n'; wrefresh(win_out->ptr); strncpy(buf, win_out->string, win_out->bytes); wrefresh(win_out->ptr); out_cnt = win_out->bytes; win_out->bytes = 0; win_out->curs_pos = 0; return out_cnt; } break; default: { waddch(win_out->ptr, (char) c); if (win_out->curs_pos < win_out->bytes) { getyx(win_out->ptr, ypos, xpos); waddnstr(win_out->ptr, &win_out->string[win_out->curs_pos], win_out->bytes - win_out->curs_pos); memmove(&win_out->string[win_out->curs_pos + 1], &win_out->string[win_out->curs_pos], win_out->bytes - win_out->curs_pos); win_out->string[win_out->curs_pos] = (char) c; wmove(win_out->ptr, ypos, xpos); } else win_out->string[win_out->bytes] = (char) c; win_out->bytes++; win_out->curs_pos++; } } wrefresh(win_out->ptr); return 0; } void init_terminal(int termmode, char *call) { if (termmode) { mode = TALKMODE; start_screen(call); start_talk_mode(&wintab, &win_in, &win_out); } else { mode = RAWMODE; } } void end_terminal(void) { endwin(); } int read_terminal(char *buf, int len) { int bytes; if ((mode & RAWMODE) == RAWMODE) bytes = read(STDIN_FILENO, buf, len); else { bytes = readoutg(&win_out, &wintab, buf); if (bytes == -1) { wclear(win_in.ptr); wrefresh(win_in.ptr); wclear(win_out.ptr); wrefresh(win_out.ptr); bytes = 0; } writeincom(mode, &win_in, buf, bytes); } return bytes; } void write_terminal(char *buf, int bytes) { writeincom(mode, &win_in, buf, bytes); } fbb-7.04j/src/error.sys0100644000175100017510000000227207726646105013102 0ustar abaaba Fortify: init.c.515 malloc(0) attempted failed Fortify: init_srv.c.270 malloc(0) attempted failed Fortify: init_srv.c.270 malloc(0) attempted failed Fortify: init_srv.c.270 malloc(0) attempted failed Fortify: init_srv.c.270 malloc(0) attempted failed Fortify: init_srv.c.270 malloc(0) attempted failed Fortify: init_srv.c.270 malloc(0) attempted failed Fortify: init_srv.c.270 malloc(0) attempted failed Fortify: init_srv.c.270 malloc(0) attempted failed Fortify: init_srv.c.270 malloc(0) attempted failed Fortify: init_srv.c.270 malloc(0) attempted failed Fortify: init_srv.c.396 malloc(0) attempted failed Fortify: init_srv.c.401 malloc(0) attempted failed Fortify: init_srv.c.510 malloc(0) attempted failed Fortify: serveur.c.166 malloc(0) attempted failed Fortify: serveur.c.161 malloc(0) attempted failed Fortify: serveur.c.161 malloc(0) attempted failed Fortify: serveur.c.161 malloc(0) attempted failed Fortify: serveur.c.161 malloc(0) attempted failed Fortify: serveur.c.161 malloc(0) attempted failed fbb-7.04j/src/terminal.h0100644000175100017510000000300607726646105013171 0ustar abaaba/**************************************************************** * This software is Copyright (C) 1986-1998 by * * * * F6FBB - Jean-Paul ROUBELAT, jpr@f6fbb.org * * 6, rue George Sand * * 31120 - Roquettes - France * * * * License to copy and use this software is granted for * * non-commercial use provided that it is identified as * * * * "FBB packet-radio BBS software by Jean-Paul ROUBELAT, F6FBB" * * * * in all material mentioning or referencing this software * * or this function. * * * * These notices must be retained in any copies of any part of * * this documentation and/or software. * * * * Parts of code have been taken from many other softwares. * * Thanks for the help. * ****************************************************************/ void init_terminal(int termmode, char *call); void end_terminal(void); int read_terminal(char *buf, int len); void write_terminal(char *buf, int bytes); fbb-7.04j/src/res.txt0100644000175100017510000003550607726646105012551 0ustar abaaba############################## # Textes francais (V1.1) # # Pour F6FBB BBS (V5.15b) # # # # Version non accentuee # # adaptee de G7EVY @ GB7EVY # # par F6FBB @ F6FBB # ############################## # ############################################################## # NOTA: # # ~~~~~ # # La longueur des lignes ne doit pas depasser 255 caracteres # # L'ordre des lignes ne doit pas etre modifie # # Seules des lignes commentaires (commancant par un '#' # # peuvent etre ajoutees ou enlevees # # # ############################################################## # # # LANGUAGE, REPONSES, FORMATS (DATE, POINTS CARDINAUX) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Francais OL: Le language selectionne est : Francais$W Oui Non DimLunMarMerJeuVenSam JanFevMarAvrMaiJuiJulAouSepOctNovDec Nord Sud Est Ouest # # T_MES (MESSAGES DE BIENVENUE) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # BBS, EXPERT, NON-EXPERT # OK $I - %l Msg(s) - %k KB$W $WBonjour $I.$W $WBonjour $I, Bienvenue a $c.$WTapez ? pour avoir de l'aide.$W # # INFOS NOM, QTH, HOME-BBS, CODE-POSTAL # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # $WSVP entrez votre prenom : N (prenom). $WSVP entrez votre QTH : NQ (ville). $WSVP entrez votre BBS habituelle : NH (Home-BBS). $WSVP entrez votre code postal : NZ (code postal).$W$W # # MESSAGE POUR LES INVITES # ~~~~~~~~~~~~~~~~~~~~~~~~ # Vous avez un acces limite sur ce port.$W$W$=:$O>$W # # RESPONSE TO NON-BBS ON "BBS ONLY" PORT # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # #Desole, acces reserve aux BBS sur ce port.$W Desole, La messagerie F6FBB est arretee.$W # # MESSAGES DE CONNEXION # ~~~~~~~~~~~~~~~~~~~~~ # $WC'est votre premiere connexion sur cette messagerie.$W$O est situe a $c, $?.$WVous avez $0 message(s) nouveau(x).$W $WIl y a $0 message(s) nouveau(x). RN pour le(s) lire.$W $WIl y a $0 message(s) que vous avez lu(s) mais pas supprime(s).$W Vous etes reste connecte $: - Temps CPU : $.$W73 de $O.$W # # REPONSE A LA COMMANDE ! # ~~~~~~~~~~~~~~~~~~~~~~~ # $WBBS et Serveur par F6FBB V$E$W$Wcanaux:$W$% $W$N messages actifs - Dernier message $L - Dernier message liste $Z.$WMessages nouveaux pour:$W$Q$W$WVotre selection de message est $l.$WTemps de connexion : $: - Temps CPU : $.$W # # T_QST (QUESTIONS ET REPONSES STANDARDS) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Continue rret ontinue sans pagination Message suivant ..> Modification (O/N) ? Merci!$W $WAbandon!$W Creation (O/N) ? $WVotre choix (L=Liste, F=Fin) : Continue rret Lire Message # ..> # # T_ERR (MESSAGES D'ERREUR) # ~~~~~~~~~~~~~~~~~~~~~~~~~ # *** Erreur : Reponse erronnee.$W *** Erreur : La commande $0 est incorrecte, $I.$W *** Erreur : Il manque un espace ou un caractere apres la commande, $I.$W *** Erreur : Seule une reponse numerique est autorisee, $I.$W *** Erreur : Il manque le texte apres l'indicatif, $I.$W *** Desole : Il n'y a pas d'aide disponible pour $0.$W *** Erreur : Il manque l'indicatif de l'autre station, $I.$W *** Erreur : Il manque l'indicatif $I.$W *** Erreur : Il n'y a pas de fichier de ce nom, $I.$W *** Erreur : Le caractere $0 n'est pas interprete, $I.$W *** Erreur : Le message #%M n'existe pas, $I.$W *** Erreur : Le fichier $f n'existe pas, $I.$W *** Erreur : Vous ne pouvez pas supprimer le message #%M, $I.$W *** Erreur : #%M n'existe pas, $I.$W *** Erreur : Ce port n'est pas valide, $I.$W *** Erreur : Utilisez la commande CD, $I.$W *** Erreur : Le champ $0 est trop long.$W *** Erreur : L'adresse $0 est erronnee.$W *** Desole, vous avez deja transfere %d KB.$W *** Desole : Pas trouve!$W *** Erreur : Il manque le nom de fichier.$W *** Erreur : Il manque le fichier destination.$W *** Erreur : Cette langue est inconnue, $I.$W *** Erreur : Impossible de modifier $f.$W *** Erreur : Le repertoire "$0" n'existe pas, ou n'est pas vide.$W *** Erreur : Il manque le repertoire, $I.$W *** Erreur : Impossible de creer le repertoire "$0".$W *** Erreur : Il manque le chemin d'acces, $I.$W *** Erreur : Le chemin d'acces est trop long, $I.$W *** Erreur : Ce chemin d'acces n'existe pas, $I.$W *** Erreur : Impossible de creer le fichier $f, desole $I.$W *** Depassement temps!$W # # T_MBL (MESSAGERIE) # ~~~~~~~~~~~~~~~~~~ # # EXPERT, GUEST, NON-EXPERT PROMPTS # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $W$*:$O>$W $W$*:$O (B,KM,LM,O,RM,S,T,?) >$W $W$*:$O (A,B,C,D,F,G,I,J,K,L,M,N,O,P,R,S,T,U,V,W,X,Y,Z,?) >$W # # TEXTES GENERAUX #1 # ~~~~~~~~~~~~~~~~~~ # Il n'y a pas de message.$W Il n'y a pas de message nouveau.$W Entrez le sujet: Entrez le message, (Fin avec /EX ou Ctrl-Z):$W Le message #%M a ete supprime.$W # # REPONSE A LA COMMANDE V # ~~~~~~~~~~~~~~~~~~~~~~~ Logiciel F6FBB (V$E). $N messages actifs - Dernier message #$L.$W # # TEXTES GENERAUX #2 # ~~~~~~~~~~~~~~~~~~ Entrez votre prenom : Merci $I.$W Indicatif DernConnex #Cnx RPBSXLEMUI Lg Nom Password PRIV.$W $V n'est pas disponible, mais vous pouvez lui laisser un message.$W Attendez $I, j'appelle $V.$W $V n'est pas la mais vous pouvez lui laisser un message.$W $I, $V est au clavier:$W $W$I, $V voudrait vous parler.$W Vous etes maintenant en mode Expert.$W Vous etes maintenant en mode Normal.$W Vous etes en mode Serveur. Tapez F pour revenir en mode BBS.$W Le fichier $f a ete copie.$W Le message pour %G a ete annule (erreur d'adresse ou pas de titre).$W OP: Pagination programmee a : Devalidee$W OP: Pagination programmee a : $p lignes$W L'utilisateur est connecte, l'edition est impossible.$W $0 $1 $2 $3 $j $K = $4'$5 ON: Base Message programmee a : $0$W (B)id, (F)=Exp, (V)ia, (T)=Dest, T(I)tre, (S)tatus, T(Y)pe, (CR) fin >$W $W(R)=Ts msg, (P)agination, (B)BS, (S)ysop, e(X)pert, (L)ocal, (E)xclus, (M)odem,$W(U)=Unpro Msg, lan(G)ue, (N)om, pass(W)ord, pri(V), (H)omeBBS, (Z)=Code-postal,$W(CR)=fin >$W L'indicatif $0 est inconnu, creation (O/N) ? $WSupression de $0 O/[N] ? Langues disponibles:$W ($0):$1 $W ========== Fin du message #%M ==========$W$W # # REPONSE AUX COMMANDES $ (MESSAGE-#) OU FN (MESSAGE-#) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Message #$0$W # # HEADER DE MESSAGE # ~~~~~~~~~~~~~~~~~ # $WExpediteur : %P$WDestinataire: %G$0$WType/status : $t$s$WDate/heure : $j $K$WBid : $R$WNb lectures : %C$W # # HEADER DE LISTES # ~~~~~~~~~~~~~~~~ # #$WSelection des messages - [$l]$WMsg # TSL Dim Pour @ BBS Exped Date/Heure Sujet$W====== === ==== ===== ======= ====== ====/==== =======$W Msg # TSD Dim Pour @ BBS Exped Date/Heur Sujet Selection = [$l]$W # # CONTENU DES LIGNES DE LISTES # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $M $t$s%r $n $G$0 $P $i $1$W # Message # : %M$WTitre : $S$W Bid (Mid) : $R$W$W Routage vers $0-Routage via $v$W # # PROMPTS DU REVERSE FORWARDING, ET DU FORWARDING STANDARD # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ F>$W >$W # # MESSAGES DU FORWARDING # ~~~~~~~~~~~~~~~~~~~~~~ NO - Wrong parameter.$W NO - BID$W OK $W *** Done$W # Taille: %n$W Pas de routage programme vers %A. Je previens le sysop.$W La reponse sera adressee a %G@$v.$W OR: Acces a tous les messages : $0$W OM: Messages nouveaux a la connexion : $0$W Entrez votre BBS habituelle: Entrez votre code postal : HomeBBS: $0 Code postal : $1$W Attention! Pas de WP-Routage connu pour %G$W $W$0 message(s) retenu(s)$W $W(A)rchive,(K)=Supp,(L)ocal,(Q)uitte,(R,V)=Lit,(U)=Valide, (CR) fin >$W Message retenu pour validation par le Sysop.$W # # T_TRT # ~~~~~ # *** Occupe - Patientez SVP.$W *** Occupe - Connexion impossible.$W *** $0 n'est pas connecte.$W $W$B*** Connecte a $0 (Fin avec Ctrl-Z).$W *** Deconnecte.$W *** "Break" de $0 ***$W *** Fin du "break" ***$W "Break" pour $0 envoye.$W Demande d'arret de $0. Code: $1$W Demande d'arret acceptee, connexions interdites.$W Demande de reset acceptee, re-initialisation en cours.$W ################ Modifie pour 5.16 ######################### Continue rret ..> Demande d'arret rejetee.$W Vous etes en mode BBS. Tapez F pour revenir en mode Serveur.$W # # T_MEN (MENU SERVEUR) # ~~~~~~~~~~~~~~~~~~~~ # $WSERVEUR (C,D,N,Q,T,F,B,?) > $W $W(C) Connexions-Stat.$W(D) Documentations$W(Q) Qra-Locator$W(N) Nomenclature$W(T) Trajecto. Satellites$W(F) Retour en mode BBS$W(B) Deconnexion$W$WSERVEUR (C,D,N,Q,T,F,B,?) > # # T_STA (MODULE STATISTIQUES) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # $WCONNEXIONS-STAT. (G,H,I,J,L,O,F,B,?) > $W $W(G) Generalites$W(H) Utilisation horaire$W(I) Liste des indicatifs$W(J) Utilisation par jours$W(L) Details$W(O) Pourcentages$W(F) Retour au serveur$W(B) Deconnexion$W$WCONNECTIONS-STAT. (G,H,I,J,L,O,F,B,?) > Utilisation par jour$W LUN MAR MER JEU VEN SAM DIM$W Utilisation par heure$W 0 0 0 0 0 1 1 1 1 1 2 2 Heure$W 0 2 4 6 8 0 2 4 6 8 0 2$W $N messages actifs$W $0 Connexions depuis $j$W Connexions$W Temps moyen par connexion : $0min $1s$W Nombre de conexions / jour : $0$W Heures de pointe : A $1:00h et $0:00h.$W Utilisation (en pourcentage)$W BBS : $0 %%$W Serveur : $0 %%$W Details serveur :$W DOS : $0 %%$W Qra-Locator : $0 %%$W Docs : $0 %%$W Connexions-stat : $0 %%$W Nomenclature : $0 %%$W Satellites : $0 %%$W $0 $1 $2 $3 $j $K = $4'$5"$W # # T_NOM (MODULE NOMENCLATURE) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # $WNOMENCLATURE (I,N,R,F,B,?) > $W $W(R)echerche$W(I)ndicatifs$W(N)om et adresse$W(F) Retour au serveur$W(B) Deconnexion$W$WNOMENCLATURE (I,N,R,F,B,?) > $WIndicatif: $0$W $WDerniere connexion le $j a $K.$W Nom, prenom : $1 $0$WAdresse : $2, $3$WLocator : $4$WTel. Perso : $5$WTel. Modem : $6$WHome-BBS : $7$W Nom : Numero, rue : Ville : Telephone, perso : Telephone, modem : Qra-locator : $WTotal $0 indicatifs$W *** Indicatif $0 inconnu.$W *** Erreur Qra-locator (format : deux lettres, deux chiffres, deux lettres).$W # # T_TRJ (MODULE SATELLITE) # ~~~~~~~~~~~~~~~~~~~~~~~~ # $WSATELLITES (C,P,T,F,B,?) > $W(M) Mise a jour$W $W(C) Description$W(P) Parametres orbitaux$W(T) Calcul de trajectographie$W(F) Retour au serveur$W(B) Deconnexion$W$WSATELLITES (C,P,T,F,B,?) > $WQRA-Locator : $0 Satellite $1$W --------------------------------------------------------------$W | Heure | Az. | El. | Dpl. | Dist. | Alti. | Lon | Lat | Ph. |$W | UTC | Deg | Deg | KHz | Km | Km | Deg | Deg | 256 |$W --------------- $j-$y ----- Orbite #$0 ----------------$W | $0:$1 | $2 | $3 | $4 | $5 | $6 | $7 | $8 | $9 |$W Date de debut de clacul (DD/MM/YY) (Return = defaut) : Heure de debut de calcul (HH:MM) (Return = defaut) : $WPatientez SVP...$W $WPas d'information sur ce satellite.$W # Derniere mise a jour $j-$y.$W Nom du satellite : Orbite de reference : Annee de reference : Jour de reference : Anomalie moyenne : Arg. de perigee : R.A.A.N. : Inclinaison : Excentricite : Mouvement moyen : Derivee du mvt moyen: Pas de calcul (mn) : Frequence emission : $WParametres orbitaux de $0$W Numero d'orbite : $0$W Annee : $0$W Jour : $0$W Anomalie moyenne : $0$W Arg. de perigee : $0$W R.A.A.N. : $0$W Inclinaison : $0$W Excentricite : $0$W Mouvement moyen : $0$W Derivee du mvt moyen: $0$W Pas de calcul : $0$W$W ($0) $1 (F) Fin$W # # T_QTH (MODULE QRA LOCATOR) # ~~~~~~~~~~~~~~~~~~~~~~~~~~ # $WQRA-LOCATOR (C,D,L,Q,F,B,?) > $W $W(Q) Qra -> Long/Lat$W(L) Long/Lat -> Qra$W(D) Dist. et Azimuth$W(C) Distances$W(F) Retour au serveur$W(B) Deconnexion$W$WQRA-LOCATOR (C,D,L,Q,F,B,?) > $WEntrez votre Qra Locator SVP (Q to Quit) :$W Coordonnees geographiques au centre du carre :$W Longitude : $0 degres $1' $2 : $3 grades $2$W Latitude : $0 degres $1' $2 : $3 grades $2$W $WUtilisez le format$WEn degres = 1:45:00 [direction].$WEn grades = 1.5 [direction]$W[direction] sera remplace by Nord, Sud, Est ou Ouest.$W $WLongitude (Est/Ouest) : $WLatitude (Nord/Sud) : $WQra Locator : $0$W $WQra Locator origine : Qra Locator destination : Azimuth : $0 degres $1' : $2 grades$W Distance : $0 Km$W $WVotre Qra Locator : $WQra Locator destination (F = Fin) : Nombre de calculs $0 - Total des distances : $1 Km$W Calcul termine.$W # # T_DOS (MODULE DOS) # ~~~~~~~~~~~~~~~~~~ # $W[%dKB] $u:$0> Repertoire $0 supprime.$W Pas de fichier.$W $0 $1 $2 $3 $4 $5 $6 $7$W Envoi du fichie $f interrompu.$W Le fichier $f de $0 octets a ete transfere ($1 octets/s).$W Envoyez le fichier $f (Fin = Ctrl-Z).$W $0 octets copies.$W $W$j $T FBBDOS V$E$W $WCommandes disponibles :$W Le fichier $f a ete supprime.$W $W$0 octets libres. # # T_INF (MODULE DOCUMENTATION) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # $WDOCS$0 (#,L,R,F,B,?) > $W(D) Description.$W $W(numero) Lire la doc (numero)$W(L) Liste$W(R) Retour au niveau precedent$W(F) Retour au serveur$W(B) Deconnexion$WDOCS$0 (#,L,F,R,B,?) > Cette entree n'existe pas.$W # # T_GATE (GATEWAY MODULE) # ~~~~~~~~~~~~~~~~~~~~~~~ Vous etes sur le canal $=, port $!. $g port(s) disponible(s).$WH = Aide. Q = Quitte.$W Entrez le numero de port (Q = Quitte) : Vous utilisez le canal $0 du port : $1.$W Desole, pas de canal disponible sur ce port.$W Cmd : Mode conversation. Esc ou >(return) pour revenir en mode commande.$W *** Erreur : Vous etes deja sur ce port!$W *** Erreur : Port invalide.$W *** Le gateway n'est pas disponible, $I.$W $O: Commande $0 invalide. (C,D,J,K,H,M,P,Q,?) >$W Envoi de $f...$W Capture du texte dans le fichier $f.$W Capture du texte terminee.$W # # T_YAP (MODULE YAPP) # ~~~~~~~~~~~~~~~~~~~ # Envoie le(s) fichier(s) $f avec le protocole $0.$W Pret a recevoir le fichier $f avec le protocole $0.$W Desole, $0 n'est pas autorise sur ce port.$W Description du fichier, max 40 caracteres : $0 $1 $2 $3 $4$W # # T_CNF (MODULE CONFERENCE) # ~~~~~~~~~~~~~~~~~~~~~~~~~ # Vous entrez dans la conference (Aide = ".?").$W Il est $H. Stations dans la conference :$W Indicatif : $0, canal $1.$W $H $0 entre dans la conference.$W Vous quittez la conference.$W $H $0 a quitte la conference.$W $W[$H - $0]$W Il n'y a personne dans la conference.$W $H $0 : Trop de repetitions.$W $H $0 : Occupe.$W $H $0 n'est pas dans la conference!$W # # **Fin du fichier** # (Ouf!) # # T_THE (MODULE THEMES) # ~~~~~~~~~~~~~~~~~~~~~~~~~ # Msg # Dim Pour Exped Sujet (Theme:%T)$W $M $n $G $P $1$W %T - %t bulls (B,F,H,L,R,Numero) : # # fbb-7.04j/src/fbbgetconf0100755000175100017510000011656007726666457013260 0ustar abaabaELF`4`4 (444444 /lib/ld-linux.so.2GNU    ,g<*"aL-\8l3i|%"h3# 2̆[R܆)"Z lF,j<?pL-t libc.so.6printf__ctype_bgetenvfgets__cxa_finalizemallocoptargstrncasecmpstrrchrcallocfprintf__deregister_frame_infooptind__strdupgetoptsprintffclosestderrexitfopen_IO_stdin_used__libc_start_mainstrchr__register_frame_infofree__gmon_start__GLIBC_2.1.3GLIBC_2.1GLIBC_2.0si  ii ii !dhlpt $(,04 8 < @ D HLPTX\`US[ x [5%%h%h% h%$h%(h %,h(%0h0%4h8p%8h@`%<hHP%@hP@%DhX0%Hh` %Lhh%Php%Thx%Xh%\h%`h1^PTRh`hQVhP+US[|Xt[ÉU=u>PС8u|t h0]ÍvU]ÉU<thxh0 ]ÍvU]Í&'U WVS}11ndtat #ftRIp=jjjjhhP hhPj0t&hE PWtPt~h hP6jt4ShKS jÃut6ShKNS jÃut9U 4jVÃu6V-Ãu$VhOhPljShKS t2jVeÃtShKS СtPt9H1e[^_]ÍUWVSEuhuhPut&Q1lDB tt&C1DB u<#؉ڃtzt80t-@80t(@80t#@tttu@@)t | uDjƃ;FF 511ҡlfP ;u1e[^_]ÍvUS=t/C CPS =uы]]Ív'US}u   u1+DPRhSe S]ÍUVS=$t$(,}u(,,t`BPRhĒS,@ ,-(DPPh̒S(S(D(փ<t0ӍjPt((<u1[^]Ív'US=t Ѓ;u[]ÉU]Í&'US[à7[adhf: fbbgetconf V %d.%02d%c format : fbbgetconf [-a] [-d] [-h] [-l] [-f configfile] [key] [key] ... Cannot open fbb configuration file %s Unknown keyword %s poph/usr/lib/fbb/tooltdir/usr/lib/fbb/serversdir/usr/lib/fbb/filterfdir/usr/lib/fbb/pgpgdwbaupba500 5 Punpr000000zipcwpca30life30000maxb[$c] $$:$Rfwdh1500 1500 1500scro8beac0loca0 0maxd10 20time2hous255warn0 4 59secu3616maskaskiOK 3fbbcOK 160fbbfNOtestOKlogs/var/ax25/fbb/mail/mail.inimposysm/var/ax25/fbb/docsdocs/var/ax25/fbb/fbbdos/yappyapp*,*,/var/ax25/fbb/fbbdos,*,*,*,*,*fbbd/var/ax25/fbb/binmailcomp/var/ax25/fbb/mailmess/var/ax25/fbbdata/etc/ax25/fbbconfFBBCONF/etc/ax25/fbb.confr%s %ss %s %sd %s %s{vc^HC  ّԑӑΑ~yrmidb]WRNIGB@;,'  ӑӑӑސΐɐӑ  `(  \4(ooo42BRbr†҆"2BRQdd1<@o2~@e;eybVGT3G !"#%&122J3a4z5689;=>(?>@TAkBCDEFGHI#NcQ{RSTUVX[3^Keah{lqruv y z9 }Q j  F0 f # 4 <] C F SE Z ^ ulty G &-G8eK*#o&GGrHKL3UfZ^abJ .5789: ddP*dP1<@72~@e;eQ=f~GGTG !" ##%;&Q1h2345689;2=H>^?t@ABCDEFG+HDIYNQRSTUV7XO[i^ehlqruv7yRzo} +FEz#!4#!<p!C!F!SX"Z"^""-"7"#bVG +#-G@#Z#K#!$#h$+#GG}$\%%H%K%L&UP&Z&^&a&b4'')~**+5+7+8+9+:+/,IL,f,,'-/A/X!0aH0im0l0P0000_1(1"=1#S1$g1%|1&1'1(1-111=1B2G,2LD2QZ2Wp2c2h2m2s2t2z2 3F#3R<3^GS3h3~3333334 494R4l444W(444 5Q5&2i5555167-6Jv6Q666662VG5n7;7y88G88 9G"9:9nvS9;34; 9RoG;b<jQ<==G==: =G=>0>M>?yNNNNN 5O$8PO7O7 D8 D: D;D=D?DB'DC,DF0DG5DJ7DKADPCDU\DWrDZ|D\D_DdDgDiDkDmDnDoDqDrDtDv Dx DzD{D|'D~=DBDBDPDSDVDYDcDjDxD|DDDDDDDDDDDDDD+O@75O@9>O@:NO@;^O@i^O@v BjO@^O@P$dddpvOdp1<@72~@e;eQ=f~GGTG +F"#bVG +#-G@#h$+#GG+00 9RoG12Gl444W(44256=G;38G88O&%O PS"P&U #include #include #include #include #include #ifdef __LINUX__ #include #include #else #include #include #endif #include #include "version.h" char *conffile = NULL; int main(int ac, char **av) { int c; int list_all = 0; int list_def = 0; while ((c = getopt(ac, av, "adhf:")) != -1) { switch (c) { case 'a': list_all = 1; break; case 'd': list_def = 1; break; case 'f': conffile = optarg; break; case 'h': default: #ifdef LETTRE fprintf(stderr, "\nfbbgetconf V %d.%02d%c\n", MAJEUR, MINEUR, LETTRE); #else fprintf(stderr, "\nfbbgetconf V %d.%02d\n", MAJEUR, MINEUR); #endif fprintf(stderr, "format : fbbgetconf [-a] [-d] [-h] [-l] [-f configfile] [key] [key] ...\n"); exit(0); } } if (read_fbb_conf(conffile) > 0) { #ifdef ENGLISH fprintf(stderr, "Cannot open fbb configuration file \n"); #else fprintf(stderr, "Erreur ouverture fichier de configuration\n"); #endif exit(1); /* and users base directory */ } if (list_all) { char *ptr; while ((ptr = get_fbb_all(1)) != NULL) { printf("%s\n", ptr); free(ptr); } return 0; } if (list_def) { char *ptr; while ((ptr = get_fbb_def(1)) != NULL) { printf("%s\n", ptr); free(ptr); } return 0; } while (optind < ac) { char *key = av[optind]; char *ptr; ptr = find_fbb_conf(key, 0); if (ptr == NULL) ptr = def_fbb_conf(key); if (ptr == NULL) { #ifdef ENGLISH fprintf(stderr, "Unknown keyword %s\n", key); #else fprintf(stderr, "Mot cl %s inconnu\n", key); #endif exit(1); } printf("%s\n", ptr); free(ptr); while (ptr) { ptr = find_fbb_conf(key, 1); if (ptr) { printf("%s\n", ptr); free(ptr); } } ++optind; } return 0; } fbb-7.04j/src/drv_pop.c0100644000175100017510000022037107726650502013024 0ustar abaaba /**************************************************************** Copyright (C) 1986-2000 by F6FBB - Jean-Paul ROUBELAT 6, rue George Sand 31120 - Roquettes - France jpr@f6fbb.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Parts of code have been taken from many other softwares. Thanks for the help. ****************************************************************/ /****************************** * * DRIVER pour POP IP access * ******************************/ #include #include #include #include #include #include #include #include #include #include #include #include #undef open #undef read #undef write #undef close #define AX25_CALLSID 10 #define READ_EVENT 1 #define WRITE_EVENT 2 #define EXCEPT_EVENT 4 #define QUEUE_EVENT 8 #define DISCONNECT 0 #define CPROGRESS 1 #define POP_USER 10 #define POP_PASS 11 #define POP_TRANS 12 #define POP_MSG 13 #define SMTP_START 20 #define SMTP_USER 21 #define SMTP_MD5 22 #define SMTP_PASS 23 #define SMTP_TRANS 24 #define SMTP_MSG 25 #define NNTP_USER 30 #define NNTP_TRANS 31 #define NNTP_MSG 32 #define NNTP_LINE 33 #define DISC_EVENT 1 #define CONN_EVENT 2 #define RETR_EVENT 4 #define BUSY_EVENT 8 #define TIME_EVENT 16 #define SMTP_AUTH_NO 1 #define SMTP_AUTH_LOGIN 2 #define SMTP_AUTH_PLAIN 4 #define SMTP_AUTH_CRMD5 8 #define POP_AUTH_USER 1 #define POP_AUTH_APOP 2 typedef struct { long mess_num; long mess_size; char mess_stat; char mess_del; } tmess_t; typedef struct taddr { char *address; struct taddr *next; } taddr_t; typedef struct dbuf { char *data; int len; struct dbuf *next; } dbuf_t; typedef struct { int cr; int head; int ncan; int sock; int port; int state; int paclen; int maxframe; int event; int queue; int lpos; int lqueue; int nb_try; int nb_ret; int nb_lines; int lgcall; int mess_nb; int mess_cur; int disc_request; int quit_request; int auth_ok; int extra; long mess_tot; long timeout; char call[80]; char md5string[80]; taddr_t *mail_from; taddr_t *rcpt_to; taddr_t *content; indicat callsign; char *lbuf; dbuf_t *lsend; dbuf_t *msgbuf; tmess_t *mess; } tcan_t; typedef struct { int pop_fd; int smtp_fd; int nntp_fd; int rem_port; int curcan; int nbcan; int pop_auth; int smtp_auth; char rem_addr[80]; tcan_t *tcan; } tport_t; static tport_t tport[NBPORT]; static int stop_cnx (int port); static int s_free (tcan_t *); static int s_status (tcan_t *); static void clear_can (int port, int canal); static int pop_paclen (int port, int); static int pop_getline (int port, int can, char *buffer); static int pop_snd_dt (int port, int can, char *, int); static int pop_cmd (int port, int canal, char *cmd); static int pop_ini (int port, int canal, char *cmd); static int pop_stat (int port, int can, stat_ch *); static int pop_check_call (int port, int can, char *callsign, struct sockaddr_in *address); static int pop_check_pass (int port, int can, char *callsign); static int pop_send(int port, int canal, char *fmt, ...); static int pop_delete(int port, int canal); static int pop_process_read(int port, int canal, int *cmd, char *buffer, int nb); static int pop_to_bbs(int port, int canal, char *buffer, int clean); static int smtp_rcv_dt(int port, int can, char *buffer, int len); static char *base64_to_str(char *str); static char *str_to_base64(char *str); /*** pop commands ***/ static int pop_cmd_apop (int port, int can, char *buffer); static int pop_cmd_dele (int port, int can, char *buffer); static int pop_cmd_last (int port, int can, char *buffer); static int pop_cmd_list (int port, int can, char *buffer); static int pop_cmd_noop (int port, int can, char *buffer); static int pop_cmd_pass (int port, int can, char *buffer); static int pop_cmd_quit (int port, int can, char *buffer); static int pop_cmd_retr (int port, int can, char *buffer); static int pop_cmd_rset (int port, int can, char *buffer); static int pop_cmd_stat (int port, int can, char *buffer); static int pop_cmd_top (int port, int can, char *buffer); static int pop_cmd_uidl (int port, int can, char *buffer); static int pop_cmd_user (int port, int can, char *buffer); /*** smtp commands ***/ static int smtp_cmd_md5 (int port, int can, char *buffer); static int smtp_cmd_auth(int port, int can, char *buffer); static int smtp_cmd_data(int port, int can, char *buffer); static int smtp_cmd_ehlo(int port, int can, char *buffer); static int smtp_cmd_helo(int port, int can, char *buffer); static int smtp_cmd_mail(int port, int can, char *buffer); static int smtp_cmd_noop(int port, int can, char *buffer); static int smtp_cmd_pass(int port, int can, char *buffer, int base64); static int smtp_cmd_quit(int port, int can, char *buffer); static int smtp_cmd_rcpt(int port, int can, char *buffer); static int smtp_cmd_rset(int port, int can, char *buffer); static int smtp_cmd_user(int port, int can, char *buffer); static int smtp_cmd_vrfy(int port, int can, char *buffer); /*** nntp commands ***/ static int nntp_cmd_article(int port, int can, char *buffer); static int nntp_cmd_body(int port, int can, char *buffer); static int nntp_cmd_group(int port, int can, char *buffer); static int nntp_cmd_head(int port, int can, char *buffer); static int nntp_cmd_help(int port, int can, char *buffer); static int nntp_cmd_ihave(int port, int can, char *buffer); static int nntp_cmd_last(int port, int can, char *buffer); static int nntp_cmd_list(int port, int can, char *buffer); static int nntp_cmd_mode(int port, int can, char *buffer); static int nntp_cmd_newgroups(int port, int can, char *buffer); static int nntp_cmd_newnews(int port, int can, char *buffer); static int nntp_cmd_next(int port, int can, char *buffer); static int nntp_cmd_post(int port, int can, char *buffer); static int nntp_cmd_quit(int port, int can, char *buffer); static int nntp_cmd_slave(int port, int can, char *buffer); static int nntp_cmd_stat(int port, int can, char *buffer); static int nntp_cmd_xhdr(int port, int can, char *buffer); static int nntp_cmd_xover(int port, int can, char *buffer); static char *INVALID_CMD = "-ERR Invalid command; valid commands:"; /* * Driver's generic functions. */ int snd_pop (int port, int canal, int cmd, char *buffer, int len, Beacon * ptr) { switch (cmd) { case DATA: return pop_snd_dt (port, canal, buffer, len); } return 0; } /* receives data */ int rcv_pop (int *port, int *canal, int *cmd, char *buffer, int *len, ui_header * ui) { #define LGBUF 252 char buf[LGBUF + 2]; int can; int valid; int res; int i; *cmd = INVCMD; valid = 0; /* Checks if there is a POP connection */ res = 0; if (tport[*port].pop_fd) { tport[*port].tcan[0].sock = tport[*port].pop_fd; res = s_status (&tport[*port].tcan[0]); } if (res & READ_EVENT) { int new; int i; int addr_len; struct sockaddr_in sock_addr; addr_len = sizeof (sock_addr); new = accept (tport[*port].pop_fd, (struct sockaddr *) &sock_addr, &addr_len); /* Assigns the new socket to an empty channel. */ for (i = 1; i <= tport[*port].nbcan; i++) { if (tport[*port].tcan[i].state == DISCONNECT) { break; } } if (i > tport[*port].nbcan) { /* If cannot assign the channel, then disconnect. */ sprintf (buf, "-ERR FBB POP3 server at %s - No free channel!\r\n", mycall); write (new, buf, strlen (buf)); close (new); } else { int val = 0; tport[*port].tcan[i].state = POP_USER; tport[*port].tcan[i].sock = new; tport[*port].tcan[i].paclen = (val == 0) ? 250 : val; tport[*port].tcan[i].queue = s_free (&tport[*port].tcan[i]); tport[*port].tcan[i].timeout = time (NULL) + 120L; sprintf (tport[*port].tcan[i].md5string, "<%d.%ld@%s>", getpid(), time(NULL), mypath); sprintf (buf, "+OK FBB POP3 server ready %s\r\n", tport[*port].tcan[i].md5string); write (new, buf, strlen (buf)); val = p_port[*port].pk_t; return (FALSE); } } /* Tests if there is a SMTP connection. */ res = 0; if (tport[*port].smtp_fd) { tport[*port].tcan[0].sock = tport[*port].smtp_fd; res = s_status (&tport[*port].tcan[0]); } if (res & READ_EVENT) { int new; int i; int addr_len; struct sockaddr_in sock_addr; addr_len = sizeof (sock_addr); new = accept (tport[*port].smtp_fd, (struct sockaddr *) &sock_addr, &addr_len); /* Assigns the new socket to an empty channel. */ for (i = 1; i <= tport[*port].nbcan; i++) { if (tport[*port].tcan[i].state == DISCONNECT) { break; } } if (i > tport[*port].nbcan) { /* If cannot assign the channel, then disconnects. */ sprintf (buf, "421 FBB SMTP server at %s - No free channel!\r\n", mypath); write (new, buf, strlen (buf)); close (new); } else { int val = 0; tport[*port].tcan[i].state = SMTP_START; tport[*port].tcan[i].sock = new; tport[*port].tcan[i].paclen = (val == 0) ? 250 : val; tport[*port].tcan[i].queue = s_free (&tport[*port].tcan[i]); tport[*port].tcan[i].timeout = time (NULL) + 120L; /* sprintf (buf, "220 FBB SMTP server ready at %s\r\n", mypath); */ sprintf (buf, "220 FBB ESMTP server ready at %s\r\n", mypath); write (new, buf, strlen (buf)); val = p_port[*port].pk_t; return (FALSE); } } /* Checks if there is a NNTP connection. */ res = 0; if (tport[*port].nntp_fd) { tport[*port].tcan[0].sock = tport[*port].nntp_fd; res = s_status (&tport[*port].tcan[0]); } if (res & READ_EVENT) { int new; int addr_len; struct sockaddr_in sock_addr; addr_len = sizeof (sock_addr); new = accept (tport[*port].nntp_fd, (struct sockaddr *) &sock_addr, &addr_len); /* Assign the new socket to an empty channel. */ for (i = 1; i <= tport[*port].nbcan; i++) { if (tport[*port].tcan[i].state == DISCONNECT) { break; } } if (i > tport[*port].nbcan) { /* If cannot assign the channel, then disconnect. */ sprintf (buf, "400 FBB NNTP server at %s - No free channel!\r\n", mypath); write (new, buf, strlen (buf)); close (new); } else { int val = 0; tport[*port].tcan[i].state = NNTP_USER; tport[*port].tcan[i].sock = new; tport[*port].tcan[i].paclen = (val == 0) ? 250 : val; tport[*port].tcan[i].queue = s_free (&tport[*port].tcan[i]); tport[*port].tcan[i].timeout = time (NULL) + 120L; sprintf (buf, "201 FBB NNTP server ready at %s (no posting)\r\n", mypath); write (new, buf, strlen (buf)); val = p_port[*port].pk_t; if (tport[*port].tcan[i].state == NNTP_USER) { int nb; /* Connection */ nb = sprintf (buffer, "(%d) CONNECTED to %s", i, mycall); tport[*port].tcan[i].state = NNTP_TRANS; *len = nb; *cmd = COMMAND; *canal = i; return (TRUE); } return (FALSE); } } for (i = 1 ; i <= tport[*port].nbcan ; i++) { /* Next channel for polling */ ++tport[*port].curcan; if (tport[*port].curcan > tport[*port].nbcan) tport[*port].curcan = 1; can = tport[*port].curcan; if (tport[*port].tcan[can].lsend) { int nb = 0; dbuf_t *buf = tport[*port].tcan[can].lsend; /* for (;;) */ { memcpy(buffer+nb, buf->data, buf->len); nb += buf->len; tport[*port].tcan[can].lsend = buf->next; free (buf->data); free (buf); /* buf = tport[*port].tcan[can].lsend; if (buf == NULL) break; if ((nb + buf->len) > RCV_BUFFER_SIZE) break; */ } *len = nb; *cmd = DATA; *canal = can; return (TRUE); } if ((tport[*port].tcan[can].sock == -1) && (tport[*port].tcan[can].state != DISCONNECT)) { tport[*port].tcan[can].disc_request = 1; } if (tport[*port].tcan[can].disc_request) { sprintf (buffer, "(%d) DISCONNECTED fm server", can); tport[*port].tcan[can].state = DISCONNECT; clear_can (*port, can); *len = strlen (buffer); *cmd = COMMAND; *canal = can; return (TRUE); } /* Communication channel */ res = s_status (&tport[*port].tcan[can]); if (res & TIME_EVENT) { int nb; /* pop_send(*port, can, "-ERR time-out %s POP3 Server shutdown.\r\n", mycall); close (tport[*port].tcan[can].sock); clear_can (*port, can); */ strcpy(buffer, "QUIT\r"); nb = pop_process_read(*port, can, cmd, buffer, strlen(buffer)); if (nb > 0) { *len = nb; *cmd = COMMAND; *canal = can; return TRUE; } return (FALSE); } if (res & WRITE_EVENT) { /* Can write to the socket... Unused */ } if (res & EXCEPT_EVENT) { } #define LGTCP 1100 if ((res & QUEUE_EVENT) || (res & READ_EVENT)) { int nb = 0; if (tport[*port].tcan[can].sock == -1) { printf ("read on invalid socket\n"); return (FALSE); } /* Allocates buffer if necessary */ if (tport[*port].tcan[can].lbuf == NULL) { tport[*port].tcan[can].lbuf = calloc (LGTCP, 1); tport[*port].tcan[can].lpos = 0; tport[*port].tcan[can].lqueue = 0; tport[*port].tcan[can].nb_ret = 0; } if (res & READ_EVENT) { int qlen = tport[*port].tcan[can].lqueue; /* Some room left in buffer ? */ nb = ((LGTCP - qlen) > 256) ? 256 : LGTCP - qlen; if (nb) { nb = read (tport[*port].tcan[can].sock, buffer, nb); if ((nb == 0) || ((nb == -1) && (errno == ENOTCONN))) { /* tport[*port].tcan[can].disc_request = 1; */ int nb; close(tport[*port].tcan[can].sock); tport[*port].tcan[can].sock = -1; strcpy(buffer, "QUIT\r"); nb = pop_process_read(*port, can, cmd, buffer, strlen(buffer)); if (nb > 0) { *len = nb; *cmd = COMMAND; *canal = can; return TRUE; } return (FALSE); } else if (nb == -1) { printf ("errno = %d\n", errno); perror ("read"); return (FALSE); } } if (nb > 0) { nb = pop_process_read(*port, can, cmd, buffer, nb); if (nb > 0) { *len = nb; *cmd = COMMAND; *canal = can; return TRUE; } } } } } return (FALSE); } /* Open port */ int opn_pop (int port, int nb) { int i; int val; int len; int ok = TRUE; char s[80]; struct sockaddr_in sock_addr; char *ptr; int pop_port = 0; int smtp_port = 0; int nntp_port = 0; sprintf (s, "Init PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); InitText (s); sock_addr.sin_family = AF_INET; sock_addr.sin_addr.s_addr = 0; /* Test if portname is hex number */ ptr = p_com[(int) p_port[port].ccom].name; if (strcmp (ptr, "0") == 0) { pop_port = p_com[(int) p_port[port].ccom].port; } else if (strspn (ptr, ":0123456789abcdefABCDEF") != strlen (ptr)) { /* It may be tcp address. Port number is in port */ if (inet_aton (ptr, &sock_addr.sin_addr)) pop_port = p_com[(int) p_port[port].ccom].port; else pop_port = p_com[(int) p_port[port].ccom].cbase; } else { sscanf (p_com[(int) p_port[port].ccom].name, "%x:%x:%x", &pop_port, &smtp_port, &nntp_port); } sprintf (s, "Init PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); InitText (s); tport[port].tcan = (tcan_t *)calloc(nb+1, sizeof(tcan_t)); if (tport[port].tcan == NULL) return 0; tport[port].pop_auth = POP_AUTH_USER; tport[port].smtp_auth = SMTP_AUTH_NO; tport[port].curcan = 1; tport[port].nbcan = nb; for (i = 0 ; i <= nb ; i++) clear_can(port, i); /* Socket for receiving calls. */ if (tport[port].pop_fd == 0) { sprintf (s, "Open PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); InitText (s); sleep (1); if (pop_port) { /* POP socket */ sock_addr.sin_port = htons (pop_port); if ((tport[port].pop_fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { perror ("socket_r"); return (0); } val = 1; len = sizeof (val); if (setsockopt (tport[port].pop_fd, SOL_SOCKET, SO_REUSEADDR, (char *) &val, len) == -1) { perror ("opn_pop : setsockopt SO_REUSEADDR"); } if (bind (tport[port].pop_fd, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) != 0) { perror ("opn_pop : bind"); close (tport[port].pop_fd); tport[port].pop_fd = -1; return (0); } if (listen (tport[port].pop_fd, SOMAXCONN) == -1) { perror ("listen"); close (tport[port].pop_fd); tport[port].pop_fd = -1; return (0); } } if (nntp_port) { /* NNTP socket */ sock_addr.sin_port = htons (nntp_port); if ((tport[port].nntp_fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { perror ("socket_r"); return (0); } val = 1; len = sizeof (val); if (setsockopt (tport[port].nntp_fd, SOL_SOCKET, SO_REUSEADDR, (char *) &val, len) == -1) { perror ("opn_pop : setsockopt SO_REUSEADDR"); } if (bind (tport[port].nntp_fd, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) != 0) { perror ("opn_pop : bind"); close (tport[port].nntp_fd); tport[port].nntp_fd = -1; return (0); } if (listen (tport[port].nntp_fd, SOMAXCONN) == -1) { perror ("listen"); close (tport[port].nntp_fd); tport[port].nntp_fd = -1; return (0); } } if (smtp_port) { /* SMTP socket */ sock_addr.sin_port = htons (smtp_port); if ((tport[port].smtp_fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { perror ("socket_r"); return (0); } val = 1; len = sizeof (val); if (setsockopt (tport[port].smtp_fd, SOL_SOCKET, SO_REUSEADDR, (char *) &val, len) == -1) { perror ("opn_pop : setsockopt SO_REUSEADDR"); } if (bind (tport[port].smtp_fd, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) != 0) { perror ("opn_pop : bind"); close (tport[port].smtp_fd); tport[port].smtp_fd = -1; return (0); } if (listen (tport[port].smtp_fd, SOMAXCONN) == -1) { perror ("listen"); close (tport[port].smtp_fd); tport[port].smtp_fd = -1; return (0); } } memset (&tport[port].tcan[0], 0, sizeof (tcan_t)); } sprintf (s, "Prog PORT %d COM%d-%d", port, p_port[port].ccom, p_port[port].ccanal); InitText (s); return (ok); } /* Close port */ int cls_pop (int port) { int i; for (i = 1; i <= tport[port].nbcan; i++) { if (tport[port].tcan[i].sock != -1) { close (tport[port].tcan[i].sock); } tport[port].tcan[i].state = DISCONNECT; } if (tport[port].pop_fd) { close (tport[port].pop_fd); tport[port].pop_fd = 0; } if (tport[port].smtp_fd) { close (tport[port].smtp_fd); tport[port].smtp_fd = 0; } free(tport[port].tcan); return (1); } int sta_pop (int port, int canal, int cmd, void *ptr) { switch (cmd) { case TNCSTAT: return (pop_stat (port, canal, (stat_ch *) ptr)); case PACLEN: *((int *) ptr) = pop_paclen (port, canal); return (1); case PORTCMD: return (pop_ini (port, canal, (char *) ptr)); case SNDCMD: return (pop_cmd (port, canal, (char *) ptr)); case SETBUSY: return stop_cnx (port); } return 0; } /********************************************************************/ static void free_address(int port, int can) { taddr_t *head; taddr_t *curr; head = tport[port].tcan[can].mail_from; while (head) { curr = head; head = head->next; if (curr->address) free(curr->address); free(curr); } head = tport[port].tcan[can].rcpt_to; while (head) { curr = head; head = head->next; if (curr->address) free(curr->address); free(curr); } head = tport[port].tcan[can].content; while (head) { curr = head; head = head->next; if (curr->address) free(curr->address); free(curr); } tport[port].tcan[can].rcpt_to = NULL; tport[port].tcan[can].mail_from = NULL; tport[port].tcan[can].content = NULL; } static int pop_process_read(int port, int can, int *cmd, char *buffer, int nb) { int i; int pos; char *ptr; buffer[nb] = '\0'; pos = tport[port].tcan[can].lpos + tport[port].tcan[can].lqueue; if (pos >= LGTCP) pos -= LGTCP; ptr = tport[port].tcan[can].lbuf; for (i = 0; i < nb; i++) { if (tport[port].tcan[can].lqueue > (LGTCP - 10)) { ++tport[port].tcan[can].nb_ret; break; } ptr[pos] = buffer[i]; if (++pos == LGTCP) pos = 0; ++tport[port].tcan[can].lqueue; if (buffer[i] == '\r') { ++tport[port].tcan[can].nb_ret; } } while (tport[port].tcan[can].nb_ret > 0) { /* nb = tport[port].tcan[can].lqueue; if (tport[port].tcan[can].nb_ret <= 0) break; */ tport[port].tcan[can].timeout = time (NULL) + 120L; switch (tport[port].tcan[can].state) { case NNTP_USER: case NNTP_TRANS: if (!pop_getline (port, can, buffer)) break; sup_ln (buffer); if (strncmpi(buffer, "QUIT", 4) == 0) { nntp_cmd_quit(port, can, buffer); } else if (strncmpi(buffer, "ARTICLE", 7) == 0) { nntp_cmd_article(port, can, buffer); } else if (strncmpi(buffer, "BODY", 4) == 0) { nntp_cmd_body(port, can, buffer); } else if (strncmpi(buffer, "GROUP", 5) == 0) { nntp_cmd_group(port, can, buffer); } else if (strncmpi(buffer, "HEAD", 4) == 0) { nntp_cmd_head(port, can, buffer); } else if (strncmpi(buffer, "HELP", 4) == 0) { nntp_cmd_help(port, can, buffer); } else if (strncmpi(buffer, "IHAVE", 5) == 0) { nntp_cmd_ihave(port, can, buffer); } else if (strncmpi(buffer, "LAST", 4) == 0) { nntp_cmd_last(port, can, buffer); } else if (strncmpi(buffer, "LIST", 4) == 0) { nntp_cmd_list(port, can, buffer); } else if (strncmpi(buffer, "MODE", 4) == 0) { nntp_cmd_mode(port, can, buffer); } else if (strncmpi(buffer, "NEWGROUPS", 9) == 0) { nntp_cmd_newgroups(port, can, buffer); } else if (strncmpi(buffer, "NEWNEWS", 7) == 0) { nntp_cmd_newnews(port, can, buffer); } else if (strncmpi(buffer, "NEXT", 4) == 0) { nntp_cmd_next(port, can, buffer); } else if (strncmpi(buffer, "POST", 4) == 0) { nntp_cmd_post(port, can, buffer); } else if (strncmpi(buffer, "SLAVE", 5) == 0) { nntp_cmd_slave(port, can, buffer); } else if (strncmpi(buffer, "STAT", 4) == 0) { nntp_cmd_stat(port, can, buffer); } else if (strncmpi(buffer, "XHDR", 4) == 0) { nntp_cmd_xhdr(port, can, buffer); } else if (strncmpi(buffer, "XOVER", 4) == 0) { nntp_cmd_xover(port, can, buffer); } else if (*buffer != '\0') { pop_send(port, can, "500 Unknown command\r\n"); } break; case SMTP_START: if (!pop_getline (port, can, buffer)) break; sup_ln (buffer); if (strncmpi(buffer, "QUIT", 4) == 0) { smtp_cmd_quit(port, can, buffer); } else if (strncmpi(buffer, "EHLO", 4) == 0) { return smtp_cmd_ehlo(port, can, buffer); } else if (strncmpi(buffer, "HELO", 4) == 0) { return smtp_cmd_helo(port, can, buffer); } else if (*buffer != '\0') { pop_send(port, can, "502 Unknown command\r\n",INVALID_CMD); } break; case SMTP_USER: if (!pop_getline (port, can, buffer)) break; sup_ln (buffer); smtp_cmd_user(port, can, buffer); break; case SMTP_MD5: if (!pop_getline (port, can, buffer)) break; sup_ln (buffer); smtp_cmd_md5(port, can, buffer); break; case SMTP_PASS: if (!pop_getline (port, can, buffer)) break; sup_ln (buffer); smtp_cmd_pass(port, can, buffer, 1); break; case SMTP_TRANS: if (!pop_getline (port, can, buffer)) break; sup_ln (buffer); if (strncmpi(buffer, "QUIT", 4) == 0) { smtp_cmd_quit(port, can, buffer); } else if (strncmpi(buffer, "AUTH", 4) == 0) { return smtp_cmd_auth(port, can, buffer); } else if (strncmpi(buffer, "MAIL FROM:", 10) == 0) { smtp_cmd_mail(port, can, buffer); } else if (strncmpi(buffer, "RCPT TO:", 8) == 0) { smtp_cmd_rcpt(port, can, buffer); } else if (strncmpi(buffer, "NOOP", 4) == 0) { smtp_cmd_noop(port, can, buffer); } else if (strncmpi(buffer, "RSET", 4) == 0) { smtp_cmd_rset(port, can, buffer); } else if (strncmpi(buffer, "DATA", 4) == 0) { smtp_cmd_data(port, can, buffer); } else if (strncmpi(buffer, "VRFY", 4) == 0) { smtp_cmd_vrfy(port, can, buffer); } else if (*buffer != '\0') { pop_send(port, can, "502 Unknown command\r\n",INVALID_CMD); } break; case SMTP_MSG: if (!pop_getline (port, can, buffer)) break; sup_ln (buffer); smtp_rcv_dt(port, can, buffer, strlen(buffer)); break; case POP_USER: if (!pop_getline (port, can, buffer)) break; sup_ln (buffer); if (strncmpi(buffer, "QUIT", 4) == 0) { pop_cmd_quit(port, can, buffer); } else if ((tport[port].pop_auth & POP_AUTH_USER) && (strncmpi(buffer, "USER", 4) == 0)) { pop_cmd_user(port, can, buffer); } else if ((tport[port].pop_auth & POP_AUTH_APOP) && (strncmpi(buffer, "APOP", 4) == 0)) { return pop_cmd_apop(port, can, buffer); } else if (*buffer != '\0') { pop_send(port, can, "%s USER, APOP or QUIT\r\n",INVALID_CMD); } break; case POP_PASS: if (!pop_getline (port, can, buffer)) break; sup_ln (buffer); if (strncmpi(buffer, "QUIT", 4) == 0) { pop_cmd_quit(port, can, buffer); } else if (strncmpi(buffer, "PASS", 4) == 0) { return pop_cmd_pass(port, can, buffer); } else if (*buffer != '\0') { pop_send(port, can, "%s PASS, QUIT\r\n",INVALID_CMD); } break; case POP_TRANS: if (!pop_getline (port, can, buffer)) break; sup_ln (buffer); if (strncmpi(buffer, "QUIT", 4) == 0) { pop_cmd_quit(port, can, buffer); } else if (strncmpi(buffer, "LIST", 4) == 0) { pop_cmd_list(port, can, buffer); } else if (strncmpi(buffer, "LAST", 4) == 0) { pop_cmd_last(port, can, buffer); } else if (strncmpi(buffer, "DELE", 4) == 0) { pop_cmd_dele(port, can, buffer); } else if (strncmpi(buffer, "NOOP", 4) == 0) { pop_cmd_noop(port, can, buffer); } else if (strncmpi(buffer, "RETR", 4) == 0) { pop_cmd_retr(port, can, buffer); } else if (strncmpi(buffer, "RSET", 4) == 0) { pop_cmd_rset(port, can, buffer); } else if (strncmpi(buffer, "STAT", 4) == 0) { pop_cmd_stat(port, can, buffer); } else if (strncmpi(buffer, "TOP", 3) == 0) { pop_cmd_top(port, can, buffer); } else if (strncmpi(buffer, "UIDL", 4) == 0) { pop_cmd_uidl(port, can, buffer); } else if (*buffer != '\0') { pop_send(port, can, "%s DELE, LAST, LIST, NOOP, RETR, RSET, STAT, TOP, UIDL or QUIT\r\n",INVALID_CMD); } break; default: close (tport[port].tcan[can].sock); tport[port].tcan[can].sock = -1; tport[port].tcan[can].lqueue = 0; tport[port].tcan[can].nb_ret = 0; break; } } return (0); } static int stop_cnx (int port) { if (tport[port].pop_fd) { close(tport[port].pop_fd); tport[port].pop_fd = 0; } if (tport[port].smtp_fd) { close(tport[port].smtp_fd); tport[port].smtp_fd = 0; } return 1; } static int pop_check_call (int port, int can, char *callsign, struct sockaddr_in *address) { int res = 0; tport[port].tcan[can].callsign.num = extind (callsign, tport[port].tcan[can].callsign.call); if (find (tport[port].tcan[can].callsign.call)) { if (chercoord (tport[port].tcan[can].callsign.call) != 0xffff) res = 1; else res = 2; } /* Authorized address ? - To be written... */ if (address) { } return (res); } static int pop_check_pass (int port, int can, char *passwd) { unsigned record; record = chercoord (tport[port].tcan[can].callsign.call); if (record != 0xffff) { FILE *fptr; info frec; fptr = ouvre_nomenc (); fseek (fptr, ((long) record * sizeof (info)), 0); fread (&frec, sizeof (info), 1, fptr); ferme (fptr, 92); if (strcmpi (passwd, frec.pass) == 0) { return (TRUE); } } return (FALSE); } static int pop_check_md5 (int port, int can, char *passwd) { unsigned record; record = chercoord (tport[port].tcan[can].callsign.call); if (record != 0xffff) { uchar source[300]; uchar dest[80]; uchar pass[80]; FILE *fptr; info frec; fptr = ouvre_nomenc (); fseek (fptr, ((long) record * sizeof (info)), 0); fread (&frec, sizeof (info), 1, fptr); ferme (fptr, 92); strcpy(pass, frec.pass); /* try with recorded password */ strcpy(source, tport[port].tcan[can].md5string); strcat(source, pass); MD5String (dest, source); if (strcmpi (passwd, dest) == 0) { return (TRUE); } /* try with password in lower case */ strcpy(source, tport[port].tcan[can].md5string); strlwr(pass); strcat(source, pass); MD5String (dest, source); if (strcmpi (passwd, dest) == 0) { return (TRUE); } } return (FALSE); } static int pop_snd_dt (int port, int canal, char *buffer, int len) { int i; int cr; int head; int nb_lines; int num; char *ptr; char buf[600]; if (tport[port].tcan[canal].sock == -1) return (FALSE); if (tport[port].tcan[canal].state == NNTP_LINE) { ptr = strchr(buffer, '\r'); if (ptr) *ptr = '\0'; pop_send(port, canal, "%s\r\n", buffer); tport[port].tcan[canal].state = NNTP_TRANS; } else if (tport[port].tcan[canal].state == NNTP_MSG) { cr = tport[port].tcan[canal].cr; head = tport[port].tcan[canal].head; nb_lines = tport[port].tcan[canal].nb_lines; for (ptr = buf, i = 0; i < len; i++) { if (buffer[i] == '\033') { pop_send(port, canal, ".\r\n"); tport[port].tcan[canal].state = NNTP_TRANS; return 1; } if (buffer[i] == '\032') { tport[port].tcan[canal].state = NNTP_TRANS; return 1; } if (cr && buffer[i] == '.') *ptr++ = '.'; *ptr++ = buffer[i]; if (buffer[i] == '\r') { *ptr++ = '\n'; *ptr = '\0'; if (head == 0 && nb_lines != 1) { /* Mode = 2 : No headers */ pop_send(port, canal, "%s", buf); } if (head == 1 && nb_lines != 2) { /* Mode = 1 : Only headers */ pop_send(port, canal, "%s", buf); } if (cr) { /* Empty line -> End of headers */ head = 0; } ptr = buf; cr = 1; } else { cr = 0; } } *ptr = '\0'; if (*buf) pop_send(port, canal, "%s", buf); tport[port].tcan[canal].cr = cr; tport[port].tcan[canal].head = head; } else if (tport[port].tcan[canal].state == POP_MSG) { cr = tport[port].tcan[canal].cr; head = tport[port].tcan[canal].head; num = tport[port].tcan[canal].mess_cur; nb_lines = tport[port].tcan[canal].nb_lines; for (ptr = buf, i = 0; i < len; i++) { if (buffer[i] == '\033') { pop_send(port, canal, ".\r\n"); tport[port].tcan[canal].state = POP_TRANS; return 1; } if (cr && buffer[i] == '.') *ptr++ = '.'; *ptr++ = buffer[i]; if (buffer[i] == '\r') { if (cr) { /* Empty line -> End of headers */ head = 0; } *ptr++ = '\n'; *ptr = '\0'; pop_send(port, canal, "%s", buf); ptr = buf; cr = 1; if (head == 0 && nb_lines-- == 0) { pop_send(port, canal, ".\r\n"); tport[port].tcan[canal].state = POP_TRANS; return 1; } } else { cr = 0; } } *ptr = '\0'; if (*buf) pop_send(port, canal, "%s", buf); tport[port].tcan[canal].cr = cr; tport[port].tcan[canal].head = head; tport[port].tcan[canal].nb_lines = nb_lines; } return 1; } static int pop_send(int port, int canal, char *fmt, ...) { char buf[1200]; va_list argptr; if (tport[port].tcan[canal].sock != -1) { va_start (argptr, fmt); vsprintf (buf, fmt, argptr); va_end (argptr); if (1) ibm_to_ansi(buf, strlen(buf)); write (tport[port].tcan[canal].sock, buf, strlen (buf)); return 1; } return 0; } static int pop_ini (int port, int canal, char *cmd) { char *ptr; ptr = strtok(cmd, " \t"); if (ptr == NULL) return 0; switch (*ptr) { case 'S': /* SMTP configuration */ ptr = strtok(NULL, " \t"); if (strcmpi(ptr, "AUTH") == 0) { tport[port].smtp_auth = 0; while ((ptr = strtok(NULL, " \t")) != NULL) { if (strcmpi(ptr, "NO") == 0) tport[port].smtp_auth |= SMTP_AUTH_NO; else if (strcmpi(ptr, "LOGIN") == 0) tport[port].smtp_auth |= SMTP_AUTH_LOGIN; else if (strcmpi(ptr, "PLAIN") == 0) tport[port].smtp_auth |= SMTP_AUTH_PLAIN; else if (strcmpi(ptr, "CRAM-MD5") == 0) tport[port].smtp_auth |= SMTP_AUTH_CRMD5; } if (tport[port].smtp_auth == 0) tport[port].smtp_auth = SMTP_AUTH_NO; } break; case 'P': /* POP configuration */ ptr = strtok(NULL, " \t"); if (strcmpi(ptr, "AUTH") == 0) { tport[port].pop_auth = 0; while ((ptr = strtok(NULL, " \t")) != NULL) { if (strcmpi(ptr, "USER") == 0) tport[port].pop_auth |= POP_AUTH_USER; else if (strcmpi(ptr, "APOP") == 0) tport[port].pop_auth |= POP_AUTH_APOP; } if (tport[port].pop_auth == 0) tport[port].pop_auth |= POP_AUTH_USER; } break; } return (0); } static int pop_cmd (int port, int canal, char *cmd) { int i; char status; long nb, size; switch (*cmd++) { case 'D': close (tport[port].tcan[canal].sock); tport[port].tcan[canal].sock = -1; break; case 'S': /* Message information */ sscanf(cmd, "%ld", &nb); tport[port].tcan[canal].mess_nb = nb; tport[port].tcan[canal].mess_cur = 0; tport[port].tcan[canal].mess_tot = 0L; tport[port].tcan[canal].mess = malloc(sizeof(tmess_t) * nb); break; case 'M': if (tport[port].tcan[canal].state != POP_TRANS) break; /* Message list */ nb = 0; sscanf(cmd, "%ld %ld %c", &nb, &size, &status); if (nb == 0) { /* End of list */ pop_send(port, canal, "+OK connected to %s BBS %d messages (%ld bytes)\r\n", tport[port].tcan[canal].callsign.call, tport[port].tcan[canal].mess_nb, tport[port].tcan[canal].mess_tot); } i = tport[port].tcan[canal].mess_cur; if (i < tport[port].tcan[canal].mess_nb) { tport[port].tcan[canal].mess_tot += size; tport[port].tcan[canal].mess[i].mess_num = nb; tport[port].tcan[canal].mess[i].mess_size = size; tport[port].tcan[canal].mess[i].mess_stat = status; tport[port].tcan[canal].mess[i].mess_del = 0; tport[port].tcan[canal].mess_cur = i+1; } break; } return (0); } static int pop_stat (int port, int canal, stat_ch * ptr) { int val; if ((canal == 0) || (tport[port].tcan[canal].sock == -1)) return (0); ptr->mem = 100; val = s_free (&tport[port].tcan[canal]); ptr->ack = 0; if (tport[port].tcan[canal].state == POP_MSG || tport[port].tcan[canal].state == SMTP_MSG || tport[port].tcan[canal].state == NNTP_MSG) { ptr->ack = (tport[port].tcan[canal].queue - val) / tport[port].tcan[canal].paclen; if ((tport[port].tcan[canal].queue - val) && (ptr->ack == 0)) ptr->ack = 1; } return (1); } static int s_status (tcan_t * can) { int nb; int res = 0; fd_set tcp_read; fd_set tcp_write; fd_set tcp_excep; struct timeval to; if (can->sock == -1) return (0); if ((can->timeout) && (can->timeout < time (NULL))) { res |= TIME_EVENT; can->timeout = 0L; return (res); } if (can->lqueue) { res |= QUEUE_EVENT; } to.tv_sec = to.tv_usec = 0; can->event = 0; FD_ZERO (&tcp_read); FD_ZERO (&tcp_write); FD_ZERO (&tcp_excep); FD_SET (can->sock, &tcp_read); FD_SET (can->sock, &tcp_write); FD_SET (can->sock, &tcp_excep); nb = select (can->sock + 1, &tcp_read, &tcp_write, &tcp_excep, &to); if (nb == -1) { perror ("select"); return (res); } else if (nb == 0) { return (res); } else { if (FD_ISSET (can->sock, &tcp_read)) { res |= READ_EVENT; } if (FD_ISSET (can->sock, &tcp_write)) { res |= WRITE_EVENT; } if (FD_ISSET (can->sock, &tcp_excep)) { res |= EXCEPT_EVENT; } } return (res); } /* Copies a line in the buffer. */ static int pop_getline (int port, int can, char *buffer) { int i = 0; int c; int pos; char *ptr; pos = tport[port].tcan[can].lpos; ptr = tport[port].tcan[can].lbuf; while (tport[port].tcan[can].lqueue > 0) { c = ptr[pos]; if (++pos == LGTCP) pos = 0; --tport[port].tcan[can].lqueue; if (c != '\n') buffer[i++] = c; if (c == '\r') { --tport[port].tcan[can].nb_ret; break; } } buffer[i] = '\0'; tport[port].tcan[can].lpos = pos; if (tport[port].tcan[can].lqueue == 0) tport[port].tcan[can].nb_ret = 0; return (i); } static void free_lsend(int port, int canal) { dbuf_t *buf; while ((buf = tport[port].tcan[canal].lsend) != NULL) { tport[port].tcan[canal].lsend = buf->next; free(buf->data); free(buf); } } static void free_msgbuf(int port, int canal) { dbuf_t *buf; while ((buf = tport[port].tcan[canal].msgbuf) != NULL) { tport[port].tcan[canal].msgbuf = buf->next; free(buf->data); free(buf); } } static int pop_to_bbs(int port, int canal, char *buf, int clean) { dbuf_t *cur; dbuf_t *sbuf; if (clean) free_lsend(port, canal); cur = malloc(sizeof(dbuf_t)); if (cur == NULL) return 0; cur->len = strlen(buf); cur->data = strdup(buf); cur->next = NULL; sbuf = tport[port].tcan[canal].lsend; if (sbuf) { /* Append to last buffer */ while (sbuf->next != NULL) sbuf = sbuf->next; sbuf->next = cur; } else { tport[port].tcan[canal].lsend = cur; } return 1; } static int pop_delete(int port, int canal) { int i; int nb = 0; char num[80]; char buf[80]; if (tport[port].tcan[canal].disc_request) return 0; strcpy(buf, "K"); for (i = 0 ; i < tport[port].tcan[canal].mess_nb ; i++) { if (tport[port].tcan[canal].mess[i].mess_del) { sprintf(num, " %ld", tport[port].tcan[canal].mess[i].mess_num); strcat(buf, num); if ((++nb % 4) == 0) { strcat(buf, "\r"); pop_to_bbs(port, canal, buf, 0); strcpy(buf, "K"); nb = 0; } } } if (nb > 0) { strcat(buf, "\r"); pop_to_bbs(port, canal, buf, 0); } return 1; } static int pop_paclen (int port, int canal) { if (tport[port].tcan[canal].sock == -1) return (0); return (tport[port].tcan[canal].paclen); } static int s_free (tcan_t * can) { int queue_free; if (ioctl (can->sock, TIOCOUTQ, &queue_free) == -1) { perror ("ioctl : TIOCOUTQ"); return (0); } return (queue_free); } static void clear_can (int port, int canal) { free_address(port, canal); if (tport[port].tcan[canal].lbuf) free (tport[port].tcan[canal].lbuf); if (tport[port].tcan[canal].lsend) free_lsend(port, canal); if (tport[port].tcan[canal].msgbuf) free_msgbuf(port, canal); if (tport[port].tcan[canal].mess) free(tport[port].tcan[canal].mess); memset (&tport[port].tcan[canal], 0, sizeof (tcan_t)); tport[port].tcan[canal].sock = -1; tport[port].tcan[canal].state = DISCONNECT; } /* * POP commands processing ** */ /* Check the given # msg in a pop command */ static int check_num (int port, int can, int num) { if (num < 1 || num > tport[port].tcan[can].mess_nb) { pop_send(port, can, "-ERR invalid message; number out of range.\r\n"); return 0; } if (tport[port].tcan[can].mess[num-1].mess_del) { pop_send(port, can, "-ERR message %d has been marked for deletion.\r\n", num); return 0; } return 1; } static int pop_cmd_quit(int port, int can, char *buffer) { if (tport[port].tcan[can].quit_request) return 0; tport[port].tcan[can].quit_request = 1; /* Received "QUIT" : disconnect */ if (tport[port].tcan[can].state != POP_USER) { pop_delete(port, can); pop_to_bbs(port, can, "B\r", 0); } else { close (tport[port].tcan[can].sock); tport[port].tcan[can].sock = -1; } pop_send(port, can, "+OK %s POP3 Server shutdown.\r\n", mycall); return 0; } static int pop_cmd_list (int port, int can, char *buffer) { int i; int nb; char *ptr = buffer + 4; while (isspace(*ptr)) ++ptr; if (*ptr) { nb = atoi(ptr); if (check_num(port, can, nb)) pop_send(port, can, "+OK %d %ld\r\n", nb, tport[port].tcan[can].mess[nb-1].mess_size); return 1; } pop_send(port, can, "+OK %d messages (%ld bytes).\r\n", tport[port].tcan[can].mess_nb, tport[port].tcan[can].mess_tot); for (i = 0 ; i < tport[port].tcan[can].mess_nb ; i++) { if (tport[port].tcan[can].mess[i].mess_del == 0) pop_send(port, can, "%ld %ld \r\n", i+1, tport[port].tcan[can].mess[i].mess_size); } pop_send(port, can, ".\r\n"); return 0; } static int pop_cmd_uidl (int port, int can, char *buffer) { int i; int nb; char *ptr = buffer + 4; while (isspace(*ptr)) ++ptr; if (*ptr) { nb = atoi(ptr); if (check_num(port, can, nb)) pop_send(port, can, "+OK %d %s\r\n", nb, xuidl(tport[port].tcan[can].mess[nb-1].mess_num, mycall)); return 1; } pop_send(port, can, "+OK uidl command accepted.\r\n"); for (i = 0 ; i < tport[port].tcan[can].mess_nb ; i++) { if (tport[port].tcan[can].mess[i].mess_del == 0) pop_send(port, can, "%ld %s\r\n", i+1, xuidl(tport[port].tcan[can].mess[i].mess_num, mycall)); } pop_send(port, can, ".\r\n"); return 0; } static int pop_cmd_user (int port, int can, char *buffer) { char *ptr = buffer + 4; while (isspace(*ptr)) ++ptr; strn_cpy(6, tport[port].tcan[can].callsign.call, ptr); tport[port].tcan[can].state = POP_PASS; pop_send(port, can, "+OK please send PASS command\r\n"); return 0; } static int pop_cmd_pass (int port, int can, char *buffer) { int ok = 0; char *ptr = buffer + 4; char *callsign = tport[port].tcan[can].callsign.call; int addr_len; struct sockaddr_in *address; struct sockaddr_in sock_addr; while (isspace(*ptr)) ++ptr; addr_len = sizeof (sock_addr); if ((getpeername(tport[port].tcan[can].sock, (struct sockaddr *)&sock_addr, &addr_len) == 0) && (sock_addr.sin_family == AF_INET)) address = &sock_addr; else address = NULL; // Check login switch (pop_check_call (port, can, callsign, address)) { case 1: // Check password if (pop_check_pass (port, can, ptr)) { sprintf (buffer, "(%d) CONNECTED to %s-%d", can, tport[port].tcan[can].callsign.call, tport[port].tcan[can].callsign.num); tport[port].tcan[can].state = POP_TRANS; tport[port].tcan[can].nb_try = 0; tport[port].tcan[can].timeout = time (NULL) + 120L; return (strlen (buffer)); } break; } if (ok == 0) { pop_send(port, can, "-ERR invalid usercode or password, please try later\r\n"); close (tport[port].tcan[can].sock); tport[port].tcan[can].sock = -1; } return 0; } static int pop_cmd_apop (int port, int can, char *buffer) { int ok = 0; char *ptr = buffer + 4; char *callsign; int addr_len; struct sockaddr_in *address; struct sockaddr_in sock_addr; while (isspace(*ptr)) ++ptr; callsign = ptr; while (*ptr && !isspace(*ptr)) ++ptr; if (*ptr == '\0') { pop_send(port, can, "-ERR password missing\r\n"); close (tport[port].tcan[can].sock); tport[port].tcan[can].sock = -1; return 0; } *ptr++ = '\0'; while (isspace(*ptr)) ++ptr; addr_len = sizeof (sock_addr); if ((getpeername(tport[port].tcan[can].sock, (struct sockaddr *)&sock_addr, &addr_len) == 0) && (sock_addr.sin_family == AF_INET)) address = &sock_addr; else address = NULL; // Check login switch (pop_check_call (port, can, callsign, address)) { case 1: // Check password if (pop_check_md5 (port, can, ptr)) { sprintf (buffer, "(%d) CONNECTED to %s-%d", can, tport[port].tcan[can].callsign.call, tport[port].tcan[can].callsign.num); tport[port].tcan[can].state = POP_TRANS; tport[port].tcan[can].nb_try = 0; tport[port].tcan[can].timeout = time (NULL) + 120L; return (strlen (buffer)); } break; } if (ok == 0) { pop_send(port, can, "-ERR invalid usercode or password, please try later\r\n"); close (tport[port].tcan[can].sock); tport[port].tcan[can].sock = -1; } return 0; } static int pop_cmd_last (int port, int can, char *buffer) { int i, max = 0; for (i = 0 ; i < tport[port].tcan[can].mess_nb ; i++) if (tport[port].tcan[can].mess[i].mess_del == 0) if (tport[port].tcan[can].mess[i].mess_stat != 'N') max = i+1; pop_send(port, can, "+OK %d\r\n", max); return 0; } static int pop_cmd_dele (int port, int can, char *buffer) { char *ptr = buffer + 4; while (isspace(*ptr)) ++ptr; if (*ptr == '\0') { pop_send(port, can, "-ERR message number required (e.g. DELE 1)\r\n"); } else { int nb = atoi(ptr); if (nb < 1 || nb > tport[port].tcan[can].mess_nb) { pop_send(port, can, "-ERR invalid message; number out of range\r\n"); } else { tport[port].tcan[can].mess[nb-1].mess_del = 1; pop_send(port, can, "+OK message %d marked for deletion\r\n", nb); } } return 0; } static int pop_cmd_retr (int port, int can, char *buffer) { char *ptr = buffer + 4; while (isspace(*ptr)) ++ptr; if (*ptr == '\0') { pop_send(port, can, "-ERR message number required (e.g. TOP 1 7)\r\n"); } else { int nb = atoi(ptr); if (check_num (port, can, nb)) { char buf[80]; tport[port].tcan[can].nb_lines = -1; tport[port].tcan[can].mess_cur = nb-1; tport[port].tcan[can].cr = 1; tport[port].tcan[can].head = 1; pop_send(port, can, "+OK message %d (%ld bytes)\r\n", nb, tport[port].tcan[can].mess[nb-1].mess_size); tport[port].tcan[can].mess[nb-1].mess_stat = 'Y'; tport[port].tcan[can].state = POP_MSG; sprintf(buf, "R %ld\r", tport[port].tcan[can].mess[nb-1].mess_num); pop_to_bbs(port, can, buf, 1); } } return 0; } static int pop_cmd_rset (int port, int can, char *buffer) { int i ; for (i = 0 ; i < tport[port].tcan[can].mess_nb ; i++) tport[port].tcan[can].mess[i].mess_del = 0; pop_send(port, can, "+OK %d messages %ld bytes\r\n", tport[port].tcan[can].mess_nb, tport[port].tcan[can].mess_tot); return 0; } static int pop_cmd_top (int port, int can, char *buffer) { char *ptr = buffer + 3; while (isspace(*ptr)) ++ptr; if (*ptr == '\0') { pop_send(port, can, "-ERR message number and line count required (e.g. TOP 1 7)\r\n"); } else { int nb = atoi(ptr); while (!isspace(*ptr)) ++ptr; while (isspace(*ptr)) ++ptr; if (*ptr == '\0') { pop_send(port, can, "-ERR line count required (e.g. TOP 1 7)\r\n"); } else { int lines = atoi(ptr); if (check_num (port, can, nb)) { char buf[80]; tport[port].tcan[can].nb_lines = lines; tport[port].tcan[can].mess_cur = nb-1; tport[port].tcan[can].cr = 1; tport[port].tcan[can].head = 1; pop_send(port, can, "+OK message %d (%ld bytes)\r\n", nb, tport[port].tcan[can].mess[nb-1].mess_size); tport[port].tcan[can].mess[nb-1].mess_stat = 'Y'; tport[port].tcan[can].state = POP_MSG; sprintf(buf, "R %ld\r", tport[port].tcan[can].mess[nb-1].mess_num); pop_to_bbs(port, can, buf, 1); } } } return 0; } static int pop_cmd_stat (int port, int can, char *buffer) { pop_send(port, can, "+OK %d %ld\r\n", tport[port].tcan[can].mess_nb, tport[port].tcan[can].mess_tot); return 0; } static int pop_cmd_noop (int port, int can, char *buffer) { pop_send(port, can, "+OK\r\n"); return 0; } /* * SMTP commands processing ** */ static int smtp_reply(int port, int can, int next, int num, char *fmt, ...) { int nb; char buf[1024]; va_list argptr; if (tport[port].tcan[can].sock != -1) { va_start (argptr, fmt); nb = sprintf(buf, "%d%c", num, (next) ? '-' : ' '); vsprintf (buf+nb, fmt, argptr); va_end (argptr); strcat(buf, "\r\n"); write (tport[port].tcan[can].sock, buf, strlen (buf)); return 1; } return 0; } static int smtp_message(int port, int canal) { taddr_t *dest = tport[port].tcan[canal].rcpt_to; char *ptr; char str[256]; char *exped = tport[port].tcan[canal].mail_from->address; int ret = 1; ptr = strchr(exped, '@'); if (ptr) *ptr = '\0'; /* Send the message to all recipients of the list */ while (dest) { dbuf_t *buf; sprintf(str, "SP %s < %s\r", dest->address, exped); if (!pop_to_bbs(port, canal, str, 0)) { ret = 0; break; } buf = tport[port].tcan[canal].msgbuf; while (buf) { if (!pop_to_bbs(port, canal, buf->data, 0)) { ret = 0; break; } buf = buf->next; } if (ret == 0) break; dest = dest->next; } free_address(port, canal); free_msgbuf(port, canal); return ret; } static int add_to_msg(int port, int can, char *buffer) { int lg; dbuf_t *cur; cur = malloc(sizeof(dbuf_t)); if (cur == NULL) return 0; lg = strlen(buffer); cur->len = lg; cur->data = strdup(buffer); cur->next = NULL; if (1) ansi_to_ibm(cur->data, lg); if (tport[port].tcan[can].msgbuf) { dbuf_t *buf = tport[port].tcan[can].msgbuf; /* Append to last buffer */ while (buf->next) buf = buf->next; buf->next = cur; } else { tport[port].tcan[can].msgbuf = cur; } return 1; } static int smtp_rcv_dt(int port, int can, char *buffer, int len) { char *ptr = buffer; if (tport[port].tcan[can].sock == -1) return (FALSE); if (tport[port].tcan[can].state != SMTP_MSG) return TRUE; /* Main message */ if (*ptr == '.') { if (len == 1) { /* End of the message */ add_to_msg(port, can, "/EX\r"); tport[port].tcan[can].state = SMTP_TRANS; if (smtp_message(port, can)) smtp_reply(port, can, 0, 250, "Message accepted"); else smtp_reply(port, can, 0, 552, "Message failed"); return 1; } if (ptr[1] == '.') ++ptr; } if (tport[port].tcan[can].head) { /* Read the headers */ if (len == 0) { char str[256]; taddr_t *dest, *extra; extra = tport[port].tcan[can].content; if (extra) { while (extra) { sprintf(str, "%s\r", extra->address); add_to_msg(port, can, str); extra = extra->next; } } else { sprintf(str, "From: %s\r", tport[port].tcan[can].mail_from->address); add_to_msg(port, can, str); dest = tport[port].tcan[can].rcpt_to; while (dest) { sprintf(str, "To: %s\r", dest->address); add_to_msg(port, can, str); dest = dest->next; } } /* End of headers */ tport[port].tcan[can].head = 0; add_to_msg(port, can, "\r"); } else if (tport[port].tcan[can].extra) { taddr_t *cur = tport[port].tcan[can].content; taddr_t *cont = malloc(sizeof(taddr_t)); cont->address = strdup(ptr); cont->next = NULL; if (cur) { /* Add the extra header to the end of list */ while (cur->next) cur = cur->next; cur->next = cont; } tport[port].tcan[can].extra = (ptr[strlen(ptr)-1] == ';'); } else if (strncmpi("content-type:", ptr, 13) == 0) { if (strstr(ptr, "multipart")) { taddr_t *cur = tport[port].tcan[can].content; taddr_t *cont = malloc(sizeof(taddr_t)); cont->address = strdup(ptr); cont->next = NULL; if (cur) { /* Add the extra header to the end of list */ while (cur->next) cur = cur->next; cur->next = cont; } else { tport[port].tcan[can].content = cont; } tport[port].tcan[can].extra = (ptr[strlen(ptr)-1] == ';'); } } else if (strncmpi("subject:", ptr, 8) == 0) { /* Add the title */ ptr += 8; while (isspace (*ptr)) ++ptr; strcat(ptr, "\r"); add_to_msg(port, can, ptr); } return 1; } strcat(ptr, "\r"); add_to_msg(port, can, ptr); return 1; } static char *get_address(char *ptr) { static char add[41]; char *end, *ptr_tmp; ptr_tmp = strchr(ptr, '<'); if (ptr_tmp) { ptr = ptr_tmp+1; end = strchr(ptr, '>'); if (end) *end = '\0'; else return NULL; } /* If address does not match '"nickname" ', takes all chars*/ else { /* Consistency check */ end = strchr(ptr, '>'); if (end) return NULL ; } /**** SHOULD BE CONFIGURABLE (BEGIN) ****/ /* Translate address like f6fbb%f6fbb.fmlr.fra.eu@f6fbb.ampr.org */ end = strchr(ptr, '%'); if (end) { *end = '@'; end = strchr(end+1, '@'); if (end) *end = '\0'; } /**** SHOULD BE CONFIGURABLE (END) ****/ /* copy and upcase */ strn_cpy(sizeof(add)-1, add, ptr); return add; } static int smtp_cmd_ehlo(int port, int can, char *buffer) { char line[80]; smtp_reply(port, can, 1, 250, "%s", mypath); strcpy(line, "AUTH"); if (tport[port].smtp_auth & SMTP_AUTH_LOGIN) strcat(line, " LOGIN"); if (tport[port].smtp_auth & SMTP_AUTH_PLAIN) strcat(line, " PLAIN"); if (tport[port].smtp_auth & SMTP_AUTH_CRMD5) strcat(line, " CRAM-MD5"); smtp_reply(port, can, 0, 250, line); sprintf (buffer, "(%d) CONNECTED to %s", can, mycall); tport[port].tcan[can].state = SMTP_TRANS; tport[port].tcan[can].nb_try = 0; tport[port].tcan[can].timeout = time (NULL) + 120L; if (tport[port].smtp_auth & SMTP_AUTH_NO) { /* No authentication needed */ tport[port].tcan[can].auth_ok = 1; } return (strlen (buffer)); } static int smtp_cmd_auth(int port, int can, char *buffer) { char *pstr; char *ptr = buffer + 4; if (tport[port].tcan[can].auth_ok == 2) { smtp_reply(port, can, 0, 503, "Authentication already done !"); return 0; } while (isspace(*ptr)) ++ptr; if ((tport[port].smtp_auth & SMTP_AUTH_LOGIN) && (strncmpi(ptr, "LOGIN", 5) == 0)) { ptr += 5; while (isspace(*ptr)) ++ptr; if (*ptr) { /* Login name on the same line */ strn_cpy(6, tport[port].tcan[can].callsign.call, base64_to_str(ptr)); smtp_reply(port, can, 0, 334, "%s", str_to_base64("Password:")); tport[port].tcan[can].state = SMTP_PASS; } else { /* Ask for login name */ smtp_reply(port, can, 0, 334, "%s", str_to_base64("Username:")); tport[port].tcan[can].state = SMTP_USER; } tport[port].tcan[can].nb_try = 0; tport[port].tcan[can].timeout = time (NULL) + 120L; } else if ((tport[port].smtp_auth & SMTP_AUTH_PLAIN) && (strncmpi(ptr, "PLAIN", 5) == 0)) { ptr += 5; while (isspace(*ptr)) ++ptr; /* Login name and password on the same line */ pstr = base64_to_str(ptr); if (*pstr == '\0') ++pstr; strn_cpy(6, tport[port].tcan[can].callsign.call, pstr); pstr += strlen(pstr)+1; smtp_cmd_pass(port, can, pstr, 0); } else if ((tport[port].smtp_auth & SMTP_AUTH_CRMD5) && (strncmpi(ptr, "CRAM-MD5", 5) == 0)) { sprintf (tport[port].tcan[can].md5string, "<%d.%ld@%s>", getpid(), time(NULL), mypath); smtp_reply(port, can, 0, 334, "%s", str_to_base64(tport[port].tcan[can].md5string)); tport[port].tcan[can].state = SMTP_MD5; } else { smtp_reply(port, can, 0, 502, "Unrecognized authentification type."); return 0; } return 0; } static int smtp_cmd_user(int port, int can, char *buffer) { char *ptr = buffer; while (isspace(*ptr)) ++ptr; strn_cpy(6, tport[port].tcan[can].callsign.call, base64_to_str(ptr)); smtp_reply(port, can, 0, 334, "%s", str_to_base64("Password:")); tport[port].tcan[can].state = SMTP_PASS; return 0; } static int smtp_cmd_md5(int port, int can, char *buffer) { char *callsign; char *ptr = buffer; int addr_len; struct sockaddr_in *address; struct sockaddr_in sock_addr; while (isspace(*ptr)) ++ptr; addr_len = sizeof (sock_addr); if ((getpeername(tport[port].tcan[can].sock, (struct sockaddr *)&sock_addr, &addr_len) == 0) && (sock_addr.sin_family == AF_INET)) address = &sock_addr; else address = NULL; ptr = base64_to_str(ptr); callsign = ptr; while (*ptr && !isspace(*ptr)) ++ptr; if (*ptr == '\0') { smtp_reply(port, can, 0, 501, "Authentication error."); close (tport[port].tcan[can].sock); tport[port].tcan[can].sock = -1; return 0; } *ptr++ = '\0'; while (isspace(*ptr)) ++ptr; strn_cpy(6, tport[port].tcan[can].callsign.call, callsign); switch (pop_check_call (port, can, tport[port].tcan[can].callsign.call, address)) { case 1: // Check password if (pop_check_md5 (port, can, ptr)) { tport[port].tcan[can].state = SMTP_TRANS; smtp_reply(port, can, 0, 235, "Authentication successful."); tport[port].tcan[can].nb_try = 0; tport[port].tcan[can].timeout = time (NULL) + 120L; tport[port].tcan[can].auth_ok = 2; return 0; } break; } smtp_reply(port, can, 0, 501, "Authentication error."); close (tport[port].tcan[can].sock); tport[port].tcan[can].sock = -1; return 0; } static int smtp_cmd_pass(int port, int can, char *buffer, int base64) { char *ptr = buffer; int addr_len; struct sockaddr_in *address; struct sockaddr_in sock_addr; while (isspace(*ptr)) ++ptr; addr_len = sizeof (sock_addr); if ((getpeername(tport[port].tcan[can].sock, (struct sockaddr *)&sock_addr, &addr_len) == 0) && (sock_addr.sin_family == AF_INET)) address = &sock_addr; else address = NULL; if (base64) ptr = base64_to_str(ptr); switch (pop_check_call (port, can, tport[port].tcan[can].callsign.call, address)) { case 1: // Check password if (pop_check_pass (port, can, ptr)) { tport[port].tcan[can].state = SMTP_TRANS; smtp_reply(port, can, 0, 235, "Authentication successful."); tport[port].tcan[can].nb_try = 0; tport[port].tcan[can].timeout = time (NULL) + 120L; tport[port].tcan[can].auth_ok = 2; return 0; } break; } smtp_reply(port, can, 0, 501, "Authentication error."); close (tport[port].tcan[can].sock); tport[port].tcan[can].sock = -1; return 0; } static int smtp_cmd_helo(int port, int can, char *buffer) { smtp_reply(port, can, 0, 250, "%s", mypath); sprintf (buffer, "(%d) CONNECTED to %s", can, mycall); tport[port].tcan[can].state = SMTP_TRANS; tport[port].tcan[can].nb_try = 0; tport[port].tcan[can].timeout = time (NULL) + 120L; if (tport[port].smtp_auth & SMTP_AUTH_NO) { /* No authentication needed */ tport[port].tcan[can].auth_ok = 1; } return (strlen (buffer)); } static int smtp_cmd_quit(int port, int can, char *buffer) { smtp_reply(port, can, 0, 221, "Bye!"); if (tport[port].tcan[can].state != SMTP_START) { pop_to_bbs(port, can, "B\r", 0); } else { close (tport[port].tcan[can].sock); tport[port].tcan[can].sock = -1; } return 0; } static int smtp_cmd_mail(int port, int can, char *buffer) { char *ptr = buffer + 10; if (!tport[port].tcan[can].auth_ok) { smtp_reply(port, can, 0, 503, "Authentication required !"); return 0; } if (tport[port].tcan[can].mail_from) { smtp_reply(port, can, 0, 503, "Duplicate MAIL FROM:"); return 0; } while (isspace(*ptr)) ++ptr; ptr = get_address(ptr); if (ptr) { taddr_t *mailfrom = calloc(sizeof(taddr_t), 1); mailfrom->address = strdup(ptr); mailfrom->next = tport[port].tcan[can].mail_from; tport[port].tcan[can].mail_from = mailfrom; smtp_reply(port, can, 0, 250, "OK"); } else { smtp_reply(port, can, 0, 501, "Error : MAIL FROM:
"); } return 0; } static int smtp_cmd_rcpt(int port, int can, char *buffer) { char *ptr = buffer + 8; if (!tport[port].tcan[can].auth_ok) { smtp_reply(port, can, 0, 503, "Authentication required !"); return 0; } if (!tport[port].tcan[can].mail_from) { smtp_reply(port, can, 0, 513, "Missing MAIL FROM:"); return 0; } while (isspace(*ptr)) ++ptr; ptr = get_address(ptr); if (ptr) { taddr_t *cur = tport[port].tcan[can].rcpt_to; taddr_t *rcptto = malloc(sizeof(taddr_t)); rcptto->address = strdup(ptr); rcptto->next = NULL; if (cur) { /* Add the recipient to the end of list */ while (cur->next) cur = cur->next; cur->next = rcptto; } else { tport[port].tcan[can].rcpt_to = rcptto; } smtp_reply(port, can, 0, 250, "OK"); } else { smtp_reply(port, can, 0, 501, "Error : RCPT TP:
"); } return 0; } static int smtp_cmd_noop(int port, int can, char *buffer) { smtp_reply(port, can, 0, 250, "OK"); return 0; } static int smtp_cmd_rset(int port, int can, char *buffer) { free_address(port, can); smtp_reply(port, can, 0, 250, "OK"); return 0; } static int smtp_cmd_data(int port, int can, char *buffer) { if (!tport[port].tcan[can].auth_ok) { smtp_reply(port, can, 0, 503, "Authentication required !"); return 0; } if (!tport[port].tcan[can].rcpt_to) smtp_reply(port, can, 0, 513, "Missing RCPT TO:"); else { tport[port].tcan[can].head = 1; tport[port].tcan[can].state = SMTP_MSG; smtp_reply(port, can, 0, 354, "End with ."); } return 0; } static int smtp_cmd_vrfy(int port, int can, char *buffer) { char *ptr = buffer + 4; if (!tport[port].tcan[can].auth_ok) { smtp_reply(port, can, 0, 503, "Authentication required !"); return 0; } while (isspace(*ptr)) ++ptr; smtp_reply(port, can, 0, 252, "Cannot VRFY %s", ptr); return 0; } /* * NNTP commands processing ** */ /* Get a bulletin */ static int nntp_bull(int port, int can, int mode, char *str) { char buf[80]; tport[port].tcan[can].nb_lines = mode; tport[port].tcan[can].cr = 1; tport[port].tcan[can].head = 1; if (mode == 3) tport[port].tcan[can].state = NNTP_LINE; else tport[port].tcan[can].state = NNTP_MSG; sprintf(buf, "TH R %d %s\r", mode, str); pop_to_bbs(port, can, buf, 1); return 0; } static int nntp_cmd_quit(int port, int can, char *buffer) { /* Received "QUIT" : disconnect */ pop_send(port, can, "205 NNTP Server shutdown.\r\n", mycall); if (tport[port].tcan[can].state != NNTP_USER) { pop_to_bbs(port, can, "B\r", 0); } else { close (tport[port].tcan[can].sock); tport[port].tcan[can].sock = -1; } return 0; } static int nntp_cmd_group(int port, int can, char *buffer) { char buf[80]; char *ptr = buffer + 5; /* smtp_reply(port, can, 0, 480, "Authentivation required"); return 0; */ while (isspace(*ptr)) ++ptr; if (*ptr == '\0') { pop_send(port, can, "411 Group name missing\r\n"); return 0; } sprintf(buf, "TH G %s\r", ptr); pop_to_bbs(port, can, buf, 1); tport[port].tcan[can].state = NNTP_LINE; tport[port].tcan[can].nb_try = 0; tport[port].tcan[can].timeout = time (NULL) + 120L; return 0; } static int nntp_cmd_list(int port, int can, char *buffer) { char *ptr = buffer + 4; while (isspace(*ptr)) ++ptr; if (strcmpi(ptr, "NEWSGROUP") == 0) { char name[80]; smtp_reply(port, can, 0, 215, "List of groups information"); ptr = first_group(); while (ptr) { sscanf(ptr, "%s", name); pop_send(port, can, "%s %s\r\n", name, name); ptr = next_group(); } } else { smtp_reply(port, can, 0, 215, "List of groups"); ptr = first_group(); while (ptr) { pop_send(port, can, "%s\r\n", ptr); ptr = next_group(); } } pop_send(port, can, ".\r\n"); return 0; } static int nntp_cmd_stat(int port, int can, char *buffer) { char *ptr = buffer + 4; while (isspace(*ptr)) ++ptr; nntp_bull(port, can, 3, ptr); return 0; } static int nntp_cmd_head(int port, int can, char *buffer) { char *ptr = buffer + 4; while (isspace(*ptr)) ++ptr; nntp_bull(port, can, 1, ptr); return 0; } static int nntp_cmd_body(int port, int can, char *buffer) { char *ptr = buffer + 4; while (isspace(*ptr)) ++ptr; nntp_bull(port, can, 2, ptr); return 0; } static int nntp_cmd_next(int port, int can, char *buffer) { char buf[80]; sprintf(buf, "TH N\r"); pop_to_bbs(port, can, buf, 1); tport[port].tcan[can].state = NNTP_LINE; tport[port].tcan[can].nb_try = 0; tport[port].tcan[can].timeout = time (NULL) + 120L; return 0; } static int nntp_cmd_post(int port, int can, char *buffer) { smtp_reply(port, can, 0, 440, "Posting not allowed"); return 0; } static int nntp_cmd_article(int port, int can, char *buffer) { char *ptr = buffer + 7; while (isspace(*ptr)) ++ptr; nntp_bull(port, can, 0, ptr); return 0; } static int nntp_cmd_help(int port, int can, char *buffer) { pop_send(port, can, "100 Help text follows\r\n"); pop_send(port, can, "Commands : \r\n"); pop_send(port, can, "ARTICLE BODY GROUP HEAD\r\n"); pop_send(port, can, "HELP IHAVE LAST LIST\r\n"); pop_send(port, can, "NEWGROUPS NEWNEWS NEXT POST\r\n"); pop_send(port, can, "QUIT SLAVE STAT\r\n"); pop_send(port, can, ".\r\n"); return 0; } static int nntp_cmd_ihave(int port, int can, char *buffer) { pop_send(port, can, "437 Posting not allowed\r\n"); return 0; } static int nntp_cmd_last(int port, int can, char *buffer) { char buf[80]; sprintf(buf, "TH P\r"); pop_to_bbs(port, can, buf, 1); tport[port].tcan[can].state = NNTP_LINE; tport[port].tcan[can].nb_try = 0; tport[port].tcan[can].timeout = time (NULL) + 120L; return 0; } static int nntp_cmd_xhdr(int port, int can, char *buffer) { char buf[80]; char *ptr = buffer + 4; while (isspace(*ptr)) ++ptr; sprintf(buf, "TH H %s\r", ptr); pop_to_bbs(port, can, buf, 1); tport[port].tcan[can].state = NNTP_MSG; tport[port].tcan[can].nb_try = 0; tport[port].tcan[can].timeout = time (NULL) + 120L; return 0; } static int nntp_cmd_xover(int port, int can, char *buffer) { char buf[80]; char *ptr = buffer + 5; while (isspace(*ptr)) ++ptr; sprintf(buf, "TH O %s\r", ptr); pop_to_bbs(port, can, buf, 1); tport[port].tcan[can].state = NNTP_MSG; tport[port].tcan[can].nb_try = 0; tport[port].tcan[can].timeout = time (NULL) + 120L; return 0; } static int twodig(char *ptr) { int val; val = (ptr[0] -'0') * 10; val += (ptr[1] -'0'); return val; } static int nntp_cmd_newgroups(int port, int can, char *buffer) { int val; struct tm t; time_t temps; char *ptr = buffer + 9; while (isspace(*ptr)) ++ptr; temps = time(NULL); if (strlen(ptr) >= 13) { /* Get time information */ t = *(localtime(&temps)); /* Get year */ val = twodig(ptr); ptr += 2; if (val < 90) val += 100; t.tm_year = val; /* Get month */ val = twodig(ptr); ptr += 2; t.tm_mon = val - 1; /* Get day */ val = twodig(ptr); ptr += 2; t.tm_mday = val; while (isspace(*ptr)) ++ptr; /* Get hour */ val = twodig(ptr); ptr += 2; t.tm_hour = val; /* Get min */ val = twodig(ptr); ptr += 2; t.tm_min = val; /* Get sec */ val = twodig(ptr); ptr += 2; t.tm_sec = val; /* Set time */ temps = mktime(&t); } pop_send(port, can, "231 New groups follow\r\n"); pop_send(port, can, "%s", check_dates(temps)); return 0; } static int nntp_cmd_newnews(int port, int can, char *buffer) { pop_send(port, can, "500 Unknown command\r\n"); return 0; } static int nntp_cmd_slave(int port, int can, char *buffer) { pop_send(port, can, "202 Slave status ignored\r\n"); return 0; } static int nntp_cmd_mode(int port, int can, char *buffer) { char *ptr = buffer + 4; while (isspace(*ptr)) ++ptr; if (strcmpi(ptr, "READER") == 0) pop_send(port, can, "201 Posting not allowed\r\n"); else pop_send(port, can, "500 Unknown command\r\n"); return 0; } /* Base 64 routines */ /* * Table for encoding base64 static char to_64[64] = { 33,34,35,36, 37,38,39,40, 41,42,43,44, 45,46,47,48, 49,50,51,52, 53,54,55,56, 57,58,65,66, 67,68,69,70, 71,72,73,74, 75,76,77,78, 79,80,81,82, 83,84,85,86, 87,88,89,90, 48,49,50,51, 52,53,54,55, 56,57,43,47, }; */ static char to_64[64] = { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99,100,101,102, 103,104,105,106, 107,108,109,110, 111,112,113,114, 115,116,117,118, 119,120,121,122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, }; #define B64(ch) (to_64[(unsigned char)((ch) & 0x3f)]) /* * Table for decoding base64 */ static char fm_64[256] = { 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255, 62, 255,255,255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,255,255, 255,255,255,255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,255, 255,255,255,255, 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255, }; #define C64(ch) (fm_64[(unsigned char)(ch)]) static char *str_to_base64(char *str) { int ch1, ch2, ch3; static char buf[256]; char *ptr = buf; while (*str) { ch1 = *str++; *ptr++ = B64(ch1 >> 2); ch2 = *str++; *ptr++ = B64(ch1 << 4 | ch2 >> 4); if (ch2 == '\0') break; ch3 = *str++; *ptr++ = B64(ch2 << 2 | ch3 >> 6); *ptr++ = B64(ch3 & 0x7f); if (ch3 == '\0') break; } *ptr++ = '='; *ptr++ = '\0'; return buf; } static char *base64_to_str(char *str) { int ch1, ch2, ch3, ch4; char *ptr = str; char *buf = str; while (*str) { ch1 = *str++; if (C64(ch1) == 255) continue; do { if (*str) ch2 = *str++; else ch2 = 255; } while (ch2 != 255 && ch2 != '=' && C64(ch2) == 255); do { if (*str) ch3 = *str++; else ch3 = 255; } while (ch3 != 255 && ch3 != '=' && C64(ch3) == 255); do { if (*str) ch4 = *str++; else ch4 = 255; } while (ch4 != 255 && ch4 != '=' && C64(ch4) == 255); if (ch1 == '=' || ch2 == '=') break; ch1 = C64(ch1); ch2 = C64(ch2); *ptr++ = (((ch1 & 0xff) << 2) | ((ch2 & 0x30) >> 4 )); if (ch3 == '=') break; ch3 = C64(ch3); *ptr++ = (((ch2 & 0x0f) << 4) | ((ch3 & 0x3c) >> 2)); if (ch4 == '=') break; ch4 = C64(ch4); *ptr++ = (((ch3 & 0x03) << 6) | (ch4 & 0xff)); } *ptr = '\0'; return buf; } fbb-7.04j/src/ERROR.SYS0100644000175100017510000000024107726646105012474 0ustar abaaba> EXCEPTION : Station , Ch:0 (0-0-0) 16/12/01 10:02 Version 7.04b (Sep 20 2001) /etc/ax25/fbb/port.sys 90, errno 2=No such file or directory Syntax error fbb-7.04j/src/README.txt0100644000175100017510000000373307726647263012720 0ustar abaaba These are the sources of xfbbd (daemon version for LINUX) and their utilities. 1/ Compiling xfbbd and its utilities : -------------------------------------- - goto fbbsrc/src directory - update the variables at the beginning of both Makefile, depending of your configuration. This must point to the ax25-utils include and librairies. Be sure to use at least the version 2.1.37b of ax25-utils. Example: AX25LIBPATH = /usr/src/ax25/lib AX25INCPATH = /usr/src/ax25/lib - run "make" This will create the following executables : xfbbd fbbgetconf epurmess epurwp reqdir clr_user maintinf xfbbC 2/ Compiling the xfbbX client : ------------------------------- - this is only possible if you have a version of Motif installed. - in Makefile uncomment the line : all : client xfbbX_cl - run "make", this will build a xfbbX_cl binary. - xfbbX is a shell script which creates the resource file and runs xfbbX_cl. - If you don't have Motif, xfbbX cannot be compiled. 3/ Fixes and evolutions : ------------------------- Please, do not create new versions of code, this will make us impossible to maintain and know what is the current version. Instead help us to develop the code and fix the bugs. All fixes and evolutions will be welcome. Please again, do not delete the copyright and author headers in the files. If you didn't already it, subscribe to the xfbb mailing list by sending a email to majordomo@f6fbb.org without title and with "subscribe xfbb" as the first line of text. Then you will be able to send you fix, evolutions proposals and remarks to the mailing list. 4/ xfbbd exit values : ---------------------- 0 : Error (configuration...) 1 : Sigterm received 2 : re-run (no housekeeping) 3 : housekeeping 4 : Software stop 5 : Segv or BusError 6 : System Reboot asked 5/ Good luck with "fbb"... -------------------------- Jean-Paul ROUBELAT jpr@f6fbb.org 6 rue George Sand 31120 ROQUETTES - France fbb-7.04j/CHANGES0100755000175100017510000007023307726653524011425 0ustar abaaba FBB BBS SOFTWARE IS TEN YEARS OLD !! THE VERSION C64 SHOULD BE DISTRIBUTED AS AN "EVALUATION VERSION 7.00" ===================================================================== Unfortunately, the doc is not ready for this version but I think that it is not a too big problem for an evaluation version. I prepare the distribution diskette and will give a copy first to the beta test sites to be sure that the automatic installation works ok, and that the code inside is the right one. w700a - Problems with CR orCR/LF in export and log. Corrected. - TimeOut did not work 100%. Corrected. - GPF in review if list was empty. Corrected. - Disks like D:\ were not accepted in FbbDOS. Corrected. - Command NEW in FbbDOS did not give the prompt if no file. Corrected. - F8 was programmed as F9. Should give the focus to the main window. Corrected. - Any command beginning by T was accepted. Corrected. - Send message in console could destoy the contents of the editor. If the editor is busy, normal line editing is used. - Read was always verbose when reviewing messages. Corrected. - Command W in FORWARD.SYS allows to skip one or more prompts (default one) before starting a forward session (mainly used when "Linked to ..." gives more than one prompt) - EPURMESS.COM did not limit the number of lines returned to sender in any cases. Corrected. - The generation of WP messages has been rewritten to correct the problem found on many BBS (but unfortunately not on mine !!). w700b - Histograms did not work without callsign in statistics. Corrected. - WFBB crashes if the MESS.WP file has a size of 0. Corrected. - Command SYS did not work for callsigns defined in PASSWD.SYS. Corrected. - F7=Programmation of the TNC is now implemented in DED mode. b2 - Only Sysops allowed to review will receive the "Nb of held" message. - PK232 host mode introduced again. - Variable %C gives the number of times a message has been read. - DLL buffer for PG programs is increased to 32K - INSTWFBB : PMS option added in the first connection mask - INSTWFBB : PK232 option in the supported protocoles b3 - GPF if using socket from gateway. Corrected. - The default 3 strings for NetRom/TheNet are now : CONNECTED FAILURE BUSY - TELNET interface has been improved. Do not forget to put address 17 in PORT.SYS for TELNET (means socket port 23 in decimal) - File FBB\SYSTEM\LANG\TELNET.ENT may held the banner for the telnet access. - The format of the window has changed. You must delete the line "position" in the part "main" of the file WINDOWS\WINFBB.INI before running the new version. b4 - Edit-User and Edit-Msg are no longer closed with the OK button. - Telnet interface is working as modem interface except that password is mandatory. - Debug informations for VE4KV's modem GPFs (debug info in DEBUG.BUG file). b5 - Servers can be made as DLL provided they are fast enough (no multitasking during a DLL activity). - Task was not run in background if more than one application in CRON.SYS. - Swapping was not done after a local re-routing. Corrected. b6 - Selection of zone in the channel windows. Accept copy (=Ctrl Ins) to clipboard and print. Menu is activated with the right button of the mouse inside the text window. b7 - ListBox of connections has been fully rewritten to be more efficient. A menu is available in the list with the right button of the mouse. b8 - PG called in a non-registered access gave a 23MB inf.sys. Corrected. - L command in review did not unvalidate forwarding after reboot. Corrected. - Command HO puts a message in the hold list. b9 - selection of a word (left double click) or a list of characters (Ctrl left double click). - INIT.SRV was not scanned after a modification from "main parameters" window. - Protocoles TFPCX and DRSI added in the configuration. - HO command did not delete held message. Corrected. - some optimisations and minor modifications... b10 - Import/Export display in options menu. - Filter and substring in "last connections" window. - Hang if the MESS.WP file is exactly 5000 bytes long. Corrected. - in PORT.SYS, interface 9 (linux) has been added. LINUX can work via a serial port (letter D for DED) or via AX25 domain socket (letter X). b12 - Problems with affectation of ports and channels in BPQ driver. Should be corrected. - Problem with the colors in the DOS version. Corrected. b13 - S line (choices of forward) now checks default as a last choice. Up to four previous choices ar checked as declared before. Warning, these tests are case independant. - This was maybe undocumented : value after "use compressed forwarding" give the options between compressed protocoles : 1 = FBB compressed forwarding 2 = XFWD compressed forwarding "OK 3" allow both FBB and XFWD. - MODEM.ENT was sent without line feed at the first connection. Corrected. - Command "?" gave a segmentation violation on the Linux version. Corrected. b14 - One more color bug corrected ! - variable %E give the version code (Linux, Dos, Windows). - debug.bug traces the current channels if "no more channel available" - "Last connections" window was not created in Windows version. Corrected. b15 - hold counter was not initialized in dos version. Corrected. - Dialog window asks for import BBS in Windows and Linux versions. - Reject was not always done when importing files. b16 - Built-in editor validated (Linux version). - Texts of menues corrected (Windows version). - Connections were not recorded in the LOG. Corrected. - PMS connections asked for FBB protocole. I have made a change, but did not test it. b17 - management of C_FILTER has changed. Will be always called if it exists. - Edit forward window (in edit message) now available in Linux version. - Filter on callsigns (in last connections) now available in Linux version. b18 - ReadOnly access if there is no password defined (modem/telnet) b19 - Connect line is case dependant. - Binary transfer implemented for telnet (with this version and up) - Some bug fixes in the Windows telnet interface. - Help was sometime crashing in linux version. Fixed. - New xfbbd version : xfbb daemon for linux. b20 - Flag F (PMS Forwarding) added in EU command. - TH list sometime gave wrong numbers. Corrected. b22 - Linux. Connection bip was disabling the X11 bell. Corrected. b23 - ReadOnly mode was not 100%ok in xfbb. Corrected. - No CrLf when first connecting xfbb on telnet. Corrected. b24 - Labels management of FBBDOS have been rewritten. Path is no longer absolute but relative to the FBBDOS disks defined in INIT.SRV. TLABEL.COM program is no longer required. The format of the file is changed from YAPPLBL.SYS to YAPPLBL.DAT using MODLABEL.EXE program. Labels are compatible with DOS, Windows and LINUX version. - Linux version : YI and YW command gave 0 bytes free. Corrected. b25 - Possible corruption of INF.SYS in Linux version under Telnet. A change has been done. - Get a Crc error when re-starting a FBB compressed forwarding session (XFBB). Corrected. - Error in the "From" field when receiving mail from RLIBBS in XFWD mode. Corrected. b27 - PortName in LINUX was often wrong. Corrected - Epurmess did not count empty lines of INIT.SRV (Linux). Corrected. - = allowed to send data even if the remote station was busy. Corrected. - Checksum of AUTOBIN was wrong under LINUX. Corrected. - WHERE and DU did not work on LINUX partitions. Corrected. - Channel names could not start whith a digit in PORT.SYS. Should be corrected. - SIGSEGV was caught in LINUX version. Corrected. - VIEW command of LINUX version calls fbb_view program. (or any program defined by the variable $FBB_VIEW). fbb_view may be a shell script. - Telnet time-out is increased to 2mn (LINUX) - /A command stops the BBS and exit with value 4 b28 - List of flags of the [FBB forwarding line] (INIT.SRV) 1 : A space is mandatory before the @ in a send message command 2 : The length of the fields of a hierarchical address is not tested to be 6 characters 4 : The header line of a message is not truncated to the space before the 79th character 8 : Header MBL/RLI 16 : If there is no BBS field, the callsign of the BBS is sent to the PMS 32 : Deletes the DATA messages sent to SYSOP 64 : Don't use the BID recovered from headers and use a new one 128: Accepts forwarding only from pre-declared BBS 256: WP Messages are not held. 512: XForwarding protocole has priority on FBB protocole. 1024: Generation of an alternate BID like F6FBB-12345 (for dual BBS site) 2048: Checksum unvalidated on XFwd. 4096: Test of callsign is more simple. - DosFBB has a problem with the call and F10 command. Corrected. b31 - WIN - /A gives a GPF. Corrected. - DOS - Optimisations in Mini-Editor. Was crashing while loading a large file. corrected. - DOS - ZModem transfer initialisation was wrong. Corrected. - DOS - Commande DOS without argument crashes. Corrected. - DOS - Some characters were lost in modem. Coorected. b32 - ALL - If port.sys does not exist, FBB looks for port_d.sys (dos), port_w.sys (windows) or port_l.sys (linux). This allows to have the same tree for all versions. b33 - LIN - Pacsat server : Some packets were lost. Corrected. b34 - WIN - NO LineFeed in the modem driver. Corrected. - ALL - MD2 password available for SYS command. b35 - LIN - Problem with LF and CRLF in messages. 1st correction. b36 - LIN - Segmentation violation on retry count exceeded. Corrected ? b37 - DOS - WINDOWS DLL (C_FILTER, M_FILTER, F_FILTER) Implementation. DLL must be in the path of DOS (FBB\BIN). - MD2 C_FILTER.DLL available for DOS and WIN MD2 C_FILTER available for LINUX. b38 - Password did not work for SYS command. Corrected. b39 - Mail import was getting all system processing. Corrected. b40 - DOS - AF5 and Esc closed the BBS. Corrected. - DOS - DLL of KE0W0 was not running. Disabling local interrupts during DLL call. b41 - WIN - Change in maintenance to avoid some crashes. (1st try). b42-b43 _ WIN - Corrections of multiple GPF b44 - ALL - xfwd had problems when forwarding RLIBBS. Fixed. b45 - ALL - Crashed when THEMES.SYS was empty. Corrected. Version 700b distributed c01 - DOS - Crashed when device not ready. Fixed - DOS - CR/CR/LF sequence when exporting mail to disk. Fixed. c02 - ALL - Crashed in REDIST server fixed. - DOS - TFPCX interface crashing at boot. Fixed. - DOS - Added TFPCX interrupt level in INIT.SRV : # DRSI and TFPC interrupt (Hexadecimal, default FF and FE) FF FE # # BBS-UP program (default empty) - DOS - Fwd line : Tried some modifications to fix the UPCASE callsign. c03 - ALL - Added lock files when importing and exporting mail (same filename, extension added or replaced = "lck") - W32 - TfWin32.DLL interface validated. c04 - ALL - Hierarchy is now managed in SWAPP.SYS - DOS - Resync counter did not work. Corrected. - WIN - File/Maintenance always gave the "STOP" icon. Corrected. - ALL - NEW now works in console. - ALL - UNKNOWN ROUTE and 10 times "routed to" message corrected. c05 - ALL - Variables were interpreted when xfwd sends the list of BID. Corrected. - ALL - Lock files deleted (if possible) if older than 1 hour. c06 - ALL - Alternate callsign of PORT.SYS was not working. Corrected. c07 - ALL - Title of message sometime greater than 60 characters. Corrected. - LIN - SP and others did not work from xfbbC. Corrected. - WIN - WP list of BBS was limited to 40 chars in instwfbb. Increased to 79. - ALL - S Line in forward.sys is case dependant. c08 - DOS - I Fxxx was crashing in Nomenclature. Corrected. - ALL - DF command added to list all PMS users. - DOS - /R was crashing. Corrected. - ALL - HomeBBS of a reviewed message was wrong in WP. Corrected. - WIN - No LF in modem after a forwarding session. Corrected. - WIN - GPF with BPQ in gateway in command mode. Corrected. - ALL - Conference allowed calling to TCP interface. Corrected. - ALL - Channel number was 1 more in log. Corrected. c09 - ALL - Added the date correction for > 1999 - ALL - WP was update with local BBS at first connection. Corrected. - WIN - Garbage characters in SERVERnn.IN. Corrected. c10 - ALL - Unproto were sent duplicated if more than one "!" line in BEACONn.SYS file. Corrected. - ALL - Message counter went negative when using "edit message". Corrected. - ALL - Implementation of "exit 5" for PG : Level is not incremented. - ALL - Number of held messages is re-calculated after CRON and PG - WIN - WFBB crashed when opening a non-existing file in editor. Corrected. - ALL - Channel number in conference was wrong. Corrected. Version 700c distributed d01 - ALL - JK gives a wrong channel number. Corrected. - WIN - Socket access : "." before the callsign removes pre-processing and post-processing (transparent mode). Version 700d distributed e01 - ALL - Sharing violation when importing a file. Corrected. - WIN - Socket interface rewritten - ALL - FB command was only printing P messages. Corrected. - W32 - Avail memory gave a wrong value. Corrected. - ALL - D (bin) status of 7+ mail was lost when "RE". Corrected. e02 - ALL - Problems with review command. Debugging version. e03 - LIN - Del User crashed in xfbb. Corrected. - LIN - TCPIP interface did not re-run without a pause. Corrected. e04 - W32 - PG dir has now changed to PG32 - ALL - Copied messages keep the original sender, So SR is now possible on copy (like SYSOP messages). - ALL - Review bug corrected! Thanks to F1HCI for help... e05 - W32 - Lock timeout was not 1 hour. Corrected. - WIN - Language was not ok after sending a message. Corrected. Version 700e distributed f01 - ALL - Disk size could be negative in big disks (>2GB). Corrected. - ALL - PASSWD.SYS now accepts comment lines - ALL - Global password did not work using MD2. Corrected. - ALL - Only CP SYSOP originator is changed, not the SC command. - ALL - When replying to a CP SYSOP message, title is changed back to original. f02 - ALL - Variable %e added. Date of the compilation (english only). - ALL - Time of connection was wrong in talk command. Corrected. - WIN - List of connections was not refresh at end of talk. Corrected. - ALL - Crash if "XFWD" validated and "FBB forwarding" not. Corrected. - ALL - Added commands for WP: IN substring -> Gives WP records including "substring" in Name IQ substring -> Gives WP records including "substring" in Qth - WIN - First watchdog implementation. Sends characters 0 and 1 each second to the port specified in INIT.SRV. This port must be free : # # Test mode / Watchdog (1->9 = COM1->COM9, 81->84 = LPT1->LPT4) NO 81 # - ALL - Support of the SCS/PCT-II pactor TNC TNC is in Extended/WA8DED emulation with a "H" character in port.sys : # #TNC NbCh Com MultCh Pacln Maxfr NbFwd MxBloc M/P-Fwd Mode Freq 0 0 0 0 0 0 0 0 00/01 ---- File-fwd. 1 1 1 0 250 4 1 10 30/60 HU Pactor 2 8 1 1 250 4 1 10 30/60 HUWY 1st Packet 3 8 1 2 250 4 1 10 30/60 HUWY 2nd Packet # - WIN32/LIN - Message was recompressed at each forward. Corrected. - ALL - Added cron_d, cron_w, cron_l.sys taken in priority for DOS, WINDOWS or LINUX system. If this one doesn't exist, cron.sys is taken instead. - LIN - Wrong callsigns were recorded in INF.SYS in telnet mode. Corrected. f03 - ALL - Added the PTC-II remote control from forward file. - ALL - Added the fequency-status information before connection - ALL - Added the PTCTRX built-in program to pilot the transceiver from PTC-II The parameters are the same that the TRX command of the PTC-II ex : " X PTCTRX SCAN 1 " will start scanning from forward file f04 - ALL - Changed BUSY to DISCONNECT when a frequency is busy. Allows multi-choices from the FORWARD.SYS file. f05 - ALL - More debugging of pactor mode f06 - WIN - Added the "Immediate disconnection" command. f07 f08 - WIN - Some more debugging in PACTOR interface f09 - WIN - L !TRX command was crashing when out of block. Corrected. - WIN - Packet ports of the PTC-II implemented. - WIN - Update of InstWfbb for PTC-II protocole f10 - WIN - Connection was still sent if aborting during wait phase. Corrected. - WIN - MAINT file did not work with PTC-II. Corrected. f11 - WIN - PTCTRX was not run from CRON.SYS. Corrected. - WIN - Display of long path callsign was wrong. Corrected. - ALL - Compilation of the f11 version on all architectures. f12 - WIN - Added a scanning control command. - ALL - Forced disconnection if not disconnected after 10 sec. f13 - ALL - New variable %k = Nb of KB to forward to the connected station %l = Nb of msg to forward to the connected station - ALL - Flag R (Read-Only) in port.sys available for any port. f14 - ALL - Added a "IF G hour" test in GMT time for FORWARD.SYS and CRON.SYS - WIN - Retry field in main window increased to 3 digits - WIN - ChangeOver button for pactor mode f15 - ALL - More debugging f16 - WIN32 - Size of NTFS disk was wrong. Corrected. f17 - f18 - ALL - More debugging f19 - Command line starting with a ";" is ignored - Speed information in the footer when sending in pactor mode - PTC-II is fully reset to work in binary mode. Think that all parameters will be erased in the TNC. f20 - New alternate files : INIT.SRV -> INIT_x.SRV FORWARD.SYS -> FORW_x.SYS PROTECT.SYS -> PROT_x.SYS f21 - New command line in CRON_x.SYS : M port U : Port nb is changed to USER mode M port B : Port nb is changed to BBS mode M port G : Port nb is changed to GUEST mode Version 700f distributed g01 - WIN - INIT.SRV is not found when reloaded from Config->MainParameters - ALL - PACTOR - Added F command in gateway for frequency selection. Added the gateway.sys file to configure the frequencies. This file accepts the following commands : IF / ELSE / ENDIF (for port and time) BEGIN : commands sent when entering the port of the gateway END : commands sent when leaving the port of the gateway FREQ : Affectation of a frequency / TNC command g02 - ALL - Gateway was crashing when all channels are busy. Corrected. g03 - ALL - ChangeOver was not sent from the gateway. Corrected. g04 - ALL - Added Minute/Period option in the "P" command line in CRON_x.SYS : M port U 10/20 : Port nb is changed to USER mode and min/per to 10/20 - ALL - CRON file accept the litteral port definitions of PORT.SYS. Ex : M PACTOR U 10/20 - ALL - The callsign of the pactor channel was lost in the gateway. Corrected. g05 - ALL - Implementation of the CQ command of the gateway for pactor. g06 - ALL - Bug in the gateway made it crashing when no port was selected. - LIN - xfbbC and client interface of xfbbd fully rewritten. - LIN - maintinf has been compiled g07 - LIN - Added monitoring options in xfbbC g08 - LIN - Added MD2 authentication in xfbbC g09 - ALL - Default password allowed in MD2 authentication. g10 - LIN - Added new services for xfbbd client (xfbbC). Source code and makefile of xfbbC supplied. g11-g16 - LIN - Evolutions of the PTC-II hostmode g17 - WIN - Added the Flex95 support in WinFBB32 g18 - WIN32 - New FBBIOS32.DLL for WIN32 modem interface - WIN32 - Console callsign did not work in Flex mode - Done. g19 - ALL - Security problem with files owner under FBBDOS corrected. g20 - LIN - Added the TCP address and port for telnet access in port.sys. #Com Interface Adresse(Hex) Vitesse/Tcp-Port 8 9 44.151.31.6 1022 - LIN - External set of commands added (or replacing) the default set. These commands are defined in system/commands.sys. Ex : # # commands.sys file # format : fbb_command external_command parameters ... # TX cat /etc/ax25/axports FPAC /usr/sbin/fpacnode TELNET telnet g21 - LIN - Daemon version now allows the T (talk) command. Must be answered with either xfbbC or xfbbX. New versions of xfbbC et xfbbX. g22 - LIN - Filenames in F_FILTER file are now in UNIX format. g23 - LIN - Source code of the daemon version is released g24 - LIN - Compilation with libc6 ok (RedHat 5.1) g25 - ALL - Spurious empty lines - corrected (PA3FWM). - ALL - Redist to field too short - corrected (OH2KKU) g26 - LIN - Sources compatible with 2.2 (SuSE 6.0 / 2.2.4) ============== release 7.01 for 2.2 kernels =================== added support for the new libax25 with glibc 2.x X11 applications can compile with motif2.0 and lesstif 0.88 (motif 2.0) all X11 applications moved in src/X11 directory - LIN - New configuration file /etc/ax25/fbb.conf replaces init.srv. It is not compatible and is now organized as keyword = value - LIN - To be compliant with the files organization on LINUX, a new tree has been defined : - configuration files in /etc/ax25/fbb - data files in /var/ax25/fbb The program fbb_tree script creates/check the full tree. 7.01b : - LIN - xfbbC and xfbbX did not work. Corrected. - LIN - reqdir server modified following the patch of 7m3tjz Satoshi - LIN - xfbb and xfbbX compiles with lesstiff 0.88 7.01d : - LIN - Segmentation violation if a directory in fbb.conf has no leading / 7.01e : - LIN - fixed a segmentation violation in AX25 socket. 7.01f : - LIN - PG programs did not work. Fixed. 7.01g - LIN - "CP SYSOP" messages can give wrong WP information when re-forwarded. Fixed. - ALL - Y2K bug in satellite computation. Fixed. 7.01h - ALL - Y2K bug in LD and WP import processing. Fixed. 7.01i - LIN- Y2K bug in fbbdos. Fixed. 7.01j - COPY command could only copy onto an existing file. Patch PA3FWM. - YN never find new files. Patch PA3FWM. - Added #MYPACTOR command to set the pactor callsign from inittnc file. 7.01k - PPC and SPARC support. Patch JE1SGH - Ichiro Hieda. 7.01l - MAIL.IN did not work correctly. Fixed. - FB commmand now take in account the data mode (J line of forward.sys) - Patch fbb_old_ax25.patch.gz : allow using this version with 2.0 kernels run "zcat fbb_old_ax25.patch.gz | patch -p0" from the fbb distribution base directory. Thanks to Jose. 7.01m - Added line "T Onn" in forward.sys where "nn" is the number of hours of the message forward delay. If nn is 24, then only mail older than 24 hours will be forwarded to the connected BBS. - New "install_fbb" and "fbb" scripts. The software is no longer run by xfbb.sh but by "fbb". 7.02 - full distribution and pre-compiled binaries 7.02a - added remote config directory list, upload and download for the xfbbC client. 7.02b - L commands may be combined on a single line : LR 101-110 & LS string - CHANGED the directory tree (see FBBTREE file) to fit the linux specifications - Added the TCP-IP driver for remote traffic and monitoring operations 7.02c - L> l@ were L<. Corrected. 7.02d - Other patch for L>, L< and L@ - Added remote forward maintenance for clients - Added EO sysop command to edit sytstem options 7.02e - Servers did not work correctly (upcase path -> lowcase) - Corrected. - Error in fbb.conf.sample - Corrected. - Fixed the default header string - Fixed a path bug in REQDIR 7.02f - Added the disconnection client-service 7.02g - Added Edit-User client-service - Added Edit-Message client-service 7.02h - Added full page message editing client-service - Minor changes in install.sh and fbb scripts - epurwp and epurmess only test major number version - Possible crash if "import" is defined in fbb.conf. Corrected. 7.03pre1 - Added maintenance, rerun, and other subdirectories in lib/fbb/script directory Executables in these subdirectory are run during housekeeping phase 7.03pre2 - Added hostname lookup for TCP-IP outgoing connections - Wrong disk size with Windows clent. Corrected. - Fixed some minor bugs in fbb and install_sh scripts 7.03 - Official release 7.03a - In forwarding mode, FQ no longer disconnects. Only wait for remote disconnection. - Multiple bug fixes in the client interface. 7.03b - Added MsgEdit flag in EO sysop command (full screen editor for messages) 7.03c - Changed the timeout during message edition. - Removing % in front of the call for PTC-II v3.1 7.03d - Fixed pactor marine firmware implementation for PTC-II 7.03e - Fixed the FOPEN_MAX (reduced from 256 to 16 ???) of stdio.h which gave errors in binary files. 7.03f - Made protect.sys working correctly. Protection is now made for the directory tree, not only the directory. - WHERE command in FbbDos always searches in the FbbDos directories even in sysop mode. Depth is limited to 16 sub-directories. - LABEL command allowed on protected areas. Needs security 16 (EDIT LABEL) to be used and security 32 (DELETE ANY FILE) for editing any file. - Fixed the SC problem in 7.03e. 7.03g - Support for long filenames in FbbDos 7.03h - Multiple bugs corrected for long filenames support - Spaces accepted in filenames (need double quotes) 7.03i - Connections are no longer accepted before maintenance - Sx call + filename accepts lowcase filenames 7.03j - wrong filenames displayed in FBBDOS - DU command - Minor changes in text files for EU command (PMS = F flag added) 7.04 - Official release 7.04a - Check pactor sending before asking for scanning - Added POP3 support (be sure your port 110 is free) : You have to declare a new COM and PORT in port.sys like (port = 110): #Ports TNCs 1 1 #Com Interface Address (device) Baud 6 9 6e 0 #TNC NbCh Com MultCh Pacln Maxfr NbFwd MxBloc M/P-Fwd Mode Freq 1 4 6 0 250 7 2 10 10/60 SU Pop3 7.04b - Some bug fixes in the POP driver - Added UIDL command to the POP server 7.04c - Added APOP command in POP server - Added SMTP server : in port.sys add the SMTP port address like pop_hex_port:smtp_hex_port #Com Interface Address (device) Baud 6 9 456:401 0 - Some more bug fixes in the POP driver - Some more new bugs in the POP/SMTP driver - Added config key "pophost" in fbb.conf to define the pop hostname If this value is defined , the address line will be : else the address will be (default) - Support multiple recipients in SMTP 7.04d - Some more bug fixes in the POP driver - Bloc buffered POP input for faster processing - Pop delete messages on long lists fixed - Added %I variable gives the name (if known) of the message sender from WP. 7.04e - Implementation of the NNTP server 7.04f - Bug fixes 7.04g - POP channels only monitored with the import/export display option - Number of channels increased to 99 (96 available) - Number of ports increased to 16 - changed 'FW 9' to 'FW 0' to start forward on all ports - Added the forgotten October month in pop dates - Added the SMTP LOGIN and PLAIN authentication - Added the port configuration by a port_name.prt file : If the PORT 2 is called network in the port.sys file,then The system first look for a network.prt file, then a inittnc2.sys file if the network.prt file does not exists. - Configuration of the smtp/pop driver by the port file (one or more lines) : SMTP authentications - One or more options (default NO) : SMTP AUTH (NO | LOGIN | PLAIN | CRAM-MD5) POP authentications - One or more options (default USER) : POP AUTH (USER | APOP) Example of my pop_smtp.prt file : # # POP/SMTP/NNTP configuration file - F6FBB # # SMTP authentication nedded. Accepts LOGIN, PLAIN and CRAM-MD5 SMTP AUTH LOGIN PLAIN CRAM-MD5 # POP authentication. USER and APOP accepted POP AUTH USER APOP # # end of file # 7.04h - Enhanced capabilities in the themes.sys file. This file is up-compatible with previous versions. Added parentheses and !, &, |, @ operators : & means "expression and expression" | means "expression or expression" (optional for up compatibility) ! means "not expression" @ means "via field" fra.achat ACHAT* & @FRA fra.vente VENTE* & @FRA fra.echange ECH* & @FRA cherche SEARCH CHERC* RECHER fra.satellite @FRA & (AMSAT | SAT* | UO22 | KO23 | UOSAT | PACSAT | DOVE | KEP* | SPACE | PHASE3 | ISS | PCSAT | NASA) ww.satellite @WW & (AMSAT | SAT* | UO22 | KO23 | UOSAT | PACSAT | DOVE | KEP* | SPACE | PHASE3 | ISS | PCSAT | NASA) 7.04i - POP/SMTP/NNTP ports may be unvalidated with the port value 0 in port.sys # #Com Interface Address (device) Baud 6 9 0:0:45f 0 # - cron.sys - All ports need the value 0 instead of 9 (GATE 0 or YAPP 0) - Added a CR after the messages header for POP 7.04j - POP addresses without "<>" were not accepted (F4ECW) - Multiple security fixes (SM6TKY) fbb-7.04j/README0100644000175100017510000000422607726646106011304 0ustar abaaba These are the sources of xfbbd (daemon version for LINUX) and their utilities. 1/ Compiling xfbbd and its utilities : -------------------------------------- - goto fbbsrc/src drectory - update the variables at the beginning of both Makefile, depending of your configuration. This must point to the ax25-utils include and librairies. Be sure to use at least the version 2.1.37b of ax25-utils. AX25LIBPATH = /usr/src/ax25/lib AX25INCPATH = /usr/src/ax25/lib - run "make" 2/ Compiling the xfbbC client : ------------------------------- - goto fbbsrc/client - update the variables at the beginning of both Makefile, depending of your configuration. This must point to the ax25-utils include and librairies. Be sure to use at least the version 2.1.37b of ax25-utils. AX25LIBPATH = /usr/src/ax25/lib AX25INCPATH = /usr/src/ax25/lib - run "make" 3/ Compiling the xfbbX client : ------------------------------- - this is only possible if you have a version of Motif installed. - in Makefile uncomment the line : all : client xfbbX_cl - run "make", this will build a xfbbX_cl binary. - xfbbX is a shell script which creates the resource file and runs xfbbX_cl. - If you don't have Motif, xfbbX cannot be compiled. 4/ Fixes and evolutions : ------------------------- Please, do not create new versions of code, this will make us impossible to maintain and know what is the current version. Instead help us to develop the code and fix the bugs. All fixes and evolutions will be welcome. Please again, do not delete the copyright and author headers in the files. If you didn't already it, subscribe to the xfbb mailing list by sending a email to majordomo@f6fbb.org without title and with "subscribe xfbb" as the first line of text. Then you will be able to send you fix, evolutions proposals and remarks to the mailing list. 5/ xfbbd exit values : ---------------------- 0 : Error (configuration...) 1 : Sigterm received 2 : re-run (no housekeeping) 3 : housekeeping 4 : Software stop 5 : Segv or BusError 6 : System Reboot asked 6/ Good luck with "fbb"... -------------------------- Jean-Paul ROUBELAT jpr@f6fbb.org 6 rue George Sand 31120 ROQUETTES - France fbb-7.04j/install_sh0100755000175100017510000000776307726646106012523 0ustar abaaba#!/bin/sh CONFDIR=$DESTDIR/etc/ax25/fbb DATADIR=$DESTDIR/var/ax25/fbb DOSDIR=$DATADIR/fbbdos LIBDIR=$DESTDIR/usr/lib/fbb SBINDIR=$DESTDIR/usr/sbin fbb_tree() { echo echo "creating configuration tree ..." echo " $CONFDIR" echo " $CONFDIR/lang" mkdir -p $CONFDIR/lang echo "creating pg directory ..." echo " $LIBDIR/pg" mkdir -p $LIBDIR/pg echo "creating script directory ..." echo " $LIBDIR/script" mkdir -p $LIBDIR/script for hk in maintenance rerun end_session stop_system error_return sig_segv reset do echo " $LIBDIR/script/$hk" if [ -e $LIBDIR/script/$k ] ; then if [ ! -d $LIBDIR/script/$hk ] ; then echo "file $LIBDIR/script/$hk found and renamed $LIBDIR/script/$hk.old" mv $LIBDIR/script/$hk $LIBDIR/script/$hk.old mkdir $LIBDIR/script/$hk fi else mkdir -p $LIBDIR/script/$hk fi done echo "creating filters directory ..." echo " $LIBDIR/filter" mkdir -p $LIBDIR/filter echo "creating servers directory ..." echo " $LIBDIR/server" mkdir -p $LIBDIR/server echo "creating tools directory ..." echo " $LIBDIR/tool" mkdir -p $LIBDIR/tool echo "creating fbbdos directory ..." echo " $DOSDIR" echo " $DOSDIR/yapp" mkdir -p $DOSDIR/yapp if [ ! -d $SBINDIR ] ; then echo "creating sbin directory ..." echo " $SBINDIR" mkdir -p $SBINDIR fi echo "creating data tree ..." echo " $DATADIR" for n in 0 1 2 3 4 5 6 7 8 9 ; do echo " $DATADIR/mail/mail$n" mkdir -p $DATADIR/mail/mail$n done for n in 0 1 2 3 4 5 6 7 8 9 ; do echo " $DATADIR/binmail/mail$n" mkdir -p $DATADIR/binmail/mail$n done echo " $DATADIR/docs" mkdir -p $DATADIR/docs echo " $DATADIR/sat" mkdir -p $DATADIR/sat echo " $DATADIR/wp" mkdir -p $DATADIR/wp echo " $DATADIR/log" mkdir -p $DATADIR/log echo " $DATADIR/oldmail" mkdir -p $DATADIR/oldmail echo "Done" } copy_files() { if [ -d $SRC ] ; then echo echo "Copying binary files" echo -n " Copying fbb ... " cp fbb $SBINDIR if [ $? -eq 0 ] ; then echo "OK" else echo "Error copying fbb. Giving up !" echo exit 1 fi chmod +x $SBINDIR/fbb for FILE in xfbbC xfbbd fbbgetconf do echo -n " Copying $FILE ... " cp $SRC/$FILE $SBINDIR if [ $? -eq 0 ] ; then echo "OK" else echo "Error copying src/$FILE. Giving up !" echo exit 1 fi chmod +x $SBINDIR/$FILE done fi for FILE in 20_epurmess 20_epurwp ; do if [ -f $LIBDIR/script/maintenance/$FILE ] ; then echo " Skipping $FILE ... OK" else cp $FILE $LIBDIR/script/maintenance/$FILE chmod +x $LIBDIR/script/maintenance/$FILE fi done if [ -d $LIBDIR/tool ] ; then for FILE in clr_user epurmess epurwp maintinf ; do cp $SRC/$FILE $LIBDIR/tool chmod +x $LIBDIR/tool/$FILE done fi if [ -d $LIBDIR/server ] ; then for FILE in reqdir ; do cp $SRC/$FILE $LIBDIR/server chmod +x $LIBDIR/server/$FILE done fi if [ -d $CONF ] ; then echo echo "Copying configuration files" for FILE in \ bbs.sys cron.sys forward.sys \ langue.sys passwd.sys protect.sys \ redist.sys reject.sys swapp.sys themes.sys do if [ ! -f $CONFDIR/$FILE ] ; then echo -n " Copying $FILE ... " cp $CONF/$FILE $CONFDIR if [ $? -eq 0 ] ; then echo "OK" else echo "Error !!" fi else echo " Skipping $FILE ... OK" fi done for FILE in $CONF/lang/* do F=`basename $FILE` if [ ! -f $CONFDIR/lang/$F ] ; then echo -n " Copying `basename $F` ... " cp $FILE $CONFDIR/lang if [ $? -eq 0 ] ; then echo "OK" else echo "Error !!" fi else echo " Skipping $F ... OK" fi done echo "Done" else echo echo "Warning : original configuration files not found in $CONF" fi } echo echo "FBB installation tool" echo echo "Warning ! This will replace binaries. Configuration files will not be replaced." echo -n "Go on anyway ? (Y/N) " read REP if [ "$REP" = "N" -o "$REP" = "n" ] ; then exit 0 fi echo CONF=`dirname $0`/conf SRC=`dirname $0`/src fbb_tree copy_files echo echo "Installation done" echo exit 0 fbb-7.04j/rerun/0042755000175100017510000000000007726646106011560 5ustar abaabafbb-7.04j/conf/0042755000175100017510000000000007726646106011352 5ustar abaabafbb-7.04j/conf/bbs.sys0100644000175100017510000000057407726646106012661 0ustar abaaba# # Fichier d'affectation de BBS # # Ne pas supprimer de ligne ! # 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80  fbb-7.04j/conf/cron.sys0100644000175100017510000000034307726646106013046 0ustar abaabaTALK NO YAPP 1 YES YAPP 3 YES IF D 1-5 IF H 6-20 BIP NO ELSE BIP NO ENDIF IF H 17-20 TALK YES ELSE TALK NO ENDIF ELSE IF H 8-20 BIP NO ELSE BIP NO ENDIF IF H 8-20 TALK YES ELSE TALK NO ENDIF ENDIF fbb-7.04j/conf/forward.sys0100644000175100017510000000022307726646106013546 0ustar abaaba**************************** * * * FICHIER DE FORWARD F6FBB * * * **************************** * fbb-7.04j/conf/langue.sys0100644000175100017510000000074307726646106013364 0ustar abaaba# # Fichier d'affectation des langues aux premieres connexions. # Tout indicatif non reconnu prend par defaut la langue 1 # 3 parametres dans l'ordre : Nb-Langues Nb-Buffers Langue-defaut 2 1 1 # ENGLISH FRANCAIS # # 1 : Anglais # 2 : Francais # C3* 7 CT* 9 CU* 9 DU* 1 D* 6 EK* 1 E?3* 7 E?5* 7 E?6* 7 E* 3 F* 2 H* 2 I* 4 LA* 8 ON1A* 5 ON1B* 5 ON1C* 5 ON1K* 2 ON4* 2 ON5* 2 ON6* 2 ON7* 2 ON8* 1 ON9* 1 OZ* 10 PY* 9 P* 5 SK* 11 SM* 11 TU* 2 TK* 2 VE2* 2 YU* 12 YT* 12 # 3A* 2 3B* 2 # fbb-7.04j/conf/passwd.sys0100644000175100017510000000033507726646106013407 0ustar abaaba# # Password for all non defined callsigns (one case dependant line) # password # # Rights and password specific to callsigns (one or more lines) # F6ZZZ 63 1023 THIS_IS_THE_PASSWORD_OF_F6ZZZ # # End of passwd.sys file # fbb-7.04j/conf/protect.sys0100644000175100017510000000044107726646106013564 0ustar abaaba# # protect.sys file for FBB # # # This files gives a list of directory trees in which # files cannot be modified/created by FbbDos except # in sysop mode with the needed rights # # path MUST be LINUX ABSOLUTE path (starting with a "/") # /var/ax25/fbb/fbbdos/readonly fbb-7.04j/conf/redist.sys0100644000175100017510000000110207726646106013371 0ustar abaaba# # Configuration of the REDIST server # # Route for the local BBS (SP LOCBBS) LOCBBS=F6FBB # Name of the BBS coverage LOCBBS_DESC=F6FBB BBS # #Route(s) for local bulletins (SP LOCAL) LOCAL=F6FBB,F6CDD # Coverage of the local BBS LOCAL_DESC=Toulouse # # Route(s) for regional bulletins (SP REGION) REGION=FMLR # Name of the region REGION_DESC=South-West of France # # Route(s) for national bulletins (SP NATION) NATION=FRA # Name of the country NATION_DESC=France # # Default destination DEFAULT_TO=INFO # # Send a mail to the sysop MAIL_SYSOP=YES #fbb-7.04j/conf/reject.sys0100644000175100017510000000426407726646106013367 0ustar abaaba# # Fichier de rejets # # Dans l'ordre, et a partir de la 1ere colonne : # Type, expediteur, routage, destinataire, taille maximale acceptee # # L'* et le ? peuvent se substituer aux caracteres (syntaxe MS-DOS) # # A partir du 2-05-92 # # Type Exp Via Pour BID MaxLg #------------------------------------------- L B * * * * 0 H * * * HUMOUR * 0 H * F1BBI * * * 0 #H * F6HED * * * 0 #H * F6CDD * * * 0 #H * * * F6CDD * 0 H * F5OJL * * * 0 H B G3RJM * * * 0 H B F1VY * * * 0 H B F6AOK * * * 0 H B F6CDX * * * 0 H B F6CVM * * * 0 H B F6IQF * * * 0 H * EA5EC * * * 0 H * * * * *_F*5SV 0 H * EB5HST * * * 0 H * FD1SLQ * SYSOP * 0 H * DL0SS * * * 0 H * F5PJE * * * 0 H * VE3RZX * * * 0 H B * * CB * 0 H B I0PMW * * * 0 # R B * EA * * 0 R B * AF * * 0 R B * NEWSUU * * 0 R * * FRANCA VENTE* * 0 R * * FRANCA ACHAT* * 0 R * FXXXX * * * 0 R * FILTER * * * 0 #R B * EU * * 0 #R B * FRA * * 0 #R B * FRANCA * * 0 #R B * WW * * 0 R * ALB#* * * * 0 R * FRA#* * * * 0 R * GER#* * * * 0 R * PPN#* * * * 0 R * POL#* * * * 0 R * POR#* * * * 0 R * PWR#* * * * 0 R * TIP#* * * * 0 R * AP1BOX * * * 0 H * @@@#* * * * 0 H * FE6FBB * * * 0 H B * USA * * 0 # fbb-7.04j/conf/swapp.sys0100644000175100017510000000020307726646106013232 0ustar abaaba# # #< AUTO7P >FD1NUF # @ EUR EU @ SATGAT >F6FBB > F8IDR @F6FBB > F8BK @F6FBB @ F1RVP @F5KATfbb-7.04j/conf/themes.sys0100644000175100017510000000151707726646106013376 0ustar abaabaPOUBELLE COMPUTER IBM APPLE MAC AMIGA C64 OS2 MSDOS TRUCS SOFTWA UNIX LINUX COMMERCE ACHAT* VENTE* ECH* RECHER SATELLITE AMSAT SAT* UO22 KO23 UOSAT PACSAT DOVE KEP* SPACE RESEAU FPAC* FLEX* RMNC THENET DX *DX* VHF UHF HF SHF QSL* EME CONTES PROPAG DIPLOM SUN IMAGES JPG JPEG GIF IMAG* *FAX* SSTV TECHNIQUE 9600 MODEM TECHNI TRX YAESU ICOM KENWOO ALINCO PYE KENW ATV ATV SATTV GAMES JEUX GAMES SCOUTS SCOUT* DIGEST *DIG BBS FBB RLI REBBS MSYS TCPIP CLUS TPK TPK ASSOCATION REF URC ARRL DARC RASEC EDUCATION EDUC ECOLE SCHOOL fbb-7.04j/conf/fbb.conf.sample0100644000175100017510000000751407726646106014234 0ustar abaaba# # FBB Set-up file # # default is /etc/ax25/fbb.conf # # may be changed using the $FBBCONF environment variable # ################################################################## # # The following lines are mandatory # version = FBB7.02 # Callsign of BBS with hierarchical information callsign = F6FBB.FMLR.FRA.EU # SSID of BBS ssid = 1 # Qra Locator of BBS qraloc = JN03QL # Qth of BBS city = Toulouse # First name of SYSOP name = Jean-Paul # Callsign of SYSOP sysop = F6FBB ################################################################## # # Optional lines # # Callsign (and route if needed) that will have copy of SYSOP messages sysmail = F6XXX F5XXX@F6XXX.FMLR.FRA.EU # Line to send WP messages wpcalls = F1XXX # BBS-UP batch or program upbatch = # BBS-DW batch or program dwbatch = # # Servers will be searched and run in the "server" directory # # REQCFG, REDIST and WP are already built-in # # Name Filename Information server = REQDIR reqdir Directory request ################################################################## # # The rest of lines overwrites defaults. Here are the default values # # Directory of data files data = /var/ax25/fbb # Directory of config files config = /etc/ax25/fbb # Directory of message files messages = /var/ax25/fbb/mail # Directory of compressed files compressed = /var/ax25/fbb/binmail # Directory of users fbbdos = *,*,/var/ax25/fbb/fbbdos,*,*,*,*,* # Directory of YAPP files yapp = /var/ax25/fbb/fbbdos/yapp # Directory of documentation files docs = /var/ax25/fbb/docs # Directory of the pg programs pg = /usr/lib/fbb/pg # Directory of the filter programs fdir = /usr/lib/fbb/filter # Directory of the server programs sdir = /usr/lib/fbb/server # Directory of the tool programs (fbbdos, forward, cron...) tdir = /usr/lib/fbb/tool # Path and filename for import file import = /var/ax25/fbb/mail/mail.in # Full log logs = OK # Test mode test = NO # Use (when possible) forward type FBB fbbfwd = OK 160 # Use (when possible) compressed forward fbbcomp = OK 3 # Wait for informations (Name, HomeBBS, Qth, ZIP) askinfo = OK # First connection mask : # 0 : Disable # 1 : Excluded # 2 : Local # 4 : Expert # 8 : Sysop # 16 : BBS # 32 : Pagination # 64 : Guest # 128: Modem # 256: See-all-messages # 512: Unproto list asking is allowed # 1024: Liste des messages nouveaux. # 2048: mask = 3616 # Security codes. # Users can : # 1 : Read all messages, including private messages # 2 : Kill all messages # 4 : Send SYS command # 8 : Use remote sysop commands (edit, forward, etc...) # 16 : Edit labels in YAPP, FBBDOS, DOCS # 32 : Can delete files in YAPP, FBBDOS # 64 : Have access to all gateways # 128: Run DOS commands # 256: Have access to the entire hard disk # 512: Have access to commands /A (stop) and /R (Reboot) # All: Sysop: Sysop after successful SYS-command: security = 0 4 59 # WARNING messages to sysop # 1 : Less than 1MB in disk # 2 : Error in system file (FORWARD, BBS, REJECT...) # 4 : Server error/warning # 8 : Ping-Pong warning # 16 : Unknown route warning # 32 : Unknown NTS warning # 64 : Message file not found # 128: Error in proposal # 256: Message rejected in remote BBS # 512: Message held in remote BBS # warning = 255 # Time (hour) for housekeeping (cleanup of messages) housekeeping = 2 # Time-out for normal users / forward timeout = 10 20 # Download size YAPP / MODEM maxdownload = 0 0 # Hours +/- in relation with UTC localtime = 0 # Number of callsigns in mail beacon beacon = 8 # Number of lines in scroll buffers # # User Console Monitoring scroll = 1500 1500 1500 # Text for forward header (Do not change !) fwdheader = [$c] $$:$R # Number of saved BIDs maxbids = 30000 # Lifetime for bulletins (days) lifetime = 30 # Zip code of the BBS zipcode = 00000 # Number of back messages in unproto lists unprotoes = 500 5 P # # End of fbb.conf file # fbb-7.04j/conf/fbb.conf.min.sample0100644000175100017510000000043307726646106015007 0ustar abaaba# # FBB Set-up file # version = FBB7.02 # Callsign of BBS callsign = F6FBB.FMLR.FRA.EU # SSID of BBS ssid = 1 # Qra Locator of BBS qraloc = JN03QL # Qth of BBS city = Toulouse # First name of SYSOP name = Jean-Paul # Callsign of SYSOP sysop = F6FBB # # End of fbb.conf file # fbb-7.04j/conf/lang/0042755000175100017510000000000007726646106012273 5ustar abaabafbb-7.04j/conf/lang/francais.hlp0100644000175100017510000014653307726646106014575 0ustar abaaba@@ -1 ? Vous n'avez qu'un jeu reduit des commandes: B : DECONNEXION. H : Cette AIDE minimale. KM : SUPRESSION de vos messages prives DEJA LUS. LM : LISTE de vos messages PRIVES. O : Acces aux OPTIONS. RM : LECTURE de vos messages PRIVES. S : ENVOI de messages. T : APPEL du Sysop. ? : AIDE. @@ 0 ? *** Cette commande n'est pas disponible !! C : Connexions - statistiques. D : Documentation. Q : QRA Locator. N : Nomenclature. T : Trajectographie. F : Retour en mode messagerie. B : Deconnexion. @@ 0 C CONNEXIONS-STAT --------------- Statistiques sur l'utilisation et le fonctionnement de la BBS. - Occupation des rubriques. - Statistiques generales. - Liste des connections (Carnet de trafic de la BBS). - Histogramme horaire. - Histogramme journalier. - Liste des indicatifs. @@ 0 D DOCUMENTATIONS -------------- Vous trouverez dans cette rubrique les informations ou documentations fournies par differents OMs. Cette rubrique est ouverte a tous, et tous les articles,documentations, programmes que vous voudrez bien y mettre seront les bienvenus. La commande d'acces aux informations est uniquement numerique et represente un numero d'ordre dans chaque menu. @@ 0 N NOMENCLATURE ------------ Cette rubrique permet d'obtenir les nom, prenom, adresse, telephone, conditions de trafic etc... des OMs qui ont utilise cette BBS et qui ont bien voulu y laisser ces renseignements. Accepter de fournir ces renseignements peut vous rendre service a vous-meme autant qu'aux autres OMS! Le menu propose: - Introduction ou modification de vos nom et adresse. - Recherche de ces informations sur un OM. - Liste des indicatifs qui se sont deja connectes sur cette BBS. N'oubliez pas de mettre a jour vos propres informations. @@ 0 Q QRA LOCATOR ----------- Le QRA-Locator est une succession de 2 lettres, 2 chiffres et 2 lettres donnant la position geographique d'une station du Monde avec une precision de l'ordre d'une quinzaine de Km (Ex. de QRA Locator: JN03SP). Ce code compact est universellement employe par les Radio-amateurs, en parti- culier pendant les Contests. Cette rubrique permet de calculer un QRA-Locator, mais aussi d'obtenir l'azimuth entre 2 stations dont on connait les QRA-Locators (pour orientation des antennes), ainsi que la distance les separant (avec cumul de distances pour les contests!). Le menu propose: - Transformation de QRA-Locator en Longitude-Latitude. - Transformation de Longitude-Latitude en QRA-Locator. - Calcul de distance et azimut entre deux QRA-Locators. - Cumul de distances entre une station et plusieurs QRA-Locators. @@ 0 T TRAJECTOGRAPHIE SATELLITES -------------------------- Cette rubrique est consacree aux satellites radio-amateurs, meteo etc... Vous pouvez soit utiliser le programme de trajectographie du Serveur, soit recuperer les parametres orbitaux pour les introduire dans votre propre calcul de trajectographie. Les parametres orbitaux sont maintenus a jour automatiquement a partir des Bulletins AMSAT recus sur le reseau Packet. Le menu propose: - Calcul de trajectographie satellite. - Affichage des parametres orbitaux. - Caracteristiques de satellites amateurs. @@ 2 ? *** Cette commande n'est pas disponible !! Q : Transformation de QRA-Locator en Longitude-Latitude. L : Transformation de Longitude-Latitude en QRA-Locator. D : Calcul de distance et azimut entre deux QRA-Locators. C : Cumul de distances entre une station et plusieurs QRA-Locators. F : Retour au menu serveur. B : Deconnexion. @@ 2 Q Commande "Q": ------------- Transformation d'un QRA-Locator en Longitude et Latitude. La Longitude Ouest et la Latitude Nord sont donnees en degres minutes et en grades. @@ 2 L Commande "L": ------------- Transformation de Longitude et Latitude en QRA-Locator. La Longitude Ouest et la Latitude Nord peuvent etre fournies en degres centesimaux, degres minutes, ou grades. @@ 2 D Commande "D": ------------- Calcul de DISTANCE et azimut entre deux QRA-Locators. La distance est donnee en Km et l'azimut en degres. @@ 2 C Commande "C": ------------- CUMUL de calcul de distances. Apres avoir fourni le QRA-Locator qui servira d'origine pour les calculs, vous pourrez donner un QRA-Locator de destination. La distance du calcul pourra etre cumulee avec une seconde ou plusieurs autres stations, vous permettant ainsi de calculer le nombre total de Km. @@ 3 ? *** Cette commande n'est pas disponible !! O : Occupation des rubriques. G : Statistiques generales. L : Liste des connections. H : Histogramme horaire. J : Histogramme journalier. I : Liste des indicatifs. F : Retour au menu serveur. B : Deconnexion. @@ 3 O Commande "O": ------------- Pourcentage d'OCCUPATION des differentes rubriques du serveur a l'instant de votre demande. @@ 3 G Commande "G": ------------- GENERALITES sur le serveur: - Nombre de messages actifs. - Nombre de connexions. - Temps de connexions. - Heures de pointe. @@ 3 L Commande "L": ------------- LISTE des connexions (Carnet de trafic). Pour chaque connexion sont indiques le port, l'indicatif, la date et l'heure, ainsi que le temps de connexion. La liste est donnee par ordre chronologique inverse. *** prevoir cette en-tete en debut de tableau *** @@ 3 H Commande "H": ------------- Histogramme des connexions sur cette BBS en fonction des HEURES de debut de connexion. SYNTAXE: "H": histogramme des heures de connexions pour l'ensemble du trafic memorise par le Serveur. "H F1DCDC": histogramme des heures de connexions de F1DCDC. "H FC1*": histogramme des heures de connexions des OMs dont l'indicatif commence par "FC1" . "H FC*": histogramme des heures de connexions des OMs dont l'indicatif commence par "FC". @@ 3 J Commande "J": ------------- Histogramme des connexions sur cette BBS en fonction des JOURS de la semaine. SYNTAXE: "J": histogramme des jours de trafic pour l'ensemble des connexions memorisees par le Serveur. "J FC1CDC": histogramme des jours de connexions de FC1CDC. "J FC1*": histogramme des jours de connexions des OMs dont l'indicatif commence par "FC1" . "J FC*": histogramme des jours de connexions des OMs dont l'indicatif commence par "FC". "J O*": histogramme des jours de connexions des OMs dont l'indicatif commence par "O". @@ 3 I Commande "I": ------------- Liste des indicatifs qui se sont connectes au serveur. Cette liste est classee par ordre alphanumerique. SYNTAXE: "I": liste tous les indicatifs. "I FC1*": liste les indicatifs commencant par "FC1" . "I FC*": liste les indicatifs commencant par "FC" . "I O*": liste les indicatifs commencant par "O" . @@ 4 H|? DOCUMENTATION: -------------- Pour lire un des fichiers de la liste, tapez seulement son numero. Sysop : La description peut etre changee avec la commande D : D BBS.DOC Description @@ 4 F Commande F : ------------ Cette commande permet de revenir au menu du serveur. Si vous voulez quitter le mode SERVEUR et revenir en mode MESSAGERIE, tapez F de nouveau. @@ 4 B Commande B : ------------ Cette commande permet de vous deconnecter sans revenir en mode messagerie. @@ 4 D Commande D (Sysop uniquement) : ------------------------------- Le sysop peut utiliser cette commande pour mettre a jour la description d'un fichier. D Nom-Fichier Description @@ 4 R Commande R : ------------ La commande R vous permet de revenir au niveau precedent de la documentation. @@ 5 ? *** Cette commande n'est pas disponible !! N : Modification de vos nom et adresse. R : Recherche des informations sur un OM. I : Liste des indicatifs connectes. F : Retour au menu serveur. B : Deconnexion. @@ 5 N Commande "N": ------------- Introduction ou modification de vos NOMS,adresse et telephones. Si les renseignements du fichier Adresses sont errones ou s'ils ont change, vous pouvez les modifier par cette commande. Un espace ou un en reponse a une question n'en modifie pas le contenu. Si le contenu du fichier est correct, vous annulez la modification en repondant "N" a la demande de modification finale. Accepter de fournir ces renseignements peut vous rendre service a vous-meme autant qu'aux autres OMS! @@ 5 R Commande "R": ------------- Recherche des coordonnees d'un OM. Si l'OM est en fichier, vous pouvez avoir les renseignements le concernant. Vous pouvez chainer l'indicatif de l'OM recherche derriere la commande. SYNTAXE: "R F6FBB" @@ 5 I Commande "I": ------------- Liste des indicatifs qui se sont connectes au serveur. Cette liste est classee par ordre alphanumerique. SYNTAXE: "I": liste tous les indicatifs. "I FC1*": liste les indicatifs commencant par "FC1" . "I FC*": liste les indicatifs commencant par "FC" . "I O*": liste les indicatifs commencant par "O" . @@ 6 ? *** Cette commande n'est pas disponible !! T : Calcul de trajectographie satellite. P : Affichage des parametres orbitaux. C : Caracteristiques de satellites amateurs. F : Retour au menu serveur. B : Deconnexion. @@ 6 T Commande "T": ------------- Calcul de trajectographie satellites. Apres avoir choisi le satellite dont vous voulez la trajectographie, vous devez fournir la date et l'heure auxquels les calculs commenceront. Respectez la syntaxe qui vous est proposee. Votre position geographique reelle est prise en compte par votre QRA-Locator, s'il est en fichier, (commande Nomenclature) sinon le QRA-Locator du serveur sera utilise par defaut. Le pas de calcul peut etre variable suivant les satellites. Une ligne de parametres sera affichee par pas. Cette ligne de calcul correspond a une elevation minimale de -5 degres (soit 5 degres sous l'horizon. La mise a jour des parametres orbitaux est assuree automatiquement a partir des fichiers AMSAT diffuses sur le reseau Packet. @@ 6 P Commande "P": ------------- Affichage des parametres orbitaux du satellite selectionne. Ces parametres sont utilises pour les calculs de trajectograhie du Serveur (commande "T") mais sont a la disposition des OMs possedant leur propre programme de trajectographie. La mise a jour des parametres orbitaux est assuree automatiquement a partir des fichiers AMSAT diffuses sur le reseau Packet. @@ 6 C Commande "C": ------------- Caracteristiques et informations concernant le satellite selectionne. Nota: Compte-tenu de la difficulte de recuperer ces informations, les OMS ayant des renseignements permettant de completer ou mettre a jour ce fichier seront les bienvenus. Contactez le Sysop qui transmettra les infos par forward @FRA. @@ 9 AIDE|HELP Commande "AIDE" ou "HELP": -------------------------- La commande "AIDE" ou "HELP" donne la liste des commandes disponibles sous FBBDOS. @@ 9 CD Commande "CD": -------------- La commande "CD" permet de changer de repertoire. SYNTAXE: "CD \TEST "CD .." permet de revenir au repertoire precedent dans l'aborescence. @@ 9 COPY Commande "COPY": ---------------- La commande "COPY" permet de copier un fichier dans un autre fichier. Le fichier destination, s'il existe deja, doit vous appartenir. SYNTAXE: "COPY TOTO.TXT TEST.TXT" @@ 9 DEL Commande "DEL": --------------- La commande "DEL" permet de supprimer un fichier. Un fichier ne peut etre supprime que s'il vous appartient . @@ 9 DIR Commande "DIR": --------------- La commande "DIR" permet de visualiser le catalogue du repertoire ou vous vous trouvez ou de celui que vous avez specifie apres DIR. SYNTAXE: "DIR \TEST" @@ 9 EDIT Commande "EDIT": ---------------- La commande "EDIT" permet d'editer un fichier. Il doit vous appartenir s'il existe deja. Plusieurs commandes sont disponibles: ? : donne la liste des commandes de l'editeur. A : Ajoute une ligne apres la ligne courante. Le texte de la ligne suit la commande et doit se terminer par le caractere /. Le caractere / peut etre inclus dans une chaine de caracteres a condition d'etre precede par le caractere \. Le caractere \, lui doit etre double pour etre considere comme caractere valide. Le pointeur de ligne est sur la ligne inseree. B : Positionne le pointeur de ligne au debut du fichier. E : Positionne le pointeur de ligne a la fin du fichier. F : Recherche la premiere occurence d'une chaine de caracteres specifiee apres la commande a partir de la ligne courante. La chaine de caracteres doit etre terminee par le caractere /. Le caractere / peut etre inclus dans une chaine de caracteres s'il est precede du caractere \ (voir commande A). Le pointeur de ligne est sur la ligne ou la chaine a ete trouvee. I : Insere une ligne avant la ligne courante. Le texte de la ligne suit la commande et doit se terminer par le caractere /. Voir commande A pour inclure le caractere / dans la chaine de caracteres. Le pointeur de ligne est sur la ligne inseree. K : Supprime le nombre de lignes specifie avant la commande (3K) a partir de la ligne courante. Si le nombre n'est pas specifie, la valeur 1 est prise par defaut. L : Deplace le pointeur du nombre de ligne specifie avant la commande (5L). Ce nombre peut etre positif ou negatif. N : Valide ou devalide la numerotation des lignes. P : Affiche le nombre de lignes specifie avant la commande (8P) a partir de la ligne courante. R : Recherche la premiere occurence de la chaine de caracteres specifiee apres la commande et la remplace par la deuxieme chaine (RTOTO TATA). Les chaines de caracteres doivent etre terminees par le caractere /. Voir commande A pour inclure un caractere / dans la chaine. Le pointeur de ligne est sur la ligne modifiee. S : Sauvegarde le fichier que vous editez. Q : Quitte l'editeur mais n'effectue pas la sauvegarde. Pensez a faire un S auparavant! Exemples: "EDIT>B5L10P" met le pointeur au debut du fichier, avance de 5 lignes et affiche 10 lignes. "EDIT>B4L6K-2L1OP" met le pointeur au debut du fichier, avance de 4 lignes, supprime 6 lignes, recule de 2 lignes et affiche 10 lignes. "EDIT>BFBonjour/K-2L5P" met le pointeur en debut de fichier, recherche "Bonjour", supprime la ligne contenant "Bonjour" recule de 2 lignes et affiche 5 lignes. "EDIT>BFBonjour/IC'est une nouvelle ligne avec un \/ dedans/-1L3P" met le pointeur en debut de fichier, recherche "Bonjour", insere la nouvelle ligne, recule de 1 ligne et affiche 3 lignes. "EDIT>SQ" sauvegarde le fichier edite et quitte l'editeur. @@ 9 EXIT|QUIT|F|B Commandes "EXIT", "QUIT", "F", "B": ----------------------------------- Sortie du FBBDOS et retour aux commandes de la messagerie. @@ 9 GET Commande "GET": --------------- Permet de charger CHEZ VOUS un fichier ASCII (texte), ou de le visualiser sans pagination. SYNTAXE: "GET FICHIER.TXT" @@ 9 LIST Commande "LIST": --------------- La commande "LIST" permet de visualiser le catalogue du repertoire ou vous vous trouvez ou de celui que vous avez specifie apres LIST. La description est donnee pour chaque fichier. SYNTAXE: "LIST \TEST" @@ 9 MD|MKDIR Commande "MD" ou "MKDIR": ------------------------- Permet de creer un repertoire a partir du repertoire ou vous vous trouvez. SYNTAXE: "MD \TEST" @@ 9 NEW Commande "NEW": --------------- Donne la liste des fichiers nouveaux a partir du repertoire courant depuis la derniere utilisation de cette commande ou de la commande "YN". @@ 9 O La commande "O" (OPTIONS) permet de memoriser au niveau du serveur: - Le nombre de lignes de votre ecran pour beneficier d'une pagination auto- matique (c'est-a-dire d'un arret de l'affichage lorsque l'ecran est rempli). - La langue de votre choix en ce qui concerne l'aide et les commentaires de la BBS. - Employee sans attribut, la commande "O" donne l'etat de la programmation de ces 2 options. SYNTAXE: "O" COMMANDES DERIVEES (possedent leur propre aide): - "OP" valide ou devalide la pagination. - "OP [nbre de lignes] initialise la pagination a n lignes. - "OL" liste les langues disponibles. - "OL [#langue]" selectionne la langue numero #. @@ 9 OP La commande "OP" (OPTION PAGINATION) permet de memoriser au niveau du serveur la pagination. - La commande "OP [nb_lignes]" permet de memoriser dans la BBS le nombre de lignes de votre ecran pour beneficier d'une pagination automatique (c'est-a-dire d'un arret de l'affichage lorsque l'ecran est rempli). SYNTAXE: "OP [nb_lignes] - La commande "OP" (sans attribut) valide ou alternativement devalide la pagination (flip-flop). Le dernier etat avant deconnexion sera retrouve a la prochaine connexion sur la BBS. SYNTAXE: "OP" Rappel: employee sans attribut, la commande "O" donne l'etat de la program- mation des options. @@ 9 OL La commande "OL" (OPTION LANGUE) permet de programmer la langue de votre choix pour l'aide et les commentaires de la BBS. La BBS vous propose la liste des langues disponibles reperees par un numero. La langue choisie est memorisee par la BBS. SYNTAXE: "OL [#langue]" Rappel: employee sans attribut, la commande "O" donne l'etat de la program- mation des options. @@ 9 PUT Commande "PUT": --------------- Permet de charger dans la BBS un fichier ASCII (texte) que vous avez CHEZ VOUS. Si ce fichier existe deja dans le repertoire ou vous vous trouvez, celui-ci doit vous appartenir sinon le chargement vous sera refuse. SYNTAXE: "PUT TEST.TXT" @@ 9 RD|RMDIR Commande "RD" ou "RMDIR": ------------------------- Permet de supprimer un repertoire. Un repertoire ne peut etre supprime que s'il ne contient aucun fichier. @@ 9 TYPE Commande "TYPE": ---------------- Permet de visualiser le contenu d'un fichier ASCII avec pagination si vous avez cette option. @@ 9 VIEW Commande "VIEW": --------------- La commande "VIEW" permet de visualiser le contenu du ou des fichiers archive specifies (ZIP, ARC, etc...). SYNTAXE: "VIEW TEST.ZIP" @@ 9 XGET Commande "XGET": ---------------- Permet de charger un fichier binaire DE LA BBS VERS CHEZ VOUS en protocole XModem. Ce protocole est reserve aux transferts telephoniques. SYNTAXE: "XGET FICHIER.EXE" puis suivre les instructions. @@ 9 XPUT Commande "XPUT": ---------------- Permet de mettre un fichier binaire DEPUIS CHEZ VOUS DANS LE REPERTOIRE COURANT DU FBBDOS en protocole Xmodem. Ce protocole est reserve aux transferts telephoniques. SYNTAXE: "XPUT TEST.EXE" puis suivre les instructions. @@ 9 YGET Commande "YGET": ---------------- Permet de charger un fichier binaire DE LA BBS VERS CHEZ VOUS en protocole YAPP. Vous devez posseder vous-meme le protocole YAPP (TPK de FC1EBN p.ex) SYNTAXE: "YGET FICHIER.EXE" puis suivre les instructions. @@ 9 YPUT Commande "YPUT": ---------------- Permet de mettre un fichier binaire DEPUIS CHEZ VOUS DANS LE REPERTOIRE COURANT DU FBBDOS en protocole YAPP. Vous devez posseder vous-meme le protocole YAPP (TPK de FC1EBN p.ex) SYNTAXE: "YPUT TEST.EXE" puis suivre les instructions. @@ 14 ? Le "?" ou le "H" (HELP) permet de lire cet AIDE de BASE. Vous etes sur une BBS (Bulletin Board System) comprenant 2 parties: - une MESSAGERIE orientee vers l'echange de messages personnels ou generaux, - un SERVEUR oriente vers la documentation et des applications diverses. VOUS ETES ACTUELLEMENT SUR LA MESSAGERIE SAVOIR UTILISER LA MESSAGERIE: - Il existe une AIDE pour toutes les commandes. Elle est utilisable lorsque la ligne des commandes s'affiche a l'ecran avec un prompt en debut de ligne. SYNTAXE de L'AIDE : "?[commande]" EXEMPLES: - tapez "?S" pour obtenir l'AIDE sur l'ENVOI DE MESSAGES (commande S). - tapez "?SC" pour obtenir l'AIDE cette COMMANDE DERIVEE SC (SEND COPY) - Tapez "?H" pour obtenir la LISTE DES COMMANDES. - Tapez "?F" pour passer de la MESSAGERIE au SERVEUR (et vice-versa). COMMANDES IMPORTANTES: - La commande "A" (ABORT) permet d'interrompre l'une operation en cours. Tapez simplement A suivi d'un retour-chariot (). Employez-la aussi pour reprendre la main si vous etes dans l'embarras !! "!" donne le status du serveur. "=[INDICATIF]" permet de connecter une station presente sur une autre voie. ">[INDICATIF] [TEXTE]" envoie ce texte en break a une autre station presente. ATTENTION: Ces 3 commandes (dites cachees) n'apparaissent pas dans les lignes de commandes! (mais possedent leur propre aide). N'OUBLIEZ PAS DE TAPER OU APRES CHAQUE COMMANDE! @@ 14 A La commande "A" (ABORT) permet d'arreter en cours de lecture la reception de ce que vous aviez demande. SYNTAXE: Exceptionnellement, cette commande peut etre tapee a n'importe quel moment: "A" Le serveur vous repond par "Interruption!" et vous redonne le prompt. NOTA: Cette commande est immediate si vous etes en mode "pagination" (commande "OP"), mais peut etre retardee en cas de lecture de longs messages car il faut d'abord que les tampons memoires du serveur se vident. @@ 14 B La commande "B" (BYE) vous deconnecte de la BBS. SYNTAXE: Tapez "B" pour vous deconnecter proprement. - NOTA: Vous pouvez egalement vous deconnecter par la commande de deconnexion de votre TNC. @@ 14 C - La commande C (CONFERENCE) permet d'entrer dans la conference, et d'etablir un QSO a plusieurs. Toute station connectee a la BBS peut y entrer. SYNTAXE: "C" COMMANDES DERIVEES (possedent leur propre aide): - AVANT d'entrer en conference, "CW" liste l'indicatif des conferenciers. "!" liste les utilisateurs actuels de la BBS. - DANS la conference, les commandes disponibles sont differentes: (elles commencent toujours par un point en premiere colonne). ".H" vous donne ce fichier d'aide. ".W" donne la liste des conferenciers. ".C[port] INDICATIF" permet de connecter un autre utilisateur de la BBS. ".Q" permet de sortir de la conference. ***** faire une cde donnant la liste des connectes a la BBS*** @@ 14 CW - AVANT d'entrer en conference par la commande "C", la commande "CW" liste l'indicatif de tous les conferenciers. SYNTAXE: "CW" @@ 14 D La commande D (DOS) a 2 fonctions: 1) Employee seule, elle permet de passer sous FBBDOS (un DOS simplifie adapte a la BBS) aussi bien en mode Messagerie que Serveur. - SYNTAXE: "D" - COMMANDES DERIVEES disponibles sous FBBDOS: AIDE HELP ou ? : Affiche les commandes disponibles. DIR : Catalogue des fichiers du repertoire ou vous trouvez. EDIT : Editeur de texte. GET : Chargement VERS VOUS d'un fichier texte. PUT : Chargement VERS LA BBS d'un fichier texte. CD : Changement de repertoire. MD ou MKDIR : Creation d'un repertoire. COPY : Copie d'un fichier. DEL : Suppression d'un fichier. RD ou RMDIR : Suppression d'un repertoire. TYPE : Visualisation du contenu d'un fichier. YGET : Chargement VERS VOUS d'un programme sous protocole YAPP. YPUT : Chargement VERS LA BBS d'un programme sous protocole YAPP EXIT,QUIT,F ou B : Sortie du FBBDOS et retour dans le mode ou vous vous trouviez auparavant (Messagerie ou Serveur). 2) La commande "D [nomfichier]" permet de charger CHEZ VOUS un fichier se trouvant dans le repertoire du FBBDOS. SYNTAXE: "D [nomfichier.ext]" Nota: 1) La commande inverse (deposer un fichier de CHEZ VOUS DANS FBBDOS) est la commande "U". Voir aussi la commande "W". 2) Si vous utilisez un ordinateur avec un programme "Packet" adequat, vous pouvez recuperer ce fichier sur votre disque. @@ 14 F - La commande "F" (FLIP-FLOP) vous permet de passer du mode MESSAGERIE au mode SERVEUR et reciproquement. SYNTAXE: "F" Rappel: Le SERVEUR est une base de documentation et d'applications diverses. @@ 14 G -La commande "G" (GATEWAY) vous permet d'acceder au GATEWAY et d'utiliser la BBS pour vous connecter a une station Packet quelconque sur une des frequences proposees par le Serveur. SYNTAXE: "G" COMMANDES DERIVEES DU GATEWAY (disponibles apres le choix de la frequence): "B" : Sortie du gateway. "K" : Passage en mode conversation. "C" : Connexion. "D" : Deconnexion. "H" : Aide. "J" : Liste des 20 dernieres stations entendues. Apres avoir selectionne un des ports autorises, une voie vous sera affectee si disponibilite. Cette voie prendra votre indicatif. Le passage en mode conversation se fait automatiquement a la connexion du correspondant et le retour en mode commande se fait a la deconnexion ou par le caractere Esc ou >. Le passage en mode conversation se fait par la commande K. La commande C doit etre suivie de l'indicatif du destinataire et eventuellement de la lettre V suivie d'une liste de repeteurs. SYNTAXE: "C [Destinataire V repet1 repet2 ...] @@ 14 H La commande "H" (HELP) liste les principales commandes de la MESSAGERIE. 1) Commandes directes (une seule lettre): ========================================= A : Abort : Interrompt l'envoi de donnees. B : Bye : Quitte et deconnecte la messagerie. C : Conference : Acces a la conference. D : DOS : Acces au FBBDOS. F : Flip-flop : Acces au mode serveur. G : Gateway : Acces aux autres frequences par 'gateway'. H : Help : Aide. I : Infos : Donne des informations sur le systeme. T : Talk : Appeller l'operateur. V : Version : Donne la version du logiciel de Serveur. W : What : Donne le repertoire des fichiers du FBBDOS. X : Expert : Changement de Mode entre Normal et Expert (et vice-versa). Y : YAPP : Transfert de fichiers binaires avec le protocole YAPP. ?Z: : Liste des regions francaises pour le forward hierarchise. ! : : Informations sur la BBS. 2) Commandes avec Qualifier: ============================ J : Jheard : Liste des dernieres stations connectees. K : Kill : Supression de messages. L : List : Liste des messages. N : Name : Modification du prenom. O : Option : Selectionne les options . R : Read : Lecture des messages. S : Send : Envoi de messages. V : Verbose : Lecture des messages avec en-tete. =[indicatif] : Connecte un autre utilisateur de la BBS. >[indicatif] [texte] : Envoie un "break" a un autre utilisateur de la BBS. Pour l'aide complete de chaque commande, tapez ?n (n = lettre(s) de commande). SYNTAXE: "?LM" donne l'aide detaillee de la commande "LM". @@ 14 I La commande "I" (INFORMATIONS) donne des informations sur cette BBS: - QTH de la BBS. - Description du materiel. - Reference du logiciel. - Caracteristiques des ports. - Langues disponibles. SYNTAXE: "I" @@ 14 J La commande "J" (JHEARD) donne la liste des indicatifs entendus ou connectes sur la BBS. La commande "J" doit toujours comporter 2 caracteres. SYNTAXE: - Tapez "JK" pour lister les 20 derniers indicatifs connectes. - Tapez "JA" pour lister les indicatifs connectes sur le port A. - Tapez "JB" pour lister les indicatifs connectes sur le port B. - Tapez "JC" pour lister les indicatifs connectes sur le port C, etc... - Tapez "J1" pour lister les indicatifs entendus sur le port A. - Tapez "J2" pour lister les indicatifs entendus sur le port B. - Tapez "J3" pour lister les indicatifs entendus sur le port C, etc... @@ 14 JK La commande "JK" donne la liste des 20 derniers indicatifs connectes sur la BBS. SYNTAXE: "JK" @@ 14 JA|JB|JC|JD|JE|JF|JG|JH Les commandes "JA" a "JH" donnent la liste les indicatifs CONNECTES sur les ports A a H de la BBS. SYNTAXE: "JA" @@ 14 J1|J2|J3|J4|J5|J6|J7|J8 Les commandes "J1" a "J8" donnent la liste des indicatifs ENTENDUS sur les ports A a H de la BBS. SYNTAXE: "J1" @@ 14 K La commande "K" (KILL) permet de supprimer les messages envoyes PAR VOUS ou POUR VOUS. SYNTAXE: "K [#msg]" supprime un message numero (#). COMMANDE DERIVEE (voir ?KM): "KM" supprime tous les messages pour vous que vous avez deja lus. Les messages que vous n'avez pas encore lus ne seront pas supprimes. NOTA: Vous ne pouvez pas supprimer de fichiers, seul le SysOp le peut. @@ 14 KM La commande "KM" (KILL MINE) supprime tous les messages POUR VOUS que vous avez deja lus. Les messages que vous n'avez pas encore lus ne seront pas supprimes. SYNTAXE: "KM" NOTA: Vous ne pouvez pas supprimer de fichiers, seul le SysOp le peut. @@ 14 L La commande "L" (LISTE) permet de lister de differentes facons les titres des messages. - Employee sans qualificatif, la commande "L" liste les titres des nouveaux messages depuis le dernier usage de cette commande. Son utilisation regu- liere permet de lire tous les titres des messages, sans oubli et sans avoir a retenir le dernier numero lu. SYNTAXE: "L" - La commande "L [#msg]-" liste les titres des messages a partir d'un numero [#msg]. La liste demarre du numero du message le plus recent et s'arrete au numero [#msg]. SYNTAXE: "L [#msg]-" Exemple: pour LISTER les titres des messages apres #11325, tapez "L 11325-". - La commande "L [#msg1]-[#msg2]" liste les titres des messages a partir d'un numero [#msg1]. Elle s'arrete au numero [#msg2]. SYNTAXE: "L [#msg1]-[msg2]" Exemple: pour LISTER les titres des messages de #11300 a #11350 tapez "L 11300-11350". COMMANDES DERIVEES (possedent leur propre aide): - LB : liste les bulletins. - LC [theme] : selection d'un theme. - LM : liste les messages POUR VOUS. - LN : liste les messages NOUVEAUX POUR VOUS. - LL 10 : liste les 10 derniers messages. - LR : Liste en sens inverse. - LS [texte] : recherche de "texte" dans les titres de messages. - L< [indicatif] : liste les messages DE [indicatif]. - L> [indicatif] : liste les messages POUR [indicatif]. - L@ [nomBBS] : liste les messages VIA cette BBS. @@ 14 LB La commande "LB" (LISTE BULLETIN) liste uniquement les bulletins. SYNTAXE: "LB" @@ 14 LC La commande "LC" employee seule affiche le theme selectionne. Suivie d'un theme, permet l'affichage des bulletins dont le theme (destinataire) repond aux criteres. Les jokers (* et ?) peuvent etre utilises. "LC *DX*" permet de selectionner uniquement les bulletins dont le theme contient "DX". "LC *" permet de valider la totalite des bulletins. @@ 14 LM La commande "LM" (LISTE MINE) liste les messages POUR VOUS. SYNTAXE: "LM" @@ 14 LN La commande "LN" (LISTE NEW) liste les messages NOUVEAUX POUR VOUS. SYNTAXE: "LN" @@ 14 LL La commande "LL [n]" liste les n derniers messages recus sur la messa- gerie (avec "n" = nombre de messages a lister). SYNTAXE: "LL [nombre]" @@ 14 LR La commande "LR" est identique a la commande L, mais les messages sont listes en sens inverse, le plus ancien en tete. - Employee sans qualificatif, la commande "LR" liste les titres des nouveaux messages depuis le dernier usage de cette commande, le plus ancien d'abord. Son utilisation reguliere permet de lire tous les titres des messages, sans oubli et sans avoir a retenir le dernier numero lu. SYNTAXE: "LR" - La commande "L [#msg]-" liste les titres des messages a partir d'un numero [#msg]. La liste demarre au numero [#msg] et s'arrete au numero du message le plus recent. SYNTAXE: "LR [#msg]-" Exemple: pour LISTER les titres des messages apres #11325, tapez "L 11325-". - La commande "LR [#msg1]-[#msg2]" liste les titres des messages a partir d'un numero [#msg1]. Elle s'arrete au numero [#msg2]. SYNTAXE: "LR [#msg1]-[msg2]" Exemple: pour LISTER les titres des messages de #11300 a #11350 tapez "LR 11300-11350". @@ 14 LS La commande "LS [texte]" recherche la chaine de caracteres "texte" dans les titres de messages et affiche les titres selectionnes. SYNTAXE: "LS [texte]" @@ 14 L< La commande "L< [indicatif]" liste les messages DE [indicatif]. SYNTAXE: "L< [indicatif]" @@ 14 L> La commande "L> [indicatif]" liste les messages POUR [indicatif]. SYNTAXE: "L> [indicatif]" @@ 14 L@ La commande "L@ [nomBBS]" liste les messages VIA cette BBS. Nota: [nomBBS] s'ecrit sans le SSID (Ex. F6FBB et non F6FBB-1). SYNTAXE: "L@ [nomBBS]" @@ 14 M La commande "M" (COPIE MESSAGE) permet de dupliquer un message vers un fichier de FBBDOS. - Employee sans qualificatif, la commande "M" duplique uniquement le contenu du message, sans les entetes d'indication de routage. Seul le texte envoye par l'expediteur sera duplique. SYNTAXE: "M [#msg] [nomFichier]" COMMANDES DERIVEES (possedent leur propre aide): - MH : duplique avec le format de la commande R. - MV : duplique avec le format de la commande V. @@ 14 MH La commande "MH" (COPIE MESSAGE + ENTETE) duplique un message dans un fichier FBBDOS en utilisant le format de la commande R. L'entete de message est recopie en debut de fichier, mais les indicateurs de routage ne sont pas dupliques. SYNTAXE: "MH [#msg] [nomFichier]" @@ 14 MV La commande "MV" (COPIE MESSAGE + ENTETE + ROUTAGE) duplique un message dans un fichier FBBDOS en utilisant le format de la commande V. L'entete de message est recopie en debut de fichier ainsi que les indicateurs de routage. SYNTAXE: "MV [#msg] [nomFichier]" @@ 14 N La commande "N" (preNom) vous permet d'entrer ou de modifier votre prenom. Il sera memorise par la BBS. Vous pouvez utiliser jusqu'a 12 caracteres. La BBS vous demandera de le re-entrer si necessaire. SYNTAXE: "N [Prenom]" @@ 14 NQ La commande "NQ" (QthLocator) vous permet d'entrer ou de modifier votre QthLocator. Il sera memorise par la BBS. Vous devez entrer le qth locator sous la forme habituelle, 2 lettres, 2 chiffres puis 2 lettres, sans espace. SYNTAXE: "NQ [QthLocator]" @@ 14 O La commande "O" (OPTIONS) permet de memoriser au niveau du serveur: - Le nombre de lignes de votre ecran pour beneficier d'une pagination auto- matique (c'est-a-dire d'un arret de l'affichage lorsque l'ecran est rempli). - La langue de votre choix en ce qui concerne l'aide et les commentaires de la BBS. - Employee sans attribut, la commande "O" donne l'etat de la programmation de ces 2 options. SYNTAXE: "O" COMMANDES DERIVEES (possedent leur propre aide): - "OP" valide ou devalide la pagination. - "OP [nbre de lignes] initialise la pagination a n lignes. - "OL" liste les langues disponibles. - "OL [#langue]" selectionne la langue numero #. @@ 14 OP La commande "OP" (OPTION PAGINATION) permet de memoriser au niveau du serveur la pagination. - La commande "OP [nb_lignes]" permet de memoriser dans la BBS le nombre de lignes de votre ecran pour beneficier d'une pagination automatique (c'est-a-dire d'un arret de l'affichage lorsque l'ecran est rempli). SYNTAXE: "OP [nb_lignes] - La commande "OP" (sans attribut) valide ou alternativement devalide la pagination (flip-flop). Le dernier etat avant deconnexion sera retrouve a la prochaine connexion sur la BBS. SYNTAXE: "OP" Rappel: employee sans attribut, la commande "O" donne l'etat de la program- mation des options. @@ 14 OL La commande "OL" (OPTION LANGUE) permet de programmer la langue de votre choix pour l'aide et les commentaires de la BBS. La BBS vous propose la liste des langues disponibles reperees par un numero. La langue choisie est memorisee par la BBS. SYNTAXE: "OL [#langue]" Rappel: employee sans attribut, la commande "O" donne l'etat de la program- mation des options. @@ 14 R La commande "R" (READ) permet de LIRE les MESSAGES en utilisant le numero qui leur sont affectes. L'entete du message est reduit aux renseignements principaux ( pour obtenir l'entete complet, utilisez la commande "V"). SYNTAXE: "R [#msg]" affiche le texte du message numero "#msg". Vous pouvez mettre jusqu'a 6 numeros par ligne. Exemple : pour LIRE les msgs #11313 et #11325, tapez "R 11313 11325". N'oubliez pas l'ESPACE!! COMMANDES DERIVEES (possedent leur propre aide): - "RM" lit tous les messages POUR VOUS. - "RN" lit tous les NOUVEAUX messages POUR VOUS. @@ 14 RM La commande "RM" (READ MINE) permet de LIRE les messages PERSONNELS POUR VOUS. (les messages s'afficheront les uns derriere les autres). SYNTAXE: "RM" @@ 14 RN La commande "RN" (READ NEW) permet de LIRE tous les NOUVEAUX messages POUR VOUS (les messages s'afficheront les uns derriere les autres). SYNTAXE: "RN" @@ 14 S La commande "S" (SEND) permet d'ENVOYER un MESSAGE (mais pas un fichier). SYNTAXE: "S [indicatif]" pour envoyer un message a "indicatif". "S VENTE" pour envoyer un message general qui pourra etre lu par tous. Le mot "VENTE" est choisi de maniere a bien representer le theme du message (eviter TOUS, ALL etc... qui n'apportent pas grand'chose). Ce mot aura au maximum 6 caracteres. "S [indicatif]@[nomBBS]" pour envoyer un message au destinataire "indicatif" via le reseau de transfert propre aux BBS. Le destinataire trouvera le message dans la BBS "nomBBS" (FORWARDING). "S VENTE@[nomBBS]" pour envoyer un message general qui pourra etre lu par tous. Nota: [nomBBS] s'ecrit sans le SSID (Ex. F6FBB et non F6FBB-1). "S VENTE@[diffusion]" pour envoyer un message general qui sera "forwarde" par le reseau de transfert propre aux BBS dans une zone geographique definie par le code "diffusion" (de 6 caracteres maxi). Exemple:"S ATARI@FRA" diffusera sur TOUTES les BBS de France (FRA) ce message concernant ATARI: a utiliser judicieusement et sans exces!!! En particulier, dans le cas d'un message vers l'etranger de type @EU (pour EUROPE), le rediger EN ANGLAIS UNIQUEMENT! Les codes de diffusion sont accessibles par la commande "Z". Remarque: - Si le destinataire correspond a un indicatif, le message sera classe "PERSONNEL" par la messagerie. - Si le destinataire correspond a un code tel que "ATARI" de l'exemple precedent, le message sera classe "BULLETIN" par la messagerie. COMMANDES DERIVEES (possedent leur propre aide): - "SP [indicatif]" envoie un message du type personnel. - "SP [indicatif]@[nomBBS]" envoie un message personnel sur "nomBBS". - "SB HELP" envoie un bulletin recherche d'aide (lisible par tout le monde). - "SB HELP@FRA" envoie un bulletin (lisible par tout le monde) et qui sera depose dans toutes les BBS de France. - "SR [#msg] [Titre]" envoie une reponse au message numero "#msg". - "SR" seul pour repondre au message que vous venez de lire. Le message sera automatiquement redirige vers l'expediteur sans que vous ayiez a taper son indicatif et sa BBS de rattachement (dite "locale"). - "SC [#msg] [indicatif]" permet de dupliquer un message numero "#msg" et de l'adresser au destinataire "indicatif". - "SC [#msg] [ATARI]@FRA" permet de dupliquer un message numero "#msg" et de le diffuser dans toutes les messageries de France. - "SC [#msg] [ATARI]@[nomBBS]" permet de dupliquer un message numero "#msg" et de le deposer dans la messagerie "nomBBS". Dans tous les cas: - le message doit se terminer par "Ctrl Z" ou "/EX" suivi d'un ou d'un . - le /EX doit se trouver en 1ere colonne. @@ 14 SP La commande "SP" (SEND PERSONNAL) permet d'ENVOYER un message qui sera obligatoirement du type PERSONNEL. SYNTAXE: "SP [indicatif]" pour envoyer un message personnel sur la BBS. "SP [indicatif]@[nomBBS]" pour envoyer un message personnel par "forwarding" sur la BBS citee. Nota: [nomBBS] s'ecrit sans le SSID (Ex. F6FBB et non F6FBB-1). @@ 14 SB La commande "SB" (SEND BULLETIN) permet d'ENVOYER un message qui sera obligatoirement du type BULLETIN (lisible par tous). SYNTAXE: - "SB HELP" envoie un bulletin recherche d'aide (lisible par tous les lecteurs de la BBS). - "SB HELP@FRA" envoie un bulletin (lisible par tout le monde) et qui sera depose dans toutes les BBS de France. Nota: [nomBBS] s'ecrit sans le SSID (Ex. F6FBB et non F6FBB-1). @@ 14 SR La commande "SR" (SEND REPONSE) permet de repondre a un message que vous venez de lire. Votre reponse sera automatiquement redirigee vers l'expediteur du message auquel vous repondez. Cette commande permet de retrouver le destina- taire et sa BBS de rattachement (dite aussi BBS locale) sans que vous ayiez a le retaper. Le titre du message original est conserve mais precede des lettres "RE:" (comme REPONSE). - Si vous voulez repondre au message que vous venez juste de lire, tapez simplement "SR" et la BBS vous demandera le texte du message a envoyer. Terminer comme a l'habitude par un CTRL-Z ou /EX. SYNTAXE: "SR" - Si vous voulez repondre a un message plus ancien dont vous vous souvenez du numero, tapez "SR [#msg]" et la BBS acheminera votre reponse au corres- pondant qui avait ecrit le message numero "#msg", que ce soit un message prive ou un bulletin general. SYNTAXE: "SR [#msg]" - Si vous voulez repondre a un message dont vous voulez remplacer le titre, tapez "SR [#msg] [titre]" et la BBS acheminera votre reponse au corres- pondant qui avait ecrit le message numero "#msg" avec le nouveau titre. La specification du numero de message est dans ce cas obligatoire. SYNTAXE: "SR [#msg] [titre]" @@ 14 SC La commande "SC" (SEND COPY) permet de dupliquer un message de la BBS pour l' envoyer a un autre destinataire. Le titre du message est conserve mais precede des mots "CP [destinataire_nouveau] :" pour indiquer que c'est une copie qui a ete faite par vous. SYNTAXE: - "SC [#msg] [indicatif]" copie un message numero "#msg" et l'adresse au destinataire "indicatif". - "SC [#msg] [ATARI]@FRA" copie un message numero "#msg" et le diffuse dans toutes les messageries de France. - "SC [#msg] [ATARI]@[nomBBS]" copie un message numero "#msg" et le depose dans la messagerie "nomBBS". Nota: [nomBBS] s'ecrit sans le SSID (Ex. F6FBB et non F6FBB-1). @@ 14 T La commande "T" (TALK) permet de se connecter a l'Operateur Systeme (SysOp) Il est prevenu par une sonnerie. - Attendez sa reponse avant de frapper votre question. Si le SysOp est disponible, il vous repondra dans la minute et vous pourrez converser. - Sinon, la messagerie vous dira qu'il ne repond pas et vous renverra le prompt et la ligne des commandes. SYNTAXE: "T" @@ 14 U La commande "U" transfere un fichier de CHEZ VOUS VERS la MESSAGERIE. Ce fichier sera alors ecrit dans le repertoire principal du FBBDOS. La commande "U" se frappe apres le prompt de la BBS. Il n'est pas necessaire de passer sous FBBDOS. SYNTAXE: "U [nomfichier.ext]" Nota: La commande inverse (transferer un fichier de FBBDOS VERS CHEZ VOUS est la commande "D". Voir aussi la commande "W". @@ 14 V La commande "V" a 2 fonctions distinctes: 1) elle donne le numero de VERSION de cette BBS, le nombre de messages actifs et le numero du message suivant. SYNTAXE: "V" La commande "V" permet aussi de LIRE les MESSAGES comme la commande "L", mais avec une entete complete comprenant: - La ligne de STATUS - La DATE - Le TITRE du message - Le CHEMIN complet effectue par ce message. SYNTAXE strictement identique aux commandes "R" mais en remplacant le "R" par un "V". Voici la liste des commandes disponibles. Reportez vous a l'aide de la commande "R" pour plus de details: - "V [#msg]" affiche le texte du message numero "#msg". - "VM" lit tous les messages POUR VOUS. - "VN" lit tous les NOUVEAUX messages POUR VOUS. @@ 14 W La commande "W" permet de lister les fichiers qui se trouvent sous FBBDOS sans etre sous FBBDOS. Elle est equivalente a la commande DIR du FBBDOS mais se limite au repertoire principal. SYNTAXE: "W @@ 14 X La commande "X" change alternativement (flip-flop) votre status entre "NORMAL" et "EXPERT". "NORMAL" donne les menus complets. "EXPERT" donne les informations minimales. SYNTAXE: "X" @@ 14 Y La commande "Y" permet de realiser des transferts binaires par le protocole YAPP. Vous devez vous-meme posseder ce programme sur votre ordinateur. La commande "Y" employee seule donne ce texte d'aide. COMMANDES DE TRANSFERT (elles possedent leur propre aide): - "YW" liste les fichiers binaires disponibles. - "YI" liste les fichiers binaires disponibles + leurs infos. - "YN" liste les nouveaux fichiers depuis votre derniere connexion. - "YU Fichier" demarre la procedure d'envoi d'un fichier de CHEZ VOUS VERS LA BBS. Vous ne pouvez pas remplacer ou modifier un fichier deja existant. Repondez aux questions que le programme de transfert vous demande. - "YD Fichier" demarre la procedure d'envoi d'un fichier de la BBS VERS CHEZ VOUS. Repondez aux questions que le programme de transfert vous demande. @@ 14 YW La commande "YW" liste la bibliotheque des fichiers binaires disponibles pouvant etre transferes DE LA BBS VERS VOUS. SYNTAXE: "YW" Cette commande peut etre suivie d'un masque de selection. Les masques sont d'une syntaxe identique a ceux de FBBDOS. Ex : *.ZIP TE*.* etc... SYNTAXE: "YW [masque]" @@ 14 YI La commande "YI" liste comme la commande "YW" la bibliotheque des fichiers binaires disponibles pouvant etre transferes DE LA BBS VERS VOUS mais en fournissant en plus des renseignements sur le contenu de ces fichiers. SYNTAXE: "YI" Cette commande peut etre suivie d'un masque de selection. Les masques sont d'une syntaxe identique a ceux de FBBDOS. Ex : *.ZIP TE*.* etc... SYNTAXE: "YI [masque]" @@ 14 YN La commande "YN" liste uniquement les nouveaux fichiers binaires integres dans la bibliotheque YAPP depuis votre derniere connexion a la BBS. SYNTAXE: "YN" Cette commande peut etre suivie d'un masque de selection. Les masques sont d'une syntaxe identique a ceux de FBBDOS. Ex : *.ZIP TE*.* etc... SYNTAXE: "YN [masque]" @@ 14 YU La commande "YU" demarre la procedure YAPP d'envoi d'un fichier de CHEZ VOUS VERS LA BBS. Vous ne pouvez pas remplacer ou modifier un fichier deja existant. Vous devez vous-meme posseder YAPP sur votre ordinateur. Repondez aux questions que le programme de transfert vous demande. SYNTAXE: "YU [nomfichier.ext]" @@ 14 YD La commande "YD" (YAPP DOWN) demarre la procedure YAPP d'envoi d'un fichier DE LA BBS VERS CHEZ VOUS. Vous devez vous-meme posseder YAPP sur votre ordinateur. Repondez aux questions que le programme de transfert vous demande. SYNTAXE: "YD [nomfichier.ext]" @@ 16 H La commande "G" (GATEWAY) vous permet d'acceder au GATEWAY et d'utiliser la BBS pour vous connecter a une station Packet quelconque sur une des frequences proposees par le Serveur. SYNTAXE: "G" COMMANDES DERIVEES DU GATEWAY (disponibles apres le choix de la frequence): "B" : Sortie du gateway. "K" : Passage en mode conversation. "C" : Connexion. "D" : Deconnexion. "H" : Aide. "J" : Liste des 20 dernieres stations entendues. Apres avoir selectionne un des ports autorises, une voie vous sera affectee si disponibilite. Cette voie prendra votre indicatif. Le passage en mode conversation se fait automatiquement a la connexion du correspondant et le retour en mode commande se fait a la deconnexion ou par le caractere Esc ou >. Le passage en mode conversation se fait par la commande K. La commande C doit etre suivie de l'indicatif du destinataire et eventuellement de la lettre V suivie d'une liste de repeteurs. SYNTAXE: "C [Destinataire V repet1 repet2 ...] @@ 18 C - La commande C (CONFERENCE) permet d'entrer dans la conference, et d'etablir un QSO a plusieurs. Toute station connectee a la BBS peut y entrer. SYNTAXE: "C" COMMANDES DERIVEES (possedent leur propre aide): - AVANT d'entrer en conference, "CW" liste l'indicatif des conferenciers. "!" liste les utilisateurs actuels de la BBS. - DANS la conference, les commandes disponibles sont differentes: (elles commencent toujours par un point en premiere colonne). ".H" donne ce fichier d'aide. ".W" donne la liste des conferenciers. ".C[port] INDICATIF" permet de connecter un autre utilisateur de la BBS. ".Q" permet de sortir de la conference. fbb-7.04j/conf/lang/francais.inf0100644000175100017510000000144407726646106014555 0ustar abaaba BBS F6FBB-1 - $? - Roquettes (15 Km sud Toulouse) Port 1 : (20 voies) Liaison ethernet vers F6FBB-11 Port 2 : ( 1 voie ) Acces decametrique 300 Bds Port 3 : ( 1 voie ) Acces telephone 1200-28800 Bds Port 4 : ( 1 voie ) Acces ethernet local Micro : compatible PC 486 SX 33 Ram : 16 MB Disque : 400 MB SCSI Soft : F6FBB version $E NODAL F6FBB-10/F6FBB-11 Port 1 : Liaison 9600 Bds full duplex vers F6BEX-9 (430.575/439.975) Port 2 : Acces local VHF 1200 Bds simplex (145.275) Port 3 : Acces local UHF 9600 Bds simplex (432.650) Port 4 : Liaison 2400 Bds AFSK vers F5JTU-9 (430.425/439.825) Port 5 : Liaison ethernet vers F6FBB-1 Micro : compatible PC 486 DX2/66 Ram : 8MB Disque : Floppy 1.4MB Soft : FPAC 2.0 LINUX (compatible ROSE) fbb-7.04j/conf/lang/francais.txt0100644000175100017510000003556707726646106014635 0ustar abaaba############################## # Textes francais (V1.1) # # Pour F6FBB BBS (V5.15b) # # # # Version non accentuee # # adaptee de G7EVY @ GB7EVY # # par F6FBB @ F6FBB # ############################## # ############################################################## # NOTA: # # ~~~~~ # # La longueur des lignes ne doit pas depasser 255 caracteres # # L'ordre des lignes ne doit pas etre modifie # # Seules des lignes commentaires (commancant par un '#' # # peuvent etre ajoutees ou enlevees # # # ############################################################## # # # LANGUAGE, REPONSES, FORMATS (DATE, POINTS CARDINAUX) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Francais OL: Le language selectionne est : Francais$W Oui Non DimLunMarMerJeuVenSam JanFevMarAvrMaiJuiJulAouSepOctNovDec Nord Sud Est Ouest # # T_MES (MESSAGES DE BIENVENUE) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # BBS, EXPERT, NON-EXPERT # OK $I - %l Msg(s) - %k KB$W $WBonjour $I.$W $WBonjour $I, Bienvenue a $c.$WTapez ? pour avoir de l'aide.$W # # INFOS NOM, QTH, HOME-BBS, CODE-POSTAL # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # $WSVP entrez votre prenom : N (prenom). $WSVP entrez votre QTH : NQ (ville). $WSVP entrez votre BBS habituelle : NH (Home-BBS). $WSVP entrez votre code postal : NZ (code postal).$W$W # # MESSAGE POUR LES INVITES # ~~~~~~~~~~~~~~~~~~~~~~~~ # Vous avez un acces limite sur ce port.$W$W$=:$O>$W # # RESPONSE TO NON-BBS ON "BBS ONLY" PORT # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # #Desole, acces reserve aux BBS sur ce port.$W Desole, La messagerie F6FBB est arretee.$W # # MESSAGES DE CONNEXION # ~~~~~~~~~~~~~~~~~~~~~ # $WC'est votre premiere connexion sur cette messagerie.$W$O est situe a $c, $?.$WVous avez $0 message(s) nouveau(x).$W $WIl y a $0 message(s) nouveau(x). RN pour le(s) lire.$W $WIl y a $0 message(s) que vous avez lu(s) mais pas supprime(s).$W Vous etes reste connecte $: - Temps CPU : $.$W73 de $O.$W # # REPONSE A LA COMMANDE ! # ~~~~~~~~~~~~~~~~~~~~~~~ # $WBBS et Serveur par F6FBB V$E$W$Wcanaux:$W$% $W$N messages actifs - Dernier message $L - Dernier message liste $Z.$WMessages nouveaux pour:$W$Q$W$WVotre selection de message est $l.$WTemps de connexion : $: - Temps CPU : $.$W # # T_QST (QUESTIONS ET REPONSES STANDARDS) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Continue rret ontinue sans pagination Message suivant ..> Modification (O/N) ? Merci!$W $WAbandon!$W Creation (O/N) ? $WVotre choix (L=Liste, F=Fin) : Continue rret Lire Message # ..> # # T_ERR (MESSAGES D'ERREUR) # ~~~~~~~~~~~~~~~~~~~~~~~~~ # *** Erreur : Reponse erronnee.$W *** Erreur : La commande $0 est incorrecte, $I.$W *** Erreur : Il manque un espace ou un caractere apres la commande, $I.$W *** Erreur : Seule une reponse numerique est autorisee, $I.$W *** Erreur : Il manque le texte apres l'indicatif, $I.$W *** Desole : Il n'y a pas d'aide disponible pour $0.$W *** Erreur : Il manque l'indicatif de l'autre station, $I.$W *** Erreur : Il manque l'indicatif $I.$W *** Erreur : Il n'y a pas de fichier de ce nom, $I.$W *** Erreur : Le caractere $0 n'est pas interprete, $I.$W *** Erreur : Le message #%M n'existe pas, $I.$W *** Erreur : Le fichier $f n'existe pas, $I.$W *** Erreur : Vous ne pouvez pas supprimer le message #%M, $I.$W *** Erreur : #%M n'existe pas, $I.$W *** Erreur : Ce port n'est pas valide, $I.$W *** Erreur : Utilisez la commande CD, $I.$W *** Erreur : Le champ $0 est trop long.$W *** Erreur : L'adresse $0 est erronnee.$W *** Desole, vous avez deja transfere %d KB.$W *** Desole : Pas trouve!$W *** Erreur : Il manque le nom de fichier.$W *** Erreur : Il manque le fichier destination.$W *** Erreur : Cette langue est inconnue, $I.$W *** Erreur : Impossible de modifier $f.$W *** Erreur : Le repertoire "$0" n'existe pas, ou n'est pas vide.$W *** Erreur : Il manque le repertoire, $I.$W *** Erreur : Impossible de creer le repertoire "$0".$W *** Erreur : Il manque le chemin d'acces, $I.$W *** Erreur : Le chemin d'acces est trop long, $I.$W *** Erreur : Ce chemin d'acces n'existe pas, $I.$W *** Erreur : Impossible de creer le fichier $f, desole $I.$W *** Depassement temps!$W # # T_MBL (MESSAGERIE) # ~~~~~~~~~~~~~~~~~~ # # EXPERT, GUEST, NON-EXPERT PROMPTS # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $W$*:$O>$W $W$*:$O (B,KM,LM,O,RM,S,T,?) >$W $W$*:$O (A,B,C,D,F,G,I,J,K,L,M,N,O,P,R,S,T,U,V,W,X,Y,Z,?) >$W # # TEXTES GENERAUX #1 # ~~~~~~~~~~~~~~~~~~ # Il n'y a pas de message.$W Il n'y a pas de message nouveau.$W Entrez le sujet: Entrez le message, (Fin avec /EX ou Ctrl-Z):$W Le message #%M a ete supprime.$W # # REPONSE A LA COMMANDE V # ~~~~~~~~~~~~~~~~~~~~~~~ Logiciel F6FBB (V$E). $N messages actifs - Dernier message #$L.$W # # TEXTES GENERAUX #2 # ~~~~~~~~~~~~~~~~~~ Entrez votre prenom : Merci $I.$W Indicatif Dern-Connex #Cnx RPBSXLFEMUI Nom Password PRIV.$W $V n'est pas disponible, mais vous pouvez lui laisser un message.$W Attendez $I, j'appelle $V.$W $V n'est pas la mais vous pouvez lui laisser un message.$W $I, $V est au clavier:$W $W$I, $V voudrait vous parler.$W Vous etes maintenant en mode Expert.$W Vous etes maintenant en mode Normal.$W Vous etes en mode Serveur. Tapez F pour revenir en mode BBS.$W Le fichier $f a ete copie.$W Le message pour %G a ete annule (erreur d'adresse ou pas de titre).$W OP: Pagination programmee a : Devalidee$W OP: Pagination programmee a : $p lignes$W L'utilisateur est connecte, l'edition est impossible.$W $0 $1 $2 $3 $j $K = $4'$5 ON: Base Message programmee a : $0$W (B)id, (F)=Exp, (V)ia, (T)=Dest, T(I)tre, (S)tatus, T(Y)pe, (CR) fin >$W $W(R)=Ts msg, (P)agination, (B)BS, (S)ysop, e(X)pert, (L)ocal, (E)xclus, (M)odem,$W(U)=Unpro Msg, lan(G)ue, (N)om, pass(W)ord, pri(V), (H)omeBBS, (Z)=Code-postal,$W(CR)=fin >$W L'indicatif $0 est inconnu, creation (O/N) ? $WSupression de $0 O/[N] ? Langues disponibles:$W ($0):$1 $W ========== Fin du message #%M ==========$W$W # # REPONSE AUX COMMANDES $ (MESSAGE-#) OU FN (MESSAGE-#) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Message #$0$W # # HEADER DE MESSAGE # ~~~~~~~~~~~~~~~~~ # $WExpediteur : %P$WDestinataire: %G$0$WType/status : $t$s$WDate/heure : $j $K$WBid : $R$WNb lectures : %C$W # # HEADER DE LISTES # ~~~~~~~~~~~~~~~~ # #$WSelection des messages - [$l]$WMsg # TSL Dim Pour @ BBS Exped Date/Heure Sujet$W====== === ==== ===== ======= ====== ====/==== =======$W Msg # TSD Dim Pour @ BBS Exped Date/Heur Sujet Selection = [$l]$W # # CONTENU DES LIGNES DE LISTES # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $M $t$s%r $n $G$0 $P $i $1$W # Message # : %M$WTitre : $S$W Bid (Mid) : $R$W$W Routage vers $0-Routage via $v$W # # PROMPTS DU REVERSE FORWARDING, ET DU FORWARDING STANDARD # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ F>$W >$W # # MESSAGES DU FORWARDING # ~~~~~~~~~~~~~~~~~~~~~~ NO - Wrong parameter.$W NO - BID$W OK $W *** Done$W # Taille: %n$W Pas de routage programme vers %A. Je previens le sysop.$W La reponse sera adressee a %G@$v.$W OR: Acces a tous les messages : $0$W OM: Messages nouveaux a la connexion : $0$W Entrez votre BBS habituelle: Entrez votre code postal : HomeBBS: $0 Code postal : $1$W Attention! Pas de WP-Routage connu pour %G$W $W$0 message(s) retenu(s)$W $W(A)rchive,(K)=Supp,(L)ocal,(Q)uitte,(R,V)=Lit,(U)=Valide, (CR) fin >$W Message retenu pour validation par le Sysop.$W # # T_TRT # ~~~~~ # *** Occupe - Patientez SVP.$W *** Occupe - Connexion impossible.$W *** $0 n'est pas connecte.$W $W$B*** Connecte a $0 (Fin avec Ctrl-Z).$W *** Deconnecte.$W *** "Break" de $0 ***$W *** Fin du "break" ***$W "Break" pour $0 envoye.$W Demande d'arret de $0. Code: $1$W Demande d'arret acceptee, connexions interdites.$W Demande de reset acceptee, re-initialisation en cours.$W ################ Modifie pour 5.16 ######################### Continue rret ..> Demande d'arret rejetee.$W Vous etes en mode BBS. Tapez F pour revenir en mode Serveur.$W # # T_MEN (MENU SERVEUR) # ~~~~~~~~~~~~~~~~~~~~ # $WSERVEUR (C,D,N,Q,T,F,B,?) > $W $W(C) Connexions-Stat.$W(D) Documentations$W(Q) Qra-Locator$W(N) Nomenclature$W(T) Trajecto. Satellites$W(F) Retour en mode BBS$W(B) Deconnexion$W$WSERVEUR (C,D,N,Q,T,F,B,?) > # # T_STA (MODULE STATISTIQUES) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # $WCONNEXIONS-STAT. (G,H,I,J,L,O,F,B,?) > $W $W(G) Generalites$W(H) Utilisation horaire$W(I) Liste des indicatifs$W(J) Utilisation par jours$W(L) Details$W(O) Pourcentages$W(F) Retour au serveur$W(B) Deconnexion$W$WCONNECTIONS-STAT. (G,H,I,J,L,O,F,B,?) > Utilisation par jour$W LUN MAR MER JEU VEN SAM DIM$W Utilisation par heure$W 0 0 0 0 0 1 1 1 1 1 2 2 Heure$W 0 2 4 6 8 0 2 4 6 8 0 2$W $N messages actifs$W $0 Connexions depuis $j$W Connexions$W Temps moyen par connexion : $0min $1s$W Nombre de conexions / jour : $0$W Heures de pointe : A $1:00h et $0:00h.$W Utilisation (en pourcentage)$W BBS : $0 %%$W Serveur : $0 %%$W Details serveur :$W DOS : $0 %%$W Qra-Locator : $0 %%$W Docs : $0 %%$W Connexions-stat : $0 %%$W Nomenclature : $0 %%$W Satellites : $0 %%$W $0 $1 $2 $3 $j $K = $4'$5"$W # # T_NOM (MODULE NOMENCLATURE) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # $WNOMENCLATURE (I,N,R,F,B,?) > $W $W(R)echerche$W(I)ndicatifs$W(N)om et adresse$W(F) Retour au serveur$W(B) Deconnexion$W$WNOMENCLATURE (I,N,R,F,B,?) > $WIndicatif: $0$W $WDerniere connexion le $j a $K.$W Nom, prenom : $1 $0$WAdresse : $2, $3$WLocator : $4$WTel. Perso : $5$WTel. Modem : $6$WHome-BBS : $7$W Nom : Numero, rue : Ville : Telephone, perso : Telephone, modem : Qra-locator : $WTotal $0 indicatifs$W *** Indicatif $0 inconnu.$W *** Erreur Qra-locator (format : deux lettres, deux chiffres, deux lettres).$W # # T_TRJ (MODULE SATELLITE) # ~~~~~~~~~~~~~~~~~~~~~~~~ # $WSATELLITES (C,P,T,F,B,?) > $W(M) Mise a jour$W $W(C) Description$W(P) Parametres orbitaux$W(T) Calcul de trajectographie$W(F) Retour au serveur$W(B) Deconnexion$W$WSATELLITES (C,P,T,F,B,?) > $WQRA-Locator : $0 Satellite $1$W --------------------------------------------------------------$W | Heure | Az. | El. | Dpl. | Dist. | Alti. | Lon | Lat | Ph. |$W | UTC | Deg | Deg | KHz | Km | Km | Deg | Deg | 256 |$W --------------- $j-$y ----- Orbite #$0 ----------------$W | $0:$1 | $2 | $3 | $4 | $5 | $6 | $7 | $8 | $9 |$W Date de debut de clacul (DD/MM/YY) (Return = defaut) : Heure de debut de calcul (HH:MM) (Return = defaut) : $WPatientez SVP...$W $WPas d'information sur ce satellite.$W # Derniere mise a jour $j-$y.$W Nom du satellite : Orbite de reference : Annee de reference : Jour de reference : Anomalie moyenne : Arg. de perigee : R.A.A.N. : Inclinaison : Excentricite : Mouvement moyen : Derivee du mvt moyen: Pas de calcul (mn) : Frequence emission : $WParametres orbitaux de $0$W Numero d'orbite : $0$W Annee : $0$W Jour : $0$W Anomalie moyenne : $0$W Arg. de perigee : $0$W R.A.A.N. : $0$W Inclinaison : $0$W Excentricite : $0$W Mouvement moyen : $0$W Derivee du mvt moyen: $0$W Pas de calcul : $0$W$W ($0) $1 (F) Fin$W # # T_QTH (MODULE QRA LOCATOR) # ~~~~~~~~~~~~~~~~~~~~~~~~~~ # $WQRA-LOCATOR (C,D,L,Q,F,B,?) > $W $W(Q) Qra -> Long/Lat$W(L) Long/Lat -> Qra$W(D) Dist. et Azimuth$W(C) Distances$W(F) Retour au serveur$W(B) Deconnexion$W$WQRA-LOCATOR (C,D,L,Q,F,B,?) > $WEntrez votre Qra Locator SVP (Q to Quit) :$W Coordonnees geographiques au centre du carre :$W Longitude : $0 degres $1' $2 : $3 grades $2$W Latitude : $0 degres $1' $2 : $3 grades $2$W $WUtilisez le format$WEn degres = 1:45:00 [direction].$WEn grades = 1.5 [direction]$W[direction] sera remplace by Nord, Sud, Est ou Ouest.$W $WLongitude (Est/Ouest) : $WLatitude (Nord/Sud) : $WQra Locator : $0$W $WQra Locator origine : Qra Locator destination : Azimuth : $0 degres $1' : $2 grades$W Distance : $0 Km$W $WVotre Qra Locator : $WQra Locator destination (F = Fin) : Nombre de calculs $0 - Total des distances : $1 Km$W Calcul termine.$W # # T_DOS (MODULE DOS) # ~~~~~~~~~~~~~~~~~~ # $W[%dKB] $u:$0> Repertoire $0 supprime.$W Pas de fichier.$W $0 $1 $2 $3 $4 $5 $6 $7$W Envoi du fichie $f interrompu.$W Le fichier $f de $0 octets a ete transfere ($1 octets/s).$W Envoyez le fichier $f (Fin = Ctrl-Z).$W $0 octets copies.$W $W$j $T FBBDOS V$E$W $WCommandes disponibles :$W Le fichier $f a ete supprime.$W $W$0 octets libres. # # T_INF (MODULE DOCUMENTATION) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # $WDOCS$0 (#,L,R,F,B,?) > $W(D) Description.$W $W(numero) Lire la doc (numero)$W(L) Liste$W(R) Retour au niveau precedent$W(F) Retour au serveur$W(B) Deconnexion$WDOCS$0 (#,L,F,R,B,?) > Cette entree n'existe pas.$W # # T_GATE (GATEWAY MODULE) # ~~~~~~~~~~~~~~~~~~~~~~~ Vous etes sur le canal $=, port $!. $g port(s) disponible(s).$WAcces au LINUX-FpacNode F6FBB-10 sur port NETWORK$WH = Aide. Q = Quitte.$W Entrez le numero de port (Q = Quitte) : Vous utilisez le canal $0 du port : $1.$W Desole, pas de canal disponible sur ce port.$W Cmd : Mode conversation. Esc ou >(return) pour revenir en mode commande.$W *** Erreur : Vous etes deja sur ce port!$W *** Erreur : Port invalide.$W *** Le gateway n'est pas disponible, $I.$W $O: Commande $0 invalide. (C,D,J,K,H,M,P,Q,?) >$W Envoi de $f...$W Capture du texte dans le fichier $f.$W Capture du texte terminee.$W # # T_YAP (MODULE YAPP) # ~~~~~~~~~~~~~~~~~~~ # Envoie le(s) fichier(s) $f avec le protocole $0.$W Pret a recevoir le fichier $f avec le protocole $0.$W Desole, $0 n'est pas autorise sur ce port.$W Description du fichier, max 40 caracteres : $0 $1 $2 $3 $4$W # # T_CNF (MODULE CONFERENCE) # ~~~~~~~~~~~~~~~~~~~~~~~~~ # Vous entrez dans la conference (Aide = ".?").$W Il est $H. Stations dans la conference :$W Indicatif : $0, canal $1.$W $H $0 entre dans la conference.$W Vous quittez la conference.$W $H $0 a quitte la conference.$W $W[$H - $0]$W Il n'y a personne dans la conference.$W $H $0 : Trop de repetitions.$W $H $0 : Occupe.$W $H $0 n'est pas dans la conference!$W # # **Fin du fichier** # (Ouf!) # # T_THE (MODULE THEMES) # ~~~~~~~~~~~~~~~~~~~~~~~~~ # Msg # Dim Pour Exped Sujet (Theme:%T)$W $M $n $G $P $1$W %T - %t bulls (B,F,H,L,R,Numero) : # # fbb-7.04j/conf/lang/english.hlp0100644000175100017510000016646707726646106014450 0ustar abaaba############################# # ENGLISH.HLP for FBB 5.15b # # by LA6CU 26-12-93 # ############################# ################# # Guests are -1 # ################# @@ -1 ? You have only a limited set of commands : H : Read this help-text. KM : KILL all messages to you, that you have read. LM : LIST all messages to you. O : Choose "options" (language, paging). RM : Read all messages to you. RN : Read all NEW messages to you. S : SEND a message. T : "Talk" to sysop. B : Bye (disconnect). ################# # SERVERS are 0 # ################# @@ 0 ? *** That command is not available here !! Available commands are : C : Connections - statistics. D : Documentation. N : Call-book (nomenclature). Q : Qth-locator (calculations etc). T : Satellites, trajectory F : Return to BBS mode. B : Disconnect. Press ? [LETTER] for more detailed information on one special command. @@ 0 C CONNECTIONS - STATISITICS ------------------------- Here you can get statistical information on the use of this BBS. @@ 0 D DOCUMENTATION ------------- Here you can get information and documentation of various kind. The commands are numerical. @@ 0 N CALL-BOOK (NOMENCLATURE) ------------------------ In this module you will find any information that users have wanted to leave : Surname, first-name, address, telephone, etc ... You can enter your own information in the same way. @@ 0 Q QTH LOCATOR ----------- The QTH Locator describes one geographical position. This is done with a succession of 2 letters, 2 numbers and 2 letters. Example: JP20QI You can change a QTH-locator into longitude and latitude, or vice-versa, calculate the distances and headings between two QTH-locators, or calculate your contest scores (cumulative distances). @@ 0 T SATELLITE TRAJECTORY -------------------- Trajectory calculator, orbital parameters and the charactaristics of several amateur satellites. @@ 0 F RETURN TO BBS-MODE. ------------------- With this command you can return to BBS-mode. @@ 0 B DISCONNECT. ----------- With this command you can log off the BBS directly, without going back to BBS-mode first. ########################### # QRA-locator server is 2 # ########################### @@ 2 ? *** That command is not available here !! Available commands are : C : Sum the distances between a point and several QTH-locators. D : Calculate distance and heading between two QTH-locators. L : Change longitude and latitude into QTH-locator. Q : Change QTH-locator into longitude and latitude. F : Return to server menu. B : Disconnect. Press ? [LETTER] for more detailed information on one special command. @@ 2 Q Command Q : Change a QTH Locator into longitude and latitude. The longitude and latitude are given in degrees/minutes and in gradians. @@ 2 L Command L : Change Longitude and Latitude into a QTH Locator. The longitude and latitude can be entered in degrees and hundredths, degrees and minutes, or in gradians. Correct format must be used: Degrees : 1:45:00 (direction) Gradians : 1.5 (direction) where [direction] must be replaced by North, South, East or West. Remember to use CAPITAL letter as first letter ! @@ 2 D Command D : Calculate the distance and heading between two QTH locators. The distance is given in Km and the heading in degrees. @@ 2 C Command C : Sum of calculated distances. Having entered the QTH-Locator, which serves as the origin for the calculations, you could give a destination QTH-locator. The calculated distance could be summed with a second or several other calculations. It permits you to calculate the total number of Km. Distances shorter than 1 km is given 1 point in the calculations. @@ 2 F Command F : ----------- With this command you can go back to server-menu, and continue from there. If you want to leave server-mode, you can press F once more. @@ 2 B Command B : ----------- With this command you can log off from the BBS without going back to BBS- mode first. ################### # STATISTICS is 3 # ################### @@ 3 ? *** That command is not available here !! Available commands are : G : General statistics. H : Graphic display of use pr hour. I : List of callsigns that have used this BBS. J : Graphic display of use pr day. L : Detailed list of connected stations (can be aborted by the A-command). O : Use of mailbox and servers (percentages). F : Return to server menu. B : Disconnect. Press ? [LETTER] for more detailed information on one special command. @@ 3 O Command O : Shows the usage of mailbox and servers (percentage), and also the usage of each server individually. @@ 3 G Command G : General statistics about the server: - Number of active messages. - Number of connections in this BBS. - Average time pr connect. - Average number of connects pr day. - High-traffic hours. @@ 3 L Command L : Show detailed information on each connect: - Port (A, B etc) - Channel-number - Number of each connect (starting from 1) - Callsign - Date - Time (start of connection) - Number of minutes and seconds for the connect The list is shown in revers chronological order, and can be aborted with the A-command. @@ 3 H H : Graphic display of mailbox-usage each hour. H [call] : Graphic display of usage of a callsign. "Wildcards" are allowed here. For example: H W* : Gives a graphic display of usage from all W-stations. @@ 3 J J : Graphic display of daily total use of the mailbox. J [call] : Graphic display for a callsign. "Wildcards" are allowed here. For example: J W* : Gives graphic display of usage from all W-stations. @@ 3 I I : List all callsigns that have used this mailbox. The list is sorted in alphabetical order. "Wildcards" are allowed, for example: I W* : Gives a list of all W-stations. @@ 3 F Command F : ----------- With this command you can go back to server-menu, and continue from there. If you want to leave server-mode, you can press F once more. @@ 3 B Command B : ----------- With this command you can log off from the BBS without going back to BBS- mode first. ###################### # DOCUMENTATION is 4 # ###################### @@ 4 H DOCUMENTATION: -------------- To read a file from the list, just type the number for the file. New files are entered with the NEWDOC-server in BBS-mode. Get help for this in BBS-mode (? NEWDOC). Send L to see the list of files. Sysop: DESCRIPTION can be changed with the D-command: D BBS.DOC Description Press ? [LETTER] for more detailed information on one special command. @@ 4 F Command F : ----------- With this command you can go back to server-menu, and continue from there. If you want to leave server-mode, you can press F once more. @@ 4 B Command B : ----------- With this command you can log off from the BBS without going back to BBS- mode first. @@ 4 D Command D (only for sysop) : ---------------------------- Sysop can use this command to edit the description of a file. Command D (filename) (description) @@ 4 L Command L : ----------- Use this command to see list of available files. @@ 4 R Command R : ----------- If you have moved to a sub-directory of DOCS, use R to return to previous directory-level. ##################### # NOMENCLATURE is 5 # ##################### @@ 5 ? *** That command is not available here !! Available commands are : I : List of callsigns that have connected. N : Change your name and address details, telephone-number and QTH-loc. R : Search for information on a user. F : Return to server menu. B : Disconnect. Press ? [LETTER] for more detailed information on one special command. @@ 5 N Command N : Change your surname and address. If the entries in the address file are incorrect or they have changed, you can change them with this command. A or in response to the question will not modify the contents. If the contents of the file are correct, you stop the changes by replying N to the Change (Y/N) question. For SYSOP : Sysop can change user-data with command N (callsign). @@ 5 R Command R : Search for informations on a user. You can send R alone, then the BBS will prompt you for a callsign, or you can send R [callsign] directly. Example: R LA6CU @@ 5 I Command I : List of the callsigns that have connected to the BBS. This is in alphabetical order. @@ 5 F Command F : ----------- With this command you can go back to server-menu, and continue from there. If you want to leave server-mode, you can press F once more. @@ 5 B Command B : ----------- With this command you can log off from the BBS without going back to BBS- mode first. ####################### # TRAJECTOGRAPHY is 6 # ####################### @@ 6 ? *** That command is not available here !! Available commands are : C : Charactaristics of amateur satellites. P : Obtain the orbital parameters. T : Calculate the trajectory of a satellite. F : Return to server menu. B : Disconnect. After commands C, P and T send L for list of satellites. Press ? [LETTER] for more detailed information on one special command. @@ 6 T Command T : Calculate a satellite's trajectory. After choosing the satellite for which you want the trajectory, you have to enter the date and time from which the calculations start. The geographical position is the QTH-locator of the connected station, if it is in the file, else the QTH-locator of the server will be used by default. Following the satellites, the calculated pass could be variable, and a line of parameters will be displayed each pass. This calculated line corresponds to a minimum elevation of -5 yourees, when the satellite is 5 youress below the horizon. After command T send L for list of satellites. @@ 6 P Command P : Display the orbital parameters of the selected satellite. These parameters are used for the calculations. After command P send L for list of satellites. @@ 6 C Command C : Characteristics and information on the selected satellite. After command C send L for list of satellites. @@ 6 F Command F : ----------- With this command you can go back to server-menu, and continue from there. If you want to leave server-mode, you can press F once more. @@ 6 B Command B : ----------- With this command you can log off from the BBS without going back to BBS- mode first. ############### # 9 is FBBDOS # ############### @@ 9 ? Available commands in FBBDOS are: ? and HELP - This help-text. O - Options (paging, base-number etc) DIR - Show directory-listing. ########################################################################### # New in 5.15: DU - Show disk-usage. ########################################################################### EDIT - Edit a file. GET - Download an ASCII file from the BBS. PUT - Upload an ASCII file to the BBS. CD - Change Directory. MD and MKDIR - Make Directory. COPY - Copy a file. DEL - Delete a file. RD and RMDIR - Remove a Directory. TYPE - Download an ASCII-file with paging. ############################################################################ # New in 5.15b BGET - Download a file with AUTOBIN (via radio) BPUT - Upload a file with AUTOBIN (via radio) YGET - Download a file with YAPP (via radio) YPUT - Upload a file with YAPP (via radio) XGET - Download a file with XMODEM (via modem) XPUT - Upload a file with XMODEM (via modem) X1GET - Download a file with 1k-XMODEM (via modem) YGET - Download a file with YMODEM (via modem) ZGET - Download a file with ZMODEM (via modem) ############################################################################ LIST - Show directory-listing WITH labels (if available). PRIV - Go to a special directory (private...). VIEW - See contents of .ZIP. .ARC and .LZH-files. NEW - See all new files since last NEW-command. EXIT, F and QUIT - Return to BBS-mode. B - Disconnect. You can go from one disk to another (like in MSDOS) with commands A: or C: etc if the BBS uses more than one (physical or virtual) disk. For more detailed help with one command, type ? (command) ############################################################################# @@ 9 HELP Command "HELP": --------------- Command "HELP" shows all available commands under FBBDOS. @@ 9 B Command "B": ------------ Logs off the BBS directly (disconnects). @@ 9 CD Command "CD": ------------- Command "CD" is used (like in DOS) to change directory. Example: CD \TEST "CD .." is used to go back to the previous directory-level. @@ 9 COPY Command "COPY": --------------- COPY-command is for copying files. If the filename already is used, the old file will be over-written. Example: COPY TOTO.TXT TEST.TXT @@ 9 DEL Command "DEL": -------------- DEL-command is for deleting files. You can only delete files that YOU have uploaded, only SYSOP can delete other users' files. @@ 9 DIR Command "DIR": -------------- DIR-command shows the contents of the present directory. DIR can also use a path, like: DIR \TEST Wildcards are also allowed here, like: DIR *.SYS @@ 9 DOS SYSOP can now run DOS-programs from remote. Sysop must be in FBBDOS and send the command DOS [program] [parametre] Output from that program will go back to the sysop. The program cannot take any input from sysop after it has started. If anything goes wrong in the task the DOS-program is run, the task will be shut down after 3 minutes and the BBS will continue to work as before. ########################################################################### # New in 5.15: @@ 9 DU Command "DU": ------------- Use DU-command to see used/available disk-space. ########################################################################### @@ 9 EDIT Command "EDIT": --------------- This command is used for editing text-files in this BBS. Here are the available commands: ? : Shows all commands that can be used in the editor. A : Adds a line after the current line. The text for the new line shall follow the letter A. If more commands are to follow after the text, the text must be ended with a "/" before next command. If the sign "/" itself is to used in the text, a "\" must be written just before the "/". If again the "\" is to be used inside the text as a valid character, it must be written twice ("\\"). The pointer will be at the start of the new line. B : Go to start of file. E : Go to end of file. F : Search for the first occurrence of a character (or string of characters) in the file. The search starts at the current line. The string of characters must be ended with a "/" if more commands are chained (se the paragraph on the A-command). I : Insert a line before the current line. Read about ending with a "/" in the paragraph on the A-command. K : Delete the number of lines that are stated just before the letter K. Example: 3K If no number is used, then 1 line is deleted. L : Move a number of lines from the current line. The number can be negative to move towards the start of the file. Examples: 5L -10L N : Toggle line-numbering on/off. P : Show a number of lines from the current line. Example 8P. This will show 8 lines, starting with the current line. R : Search and replace. Search for a string of characters and replace it with a new one. Example: RALL/ALLE will replace all ALL with ALLE from the current line to the end of the file. S : Save file. Q : Exit the editor without saving the file. Examples:: "EDIT>B5L10P" sets pointer at start of file. Move 5 lines down, and show 10 lines from there. "EDIT>B4L6K-2L1OP" sets the pointer to the start of file. Move down 4 lines. Delete 6 lines. Move back 2 lines, and show 10 lines. "EDIT>BFBonjour/K-2L5P" sets the pointer to the start of file, searches for "Bonjour", deletes the line containing "Bonjour", moves back 2 lines and shows 5 lines. "EDIT>BFBonjour/IC'est une nouvelle ligne avec un \/ dedans/-1L3P" sets the pointer to start of file. Searches for "Bonjour", inserts the new line. The new line also contains the character "/". Goes back 1 line and shows 3 lines. "EDIT>SQ" save file and quit the editor. @@ 9 EXIT|QUIT|F Commands "EXIT", "QUIT", "F". ----------------------------- Leave FBBDOS and return to BBS-mode. @@ 9 GET Command "GET": -------------- Use this command to download an ASCII-file from the BBS without paging. Example:GET NORSK.MAN @@ 9 LIST Command "LIST": --------------- Lists files (also ASCII-files) in the same manner as YI lists YAPP-files with labels. @@ 9 MD|MKDIR Commands "MD" or "MKDIR": ------------------------- Use this command to make a new directory. Example: MD TEST @@ 9 NEW Command "NEW": -------------- List all new files, in all available directories, that have arrived since you last sent NEW. @@ 9 O|OL|ON|OR|OP Command "O". ------------ O-command gives you different options: O alone shows you what language you are using, paging and base-number. - Type OP to toggle paging on messages. - Type OP [number-of-lines] to select paging with a specific number of lines per page. - Type OL alone to get a list of available languages. - Type OL[space][language-number] to choose a language. - Type ON alone to see your base-number. - Type ON [number] to choose a new base-number. The number you type, will be multiplied by 1000, so if you type ON 54, your base-number will be 54000. After that, you can type R 25 to read message number 6025. It is also allowed to type ON 54000. - Type OR to choose if you want to list/read all personal messages in the BBS. - Type OM to choose if you want to receive the list of new messages at every connect. @@ 9 PUT Command "PUT": -------------- Use this command to upload an ASCII-file to the BBS. If the filename exists, the file will not be over-written ! You must delete it first. However, you cannot delete files that have been uploaded by other users, you can only write over your "own" files. Example: "PUT TEST.TXT" @@ 9 PRIV Command PRIV ------------ PRIV is a special command in FBBDOS. It gives authorized users access to a special directory. All users can be authorized, not only sysops.. @@ 9 RD|RMDIR Commands "RD" or "RMDIR": ------------------------- Remove a directory with this command. You can only remove empty directories, and anly if YOU have created that directory. @@ 9 TYPE Command "TYPE": --------------- Use this command to download a file from the BBS, using paging. (That is; if you also use paging in BBS-mode...). @@ 9 VIEW Command "VIEW". --------------- Use this command to see the contents of archived files, like *.ZIP. *.LZH. *.ARC etc. Use it like this: VIEW filename.ext ########################################################################### # BGET/BPUT new in 5.15b @@ 9 BGET Command "BGET": --------------- Use via radio to download a file with AUTOBIN-protocole. @@ 9 BPUT Command "BPUT": --------------- Use via radio to upload a file with AUTOBIN-protocole. ############################################################################## ############################################################################# # New in 5.15b: X1GET @@ 9 XGET|X1GET Commands "XGET" and "X1GET": ---------------------------- This command is used for nownloading files with the XMODEM- or 1K-XMODEM- protocole. This works only on telephone-modem port on the BBS. Example: "XGET FICHIER.EXE" ############################################################################# You can resume a download from the point you last stopped, by command XGET (filename) (offset). Example: XGET FICHIER.EXE 150000 starts download from byte 150000. The files can later be put together to 1 with the program called CUT. @@ 9 XPUT Command "XPUT": --------------- This command is used for uploading files with the XMODEM-protocole. This works only on telephone-modem port on the BBS. Example: "XPUT TEST.EXE" ############################################################################# # New in 5.15b: YGET for modem: @@ 9 YGET Command "YGET": -------------- This command is used for downloading files with the YAPP-protocole. Example: "YGET FICHIER.EXE" Via telephone-modem YGET can be used for downloading files with YMODEM, YMODEM-BATCH or YMODEM-G. ############################################################################## @@ 9 YPUT Command "YPUT": --------------- This command is used for uploading files with the YAPP-protocole. Example: "YPUT TEST.EXE" ########################################################################### # ZGET for modem new in 5.15b @@ 9 ZGET Command "ZGET": --------------- Use this command to download a file with the ZMODEM-protocole. ############################################################################## ################## # BBS-mode is 14 # ################## @@ 14 ? - Type ? [COMMAND] for HJELP with a command. Examples: - type ? H for a list of all the most important commands. - type ? O for help on available options (languages, paging etc). (Paging is toggled on/off with OP-command) - Type ? REQDIR or ? REQFIL for help on these servers. Remember to press or after each command (hi). X toggles your status between EXPERT and NORMAL user. A can be used to abort listings. I shows information about this system. Last used message-number can be repeated with the use of the #-character. Example: R 1235. Next command: K # For SYSOP: Overview of all commands for sysop with ? SYSOP. Overview of all the function-keys with ? FUNCTION. @@ 14 A|ABORT In the middle of a long listing from the BBS, you can send the command A (ABORT) to stop the listing. The listing will stop after a short while, and the BBS will ask you if you want to read some of these messages (listing continues after reading the messages), if you want to continue listing messages, or if you want to stop all listing. If so, the normal BBS-prompt will return. ############################################################################# # New in 5.15: N og C When reading messages with paging, you can also use commands N and C if you are reading many messages, for example if you sent R 123 234 345 654. Use N to skip the rest of current message and start with the next one. Use C to cancel paging for the rest of the messages. ############################################################################## A can also be used many other places, for example when downloading long ASCII-files. @@ 14 ACK By typing /ACK in the first column of a line in a message, you will receive an acknowledge- message from the receiver-BBS when the message arrives there. This works ONLY in FBB-BBSs. @@ 14 B The "B" command logs you off the PBBS and disconnects you. - Type "B" to LOG OFF gracefully [Bye]. Be sure to hit or after each command. ########################################################################### # Changed in 5.15 - NOTE: When you use B to disconnect, your last listet message (from this session) is being saved till next connect. If for some reason yoy are disconnected, this last-listed parametre is not changed. So you can reconnect and list the same list once more. ########################################################################### @@ 14 C|CW - The "CW" command lists the call-signs in conference. - The "C" command lets you enter in conference. In conference, all commands must begin by a point on first column. The commands are : .C[port] CALL-SIGN [V REPEAT ...] connects a call-sign on a port. .D disconnects a user from the conference. .H gives you this help file. .W lists the call-signs in conference. .Q lets you leave the conference. @@ 14 D|DOS|DOWNLOAD D-command has 2 different functions. 1) If you send D [filename], the mailbox will send you the file with that name. This file must be in the root-directory for users. If the file is in a subdirectory, you must use fulle path, like this: D VHF/VHF.DX See also help with the W-command (? W). 2) If you send the letter D alone, you will enter FBBDOS. The commands in FBBDOS are very similar to those of MS-DOS. Users have access to a part of the BBS's hard-disk in FBBDOS. Following commands are allowed here: ? HELP >= Use one of these to get help. DIR >= List files in this directory. MD MKDIR [name] >= Use one of these to make a new directory. RD RMDIR [name] >= Use one of these to remove a directory. You cannot be in the directory you want to remove, and the directory must be empty. CD [name] >= Use CD to change directory. COPY [from] [to]>= Copy a file named [from] to a file named [to]. Can also be used to copy between directories. DEL [filename] >= Deletes the file [filename]. TYPE [filename] >= Download the ASCII-file [filename] from the BBS. The file is divided into pages, if you use paging when in BBS-mode. The file must be in your current directory. GET [filename] >= Identical to TYPE, but always without paging, and the file is always ended with a CTRL-Z. PUT [filename] >= Use this command to upload an ASCII-fil to this directory. ############################################################################ # New in 5.15b: BPUT and BGET >= Use for upload or download of files via radio with AUTOBIN-protocole. YPUT and YGET >= These are identical to PUT and GET, but uses the YAPP-protocole for binary transfer. Except: Via telephone-modem YGET can be used to download files with YMODEM, YMODEM-BATCH or YMODEM-G. ############################################################################ XPUT and XGET >= These are identical to YPUT and YGET, but uses the XMODEM-protocole for binary transfer. Only for telephone-modem. ############################################################################ # Nytt i 5.15b: X1GET >= As XGET, but with 1K-XMODEM protocole. ZGET >= As XGET, but with ZMODEM-protocole. ############################################################################ EDIT [filename] >= This is a small editor for editing texts and files in the BBS. You can use this editor ONLY on files that YOU have uploaded to the BBS. Get more info with ? EDIT F B EXIT QUIT >= Use one of these to go back from FBBDOS to BBS-mode. O >= Use this to set "options" like in BBS-mode. LIST >= Same as DIR, but shows also descriptions of files, if users have provided such an description.. PRIV >= Gives special users access to a special directory. VIEW >= See the contents of an archived file like *.ZIP, *.LZH etc. VIEW filename.ext NEW >= List all new files since you last sent NEW @@ 14 E|EU This command is only for sysop and remote-sysop. EU [callsign] to edit a user. E [msg#] to edit a message. @@ 14 F F - command gives you access to SERVER-mode and special commands. In "server-mode" you can do several things: Get statistics of the use of this mailbox. Read documentation of different kind. Read info on all users of this mailbox. Calculate QTH-locatorer and distances between several QTH-loactors. Calculate trajectory of different sattellites. For more information, type ? when you have entered SERVER-mode. For detailed information, type ? [command]. @@ 14 FUNCTION Here is an overview of all function-keys: F1 - General help on all function-keys. F2 - Connect to the BBS locally with the console-callsign. F3 - Disconnect a channel. F4 - Start or stop forwarding. F5 - Toggle monitoring on/off. With monitor on, the lower part of the screen displays the monitored traffic, while the upper part of the screen shows traffic in the BBS. Number of lines in upper/lower part of the screen, can be adjusted with the arrow-up or arrow-down keys. F6 - Change console-callsign. That callsign is used when connecting to the BBS with F2. The callsign have sysop-status. F7 - Program TNC directly. F8 - Reboot PC. Can be done at once, or when all channels are free. F9 - Gateway, using console-callsign. F10 - Talk to a user (that have sent a T) or initiate a chat with a user. ALT-F1 - Shows pending forward(s). Shows number of personal messages, bulletins, and the total amount of kB waiting to be forwarded. ALT-F2 - Shows all callsigns connected to the BBS. ALT-F3 - Start or stop forward-scan. ALT-F4 - Shows the last connected callsigns. ALT-F5 - Starts a very simpel text-editor (use F1 for help there). ALT-F6 - Various "options" : Sysop is inn ? Beep at connect ? Show callsigns etc. on every channel ? Gateway allowed ? Justification ? ALT-F7 - Import messages from file. ALT-F8 - Export messages to file. Messages that are waiting to be forwarded to one BBS. These messages can be forwarded to a file. ALT-F9 - Exit to DOS. The BBS is halted during that time. ALT-F10- Stop the mailbox-program. Can be done at once, or when all channels are clear. ############################################################################ # New in 5.15e: ALT-B - Blank screen. ALT-D - Save scroll-buffer. ALT-R - Redisplay screen. ALT-S - Show last DOS-screen. Press a key to return to BBS. ALT-X - Stop the BBS (same as ALT-F10). ############################################################################ CTRL-F1 to CTRL-F10 holds pre-defined texts, that are sent when pressing that key. The texts are in the file MEMO.SYS. @@ 14 G|GATEWAY G - command gives you access to the GATEWAY (if the BBS allows gateway, and if there is a channel available on the gateway-port). @@ 14 H|HELP List of available commands : A : Abort - Abort listing. B : Bye - Log off the BBS. C : Conference - Access to conference. D : DOS - Access to FBBDOS, or to download a file. F : FBB - Access to server mode. G : Gateway - Access to other frequences by 'gateway'. H : Help - Help. I : Info - Information about the system. J : Jheard - List of the last few connected stations. K : Kill - Kill messages. L : List - List messages. M : Make - Copy a message to a file. N : Name - Change your name. NZ: Zip - State your zip-code. NH: homeBBS - Type your home-BBS. O : Option - Select options (paging, language, list/read personal etc). PS: Servers - Show which servers are available in this BBS. PG: Program - Run (show) certain DOS-programs. R : Read - Read messages. S : Send - Send messages. T : Talk - Talk to SysOp. U : Upload - Upload a file to the BBS. V : Verbose - Verbose read of messages (like R, but with forwarding headers). W : What - Which files are available. X : Expert - Change between Normal and Expert. Y : Yapp - Transfer binary files with the Yapp transfer protocol. Z : Delete - Delete a file. + : Append - Only for sysops: Append a file after a message. > : Send text - To send a text to another station connected to the BBS. = : Connect - To connect another station connected to the BBS. ! : Info - Short version of the I-command. $$ : Forwardet - Only for sysop: Show what BBSs that will receive, or already have rceived a message. * : Wildcard - Many possibilities, like @,?,#,=,* For detailed help on each command, type ? [command]. ######################################################################### # WP-info new in 5.15 @@ 14 I|IH|IL|IZ|I@|INFO I - command gives you information about this BBS. For White Pages: I (call) - Gives WP-info on this callsign. ID - Gives number of records in WP. IH zone - Look for users in zone (EU, NOR etc). IZ (zip) - Look for users with specific zip-code. I@ (bbs) - Look for users of that BBS. In most WP-commands, "wildcards" are allowed. ######################################################################### @@ 14 J|JA|JB|J1|J2|JK J-command sends you a list of the last connected stations. - Type JK to see the last connected stations. - Type JA to see callsigns that have connected to TNC-A. - Type J1 to see callsigns that have been MONITORED on TNC-A. - Type JB to see callsigns that have connected to TNC-B. - Type J2 to see callsigns that have been MONITORED on TNC-B. and so on... @@ 14 K|KILL|KM|KK K-command is for killing messages TO or FROM you. - Type K[space][message#] to delete one special message. - Type KM to delete all messages to you, that you have read [Kill Mine]. This command will NOT kill messages that you have not read ! PS : You cannot delete messages that are not TO you or FROM you, only SYSOP can dio that.. SYSOP: In front of K-commands, you can put an extra K, like KKM, KKF etc. In that manner the messages will get A-status (normally K) at once. @@ 14 L|LIST|LB|LM|LN|LL|LS|L<|L>|L@|LU|LR|LC|LD>|LD< L-command LISTS all messages in the mailbox. L lists all new messages since you last issued a L-command. LB lists only bulletins. LC for very special listings. See further down.. LM lists all messages TO YOU [List Mine]. LN lists all UNREAD messages to you [List New]. LL 10 lists the last 10 messages in the mailboxen [List Last]. LS [Text] lists messages with [text] in the subject. L< [callsign] lists messages FROM [callsign]. L> [callsign] lists messages TO [callsign]. L@ lists local bulletins with no @BBS-field. L@ [callsign] lists messages @[callsign]. L [message#]- lists ONLY messages with higher number than [messages#]. L [message#]-[message#] lists all messages between these numbers. LU lists all UNREAD messages (status N) to and from you. LR lists messages in revers order, starting with the oldest one. LR can replace L in most contexts (ex: LR 1-100) Examples: - To list messages over #325, type L 325- - To list messages from #300 to #350, type L 300-350 PS: Check number of active messages before doing a list-command, to avoid listing every messages in the system. This is easy to check with the V-command. Special command LC: With this command you can have very special listings. If you once type LC DX, then all list-command (except LM and LN) will only list messages with a TO-field of DX. If you type LC *DX*, listings will contain all to-fields that have DX in it, for example VHFDX, DXHF etc. To go back to "normal", send LC * LC ? or LC ; gives a list of available LC-fileds. @@ 14 M|MH|MV|MA|MVA|MHA M [number] [name] : Copy a message to file. MH [number] [name] : Same, but in same format as R (msg#). MV [number] [name] : Same, but in same format as V (msg#). These commands will overwrite old messages. MA [number] [name] : Copy a message to file. MHA [number] [name]: Same, but in same format as R (msg#). MVA [number] [name]: Same, but in same format as V (msg#). These commands do NOT overwrite old messages, but append the next text to the old file. ######################################################################### Only for sysops; M can be used instead of L. The listing then will have the BID included in the subject. @@ 14 N|NAME N-command is used to enter (or later change) your name in the BBS. You can use max 12 characters. "Phoney" names will be deleted, use your own first-name. - Type N[space][first-name] See also help with NP, NL, NQ, NZ, NH. @@ 14 NH|HOMEBBS Use this command to state your home-BBS. @@ 14 NP This command is for changing your password for access to the modem-port. ######################################################################## # Changed in 5.15 from NQ to NL. New NQ is city. @@ 14 NL Use this command to enter (or change) your QTH-locator. @@ 14 NQ Use this command to enter (or change) your city. ######################################################################## @@ 14 NZ Use this command to change your ZIP-code. @@ 14 NEWDOC NEWDOC is a server for entering new information/documentation in the DOCS- server. To enter a file here, send a personal message like this: ############################################################################# # New in 5.15: NEWDOC can now also make new directories. ############################################################################# SP NEWDOC @ (bbs) The subject must hold 2 things: First it must contain the filename, complete with path (if needed), followed by a label that describes the file. Like this: BBS.DOC Documentation for this BBS. The message will then become the file. After you have sent such a message using NEWDOC, the BBS will send you a message to confirm that the file was successfully saved under DOCS. Sysop can change the label with command L in DOCS-server. @@ 14 NZ|ZIP Use this command to state your ZIP-code. @@ 14 O|OP|OR|OL|ON O-command gives you different options: O alone shows you what language you are using, paging and base-number. - Type OP to toggle paging on messages. - Type OP [number-of-lines] to select paging with a specific number of lines per page. - Type OL alone to get a list of available languages. - Type OL[space][language-number] to choose a language. - Type ON alone to see your base-number. - Type ON [number] to choose a new base-number. The number you type, will be multiplied by 1000, so if you type ON 54, your base-number will be 54000. After that, you can type R 25 to read message number 54025. It is also allowed to type ON 54000. - Type OR to choose if you want to be able to list and read all personal messages in the BBS (if your BBS allows this...). - Type OM to choose if you want to receive the list of new messages at every connect. @@ 14 P|PR Only for sysops: Use PR to toggle printer on/off. @@ 14 PS Use this command (PS) to see which servers are available in this BBS. @@ 14 PG Send command PG to list available DOS-programs. Run one DOS-program with command PG (program-name) (parametre) @@ 14 R|RM|RN|RU|R>|R< R-command is for reading messages (not files). - Type R[space][message#] to read one message. You can chain several message#, seperated by a space. - Type RM to read ALL messages adressed to you [Read Mine]. - Type RN to read all NEW messages to you [Read New]. - Type RU to read all UNREAD messages (status N) to or from you. - Type R< to read messages from a certain callsign. - Type R> to read messages to a certain callsign. ############################################################################# # New in 5.15 - When you read many different messages after each other (with paging), you can now send N to skip directly to next page, C to continue without paging, or A for Abort or ENTER to continue with next page. ############################################################################## @@ 14 REQCFG REQCFG lets you "order" a file from another BBS, showing the configuration of that BBS. If you want to order the file from LA1B BBS, and your home-BBS is F6FBB, you send a message like this: SP REQCFG @ LA1B As subject you type an @-sign and your home-BBS. Like this: @ F6FBB (if F6FBB is your home-BBS). The message can be empty, a CTRL-Z or /EX is enough. After some time, when the message have had time to be forwarded to LA1B BBS, you will receive a message here in F6FBB BBS containing the requested file. Beware: Not all BBS-types support REQCFG. FBB does... @@ 14 REQDIR REQDIR lets you "order" a list of available files from another BBS. Then, later, you can "order" one of those files with REQFIL. Type ? REQFIL for more info on the REQFIL-server. If you want to see which files are in the root-directory of LA1B BBS, and your own BBS if F6FBB, you send a message like this: SP REQDIR @ LA1B As subject you write *.* @ F6FBB (if F6FBB is your home-BBS) The message can be empty, a CTRL-Z or /EX is enough. After some time, when the message has had time to be forwarded to LA1B BBS, you will receive a message here in F6FBB BBS containing a list of files available in the root-directory of LA1B BBS. If you want to look in one sub-directory ( ), you can do this in a similar way. Example: If you want to look in the LOKALT-directory at LA1B, you send a message like this: SP REQDIR @ LA1B As subject you type LOKALT/*.* @ F6FBB (if F6FBB is your home-BBS). Beware: Not all BBS-types support REQDIR. FBB and MBL-type BBSs do... @@ 14 REQFIL REQFIL lets you "order" a file from another BBS. Only ASCII-files, binary-files cannot be sent to you with REQFIL. A list of available files can be obtained using the REQDIR-server. If you want to order a file from the root-directory of LA1B BBS, and your home-BBS is F6FBB, you send a message like this: SP REQFIL @ LA1B As subject you type the name of the requested file, followed by a @-sign and your home-BBS. Like this: NORSK.MAN @ F6FBB (if F6FBB is your home-BBS). The message can be empty, a CTRL-Z or /EX is enough. After some time, when the message have had time to be forwarded to LA1B BBS, you will receive a message here in F6FBB BBS containing the requested file. If you want to order a file from a sub-directory, ( ), you do this is in a similar way. Example: If you want to order the file TEST.TST in sub-dir called LOKALT, you type: SP REQFIL @ LA1B As subject you type: LOKALT/TEST.TST @ F6FBB (if F6FBB is your home-BBS) Beware: Not all BBS-types support REQFIL. FBB and MBL-type BBSs do... @@ 14 S|SB|SR|SC|SP|SC S-command lets you send messages. - Type S[type][space][callsign] to send a message. Type can be P for Personal or B for Bulletin. - Type S[type][space][callsign] @ [callsign] to send a message to a station at another BBS. - Type SB ALL to send a bulletin to ALL. - Type SR[space][messages#] to reply to a special message. (Send Reply). - Type SC[space][messages#][space][callsign] to send a copy of a message to another callsign. (Send Copy). You can write a message before sending the CTRL-Z, then the copy will be appended to your text. If you don't want to do this, just send CTRL-Z instead of any text. @@ 14 SYS Only for sysops. Use the SYS-command to become a remote-sysops. ############################################################################# # New in 5.15: Sysop can send ! (password) directly. Careful....! ############################################################################## @@ 14 SYSOP These commands are available for sysop (local and remote): DOS : SYSOP can now run DOS-programs from remote. Read the help for this under FBBDOS with command ? DOS. DU [callsign] : Show info on that callsign. DB : List all callsigns defined as BBS. DE : List all excluded callsigns. DS : List all sysops. DX : List all "expert"-users. DP : List all users that have paging on. E [msg#] : Edit a message#. EU [callsign] : Edit one user. A '.' deletes a field. FA [msg#] [BBS] : Mark message# for forward to BBS. FB (BBS) : List messages that will be forwarded to BBS. The messages are listed as with a standard L-command with BIDs (M-command). FC (BBS) : Shows the route a message from me to BBS will take. If I send FC LA2D, and the BBS respond with LA8D, it means that messages from me to @LA2D, will be sent via LA8D. FD [msg#] [BBS] : Remove message# from forward to BBS. ############################################################################# # New in 5.15b: FG : Shows partly-received messages (forward-resume). ############################################################################ ############################################################################# # New in 5.15: FH (BBS) : Show h-route to that BBS. FI (BID) : Give information on one BID. FI (BID) + : Add a BID to the list. FI (BID) - : Remove a BID from the list. ############################################################################ FL (BBS) : List messages that will be forwarded to BBS. ############################################################################# # New in 5.15: FP < (call) : Show if from-call is changed (SWAPP.SYS). FP > (call) : Show if to-call is changed (SWAPP.SYS). FP @ (route) : Show if routing is changed (SWAPP.SYS). ############################################################################# FT [BBS] : List size of messages ready for forward to BBS. Shows number of personal messages and bulletins, and also the total size in kilobytes. FT : FT alone shows the same as above, but for ALL BBSs that there pending forwards to. FU [number] : To disconnect a user from a channel. Channel-number must be used, not callsign. FV : Start forward-scan. FN [messsage#] : List BBSs waiting for a message. FW [argument] : Start forward to BBS (callsign) or port. FW 9 starts forward out on all ports. FW LA1B starts forward to LA1B. FS [argument] : Stop forward. Argument; look under FW. FR [argument] : Start revers forward. Argument; look under FW. H (argument) : Hold messages, give them H-status. ############################################################################## # new in 5.15 IL (call) : (WP) Gives full information on user, both primary and secondary info. IE (call) : (WP) To edit a users data in WP. ############################################################################## $$ [message#] : Same as FN. K [message#] : From version 5.10i sysop can also kill UNREAD messages. KF : Kill all messages that have been forwarded. KK [message#] : Kill message. Goes directly to status A, and is deleted with next EPURMESS. K> [callsign] K< [callsign] : SYSOP can kill messages to or from a callsign. K@ [BBS] : Kill all messages to this @BBS-route. LABEL (filename) : To change the description of a file in FBBDOS. N (callsign) : To change a user's data in USER-DATA. NB: All K-commands can be preceded by an extra K. Messages will then go directly to A-status (not K). Example: KKM LU : List all UNREAD messages (status N) in the BBS. M (replace L) : Can be used by sysop to replace L, like: ML for LL, M 100- for L 100- etc. All listings will then have the BID in the subject-field. M [msg#] [file] : Copy a message to a file. Overwrites existing file. MH [msg#] [file] : Like M, but with same format as R [msg#]. Overwrites. MV [msg#] [file] : Like M, but with same format as V [msg#]. Overwrites. MA [msg#] [file] : Copy a message to a file. Appends to existing file. MHA [msg#] [file] : Like M, but with same format as R [msg#]. Appends. MVA [msg#] [file] : Like M, but with same format as V [msg#]. Appends. PR : Toggle printer on/off. CAREFUL when doing this remote ############################################################################## # New in 5.15: PR (msg#) (msg#) : Print messages on printer. PRV (msg#) (msg#) : Print messages (verbose format) on printer. PR> (filnavn) : Redirect printer to file. PR> - : Cancel redirect of printer. ############################################################################## N (call) : To change user-data under DATA OM BRUKERNE. RE : REview messages with status Hold. RU : Read all UNREAD messages in the BBS. SYS : Send this command to become remote-sysop. S [filename] : Send an ASCII file in GATEWAY-mode. Must go to command- mode first (by pressing ESC). ############################################################################## # Nytt i 5.15: SR with filename : Sysop can now include filname in SR-message. Format: SR (number) (+filename) (title) ############################################################################## W (filename) : To be used under GATEWAY to capture text in a file. You must first change to Cmd:mode. End capture with W. YL [filename] : Change the label of a YAPP-file. YZ [filename] : Delete a YAPP-file. YU [filename] : Send a binary file in GATEWAY-mode. Must go to command- mode first (by pressing ESC). YD [filename] : Receive a binary file in GATEWAY-mode. Must go to command- mode first (by pressing ESC). % : Show status for all channels right now. /A : Stops the BBS-program ############################################################################## # New in 5.15b: /K : Reboot BBS, including "house-keeping". /L : Reboot BBS, wait til all have disconnected. /M : Reboot BBS, immediately. ############################################################################## /R : Reboot PC. @@ 14 T|TALK T-command calls the BBS System Operator (SysOp). If SysOp IS available to chat, you'll get a response within ONE MINUTE. Otherwise, the BBS will advise you that SysOp did not answer. You will be returned to the command prompt and can continue normally. @@ 14 U|UPLOAD U-command can be used to upload an ASCII-file to the "root"-directory of the FBBDOS. - Type U [filename] to send the ASCII-file. You can also use U-command to upload a file to a sub-directory of FBBDOS, like this: U VHF/TEST.RES @@ 14 V|VERSION|VERBOSE|VM|VN The V-command shows you the specific version of this PBBS, the date of the software release and the copyright notice. This also shows the number of active messages and the next message number. - Type V to see this PBBS's software version. The V-command also lets you READ MESSAGES with a verbose listing, including the message routing. Use like R-commands. - Type V[space][message#] to READ a specific message. You may have several message numbers per line. - Type VM to READ ALL messages addressed to YOU [Read Mine]. - Type VN to READ ALL NEW messages addressed to YOU [Read New]. - To READ msgs #313 and #325 type "V 313 325". Don't forget SPACE. ############################################################################# # New in 5.15 - When you read many different messages after each other (with paging), you can now send N to skip directly to next page, C to continue without paging, or A for Abort or ENTER to continue with next page. ############################################################################## @@ 14 W Use the W-command (alone) to get a list of files in the users root-directory. Use the W-command with path to see what is in the sub-directories, like this: W LOCAL (see what is in the LOCAL sub-directory) ######################################################################## # New in 5.15 @@ 14 WP Check help on WP-commands with the command ? I Ask for WP-info from another WP-server by sending a message like this: SP WP @ LA1B WP query (Any title...) F6FBB ? (send info on F6FBB) LA6CU ? (Send info on LA6CU) Terminate by /EX ######################################################################## @@ 14 WILDCARDS|@|?|#|=|* Following "wildcards" er allowed: '@' replace one letter '?' replace one alfanumeric character (A-Z, a-z and 0-9) '#' replace one digit '=' replace any character, except space '*' replace any string of characters ############################################################################## # New in 5.15 '&' look for a period (.), or the end of the string. Ex: *.FRA& will match xxxxx.FRA and xxxxx.FRA.xxxxx, but not xxxxx.FRANCA or xxxxx.FRANCA.xxxxxx ############################################################################## @@ 14 X|EXPERT The X-command toggles your status between "normal" and "eXpert" user. "Normal" mode gives you complete prompts and standard messages. "eXpert" mode gives you a very short command line and nothing else. - Type X to toggle your status between "normal" and "eXpert". @@ 14 Y|YAPP|YW|YI|YN|YU|YD|YZ The Y-command calls YAPP protocol for binary file transfer. Your software must use YAPP protocol to transfer binary files. - Type YW to list directory of binary files. - Type YI to list directory with labels. - Type YN to list directory of new binary files since your last logon. - Type YU [filename] to send a file TO the BBS. You can't replace an existing file. - Type YD [filename] to receive a file FROM the BBS. - Type YZ [filename] to delete a file from the BBS. @@ 14 Z Use Z-command to for delete files in the BBS from BBS-mode. Type Z [filname] to delete the file. @@ 14 +|APPEND - Only for sysops. Use this to append a file after the message, like this: SP [call] @ [bbs] + [filename and path] Example: SP LA6CU @ LA1B + c:\lokalt\lokal.inf Here the file LOKAL.INF vil be appended behind the message when you type CTRL-Z. @@ 14 > - Send > [callsign] [text] to send a text to another station that also is connected to the BBS. Get an overview of connected stations with the !-command. @@ 14 = - Send = [callsign] to connect to another station that also is connected to the BBS. Get an overview of connected stations with the !-command. @@ 14 ! - This command is similar to the I-command, but in a shorter form. @@ 14 $$ Only for sysops: $$ [message#] gives a list of all BBSs that the message has been forwarded to, or waiting to be forwarded to. @@ 14 % Use this command to see the status of all channels in the BBS right now. ################# # GATEWAY is 16 # ################# @@ 16 H Gateway-commands : C : Connect. D : Disconnect. H : Help (this text). J : List of the last 20 monitored stations. K : Converse mode. M : Monitor on/off. P : Go directly from one port to another. Send P1 to go from current port to port 1. Q : Return to BBS-mode. > or ESC to go back to Cmd:-mode. First, you get an available port. If a link is not busy, it will be assigned and take your callsign. The mode will automatically change to converse when connecting your correspondent. The K command also changes to converse mode. You will return to command mode when disconnecting, or with Esc or > followed by a . The C command must be followed by a callsign, and if necessary by the V and a list of repeaters. C callsign V digi1 digi2 ... Monitor the port with the M-command @@ 16 B|Q Send Q to return to BBS-mode. If you are connected to a station via the gateway, the other station will be disconnected. (All commands in gateway-mode must be sent in Cmd:mode. Enter Cmd:mode by sending a > (or press ESC) and press ENTER.) @@ 16 C Send C (callsign) to connect to a station via the gateway. (All commands in gateway-mode must be sent in Cmd:mode. Enter Cmd:mode by sending a > (or press ESC) and press ENTER.) @@ 16 D Send D to disconnect a station via the gateway. (All commands in gateway-mode must be sent in Cmd:mode. Enter Cmd:mode by sending a > (or press ESC) and press ENTER.) @@ 16 J Send J to list the last 20 monitored stations. (All commands in gateway-mode must be sent in Cmd:mode. Enter Cmd:mode by sending a > (or press ESC) and press ENTER.) @@ 16 K Send K to enter CONVERS mode. (All commands in gateway-mode must be sent in Cmd:mode. Enter Cmd:mode by sending a > (or press ESC) and press ENTER.) @@ 16 M Send M to toggle monitoring via gateway on/off. (All commands in gateway-mode must be sent in Cmd:mode. Enter Cmd:mode by sending a > (or press ESC) and press ENTER.) @@ 16 P Send P (port-number) to go directly from one port to another. (All commands in gateway-mode must be sent in Cmd:mode. Enter Cmd:mode by sending a > (or press ESC) and press ENTER.) @@ 16 > Send > (or press ESC) and press ENTER to go to Cmd:mode. (All commands in gateway-mode must be sent in Cmd:mode. Enter Cmd:mode by sending a > (or press ESC) and press ENTER.) ########################################################################### fbb-7.04j/conf/lang/english.inf0100644000175100017510000000140307726646106014413 0ustar abaaba BBS F6FBB-1 - $? - Roquettes (15 Km south Toulouse) : Port 1 : (16 channels) 9600 Bds full duplex link to F6FBB-9 Port 2 : ( 1 channel ) HF access 300 Bds AFSK Port 3 : ( 1 channel ) telephone access 1200-14400 Bds Port 4 : ( 1 channel ) HF access 1200 Bds PSK Micro : PC clone 386 DX 40 cache 128K Ram : 16 MB Disk : 212 MB SCSI Soft : F6FBB release $E Front-end NODE F6FBB-9 : Port 1 : 9600 Bds full duplex link to FE6BEX-9 (430.575/439.975) Port 2 : Users' access 1200 Bds AFSK (145.275) Port 3 : 9600 Bds full duplex link to F6FBB-1 (RS 232) Port 4 : 1200 Bds AFSK link to F6CDD-1 (432.675) Micro : PC clone 386 SX 20 Ram : 2 MB Disk : 360 KB floppy Soft : FPAC 1.1 (ROSE compatible) USERS : $% fbb-7.04j/conf/lang/english.txt0100644000175100017510000003410007726646106014456 0ustar abaabaEnglish OL: Language selected : English$W Yes No SunMonTueWedThuFriSat JanFebMarAprMayJunJulAugSepOctNovDec North South East West The Toulouse Mailbox - %l Msg(s) - %k KB$W $WHello $I,$WWelcome to The Toulouse Mailbox$W $WWelcome to The Toulouse Mailbox$W$WUser : $U ($I)$WCalling from : $e$WHomeBBS : $h$WPostal Area : $b$W$WLast log-in : $Y $x-$a$WLast Received : $L$WLast Listed : $Z$WActive Msg's : $N$W$WCurrent Users are:-$W$W$%$W $WPlease enter "N" to enter your name. Example: "N Jean "$W Please enter "NQ" and your QRA Locator. Example: "NQ IO82TK "$W Please enter "NH" and your Home BBS. Example: "NH F6FBB "$W Please enter "NZ" and your Postal area. Example: "NZ 31120 "$W $WThe Toulouse Mailbox$W$WUser : $U$WHomeBBS : $h$W$WStatus : Guest User$W$WIf you plan to use F6FBB as your HomeBBS$Wthen please contact F6FBB for status upgrade.$W $WSorry, this port is reserved for mail forwarding only$W $W #$WYou have $0 unread message(s) waiting$W $WYou have %x new message(s)$W $WYou have $0 redundant message(s)$W $W73 $I,$W #$W73 $I,$WGB7BBS - The FBB SysOp's Support Mailbox, and$WHome of the U.K. National White Pages Database$W $W $W $WMulticonnect Server BBS by F6FBB V$E$W$WAssigned channels:$W$% $W$N active messages - Last message $L - Last listed $Z.$WThere are new messages for:$W$Q$W$WYour Message Filter is $l.$WConnected time : $: - CPU time : $.$W bort ontinue without paging ext Message Continue... Do you want to change anything? (Y/N)$W $WThank you...$W $WOutput aborted!...$W Do you want to create anything? (Y/N) Type "L " to show the full list$WType "F " to finish the session$W>$W bort Read Message Continue..> *** Error : Your answer is incorrect.$W *** Error : [$0] is not a valid command.$W *** Error : No space left after the command.$W *** Error : Only numeric values can be accepted.$W *** Error : No text added after the callsign.$W *** Sorry, there is no help available for $0.$W *** Error : The 'TO' callsign is missing.$W *** Error : The callsign is missing.$W *** Error : Unknown filename.$W *** Error : The character ($0) is not understood.$W *** Error : Message #%M does not exist.$W *** Error : Filename $f does not exist.$W *** Error : Message #%M cannot be killed.$W *** Error : Non-existent file message #%M.$W *** Error : Not a valid port.$W *** Error : Use the CD command.$W *** Error : The field $0 is too long.$W *** Error : $0 has no spaces in the address.$W The required format is "G1DIL @ GB7BBS"$W *** Sorry, You have already downloaded %d Kb.$W *** Nothing Found *** *** Error : The file name is missing.$W *** Error : The 'TO' file name is missing.$W *** Error : Unknown language.$W *** Error : It is impossible to modify the file $f.$W *** Error : Directory $0 is either unknown or not empty.$W *** Error : The directory is missing.$W *** Error : It is impossible to create directory $0.$W *** Error : The path statement is missing.$W *** Error : The path statement is too long.$W *** Error : No such path, or User not authorised.$W *** Error : It is impossible to create the file $f.$W $W*** TIMEOUT ***$W $WF6FBB >$W $WGuest Menu$W----------$WB: Bye LM: List Mine$WH: Help KM: Kill Mail$WS: Send Mail RM: Read Mine$W>$W $WMailbox Menu$W------------$WB: Bye C: Conference D: DOS Area F: Facilities$WK: Kill Mail L: List Mail O: Options R: Read Mail$WS: Send Mail TH: News-Groups !: System Info ?: Help$W$W> *** : Nothing found$W*** : TO Field Filter is set to:- [ $l ]$W No new message(s) found.$W Enter Title (only) :$W Enter text for message:-$W Message #%M has been killed.$W F6FBB Mailbox and Server:- F6FBB-v$E$W$WMail is currently waiting at F6FBB for:-$W$Q$W Please enter your first name:- Example: "Jean-Paul"$W Thank You, $I.$W Callsign LastConnect #Cnct RPBSXLFEMUI Name Password Private$W $V is not available, why don't you leave him a message?$W Paging Jean-Paul.$W Jean-Paul is not available.$W You called ?....>>$W Hold on, $V is breaking in....$B$B$B$W You are now in Expert mode.$W You are now in Non-Expert mode.$W $WSERVER: Type "F " to return to MAILBOX mode.$W File $f appended.$W Your message to %G has been cancelled.$W OP: Paging mode is now set to : Off$W OP: Paging mode is now set to : $p lines$W User is already connected. No edit facility.$W $0 $1 $2 $3 $j $K = $4'$5 ON: Base message number now set to : $0$W (B)id, (F)rom, (V)ia, (T)o, T(I)ttle, (S)tatus, T(Y)pe, (Cr)=End >$W RPBSXLEMU, (N)ame, Pass(W)ord, Lan(G)uage #, Pri(V)-Dir, (Cr)=End >$W $0 is an unknown callsign. Create it (Y/N) ?$W Delete [$0] (Y/N) ? Languages currently available are :$W ($0):$1$W $W$W[End of Message #%M from %P]$W$W Message #$0$W From : %P$WTo : $G$0$WType/Status : $t$s$WDate/Time : %j %K$WBid : $R$W $W*** : TO Field Filter is set to:- [ $l ]$W$W Msg # Origin TSD Size To Route From - Title -$W $M %j $t$s%r $n $G $0 $P $1$W Message # : %M$WTitle : $S$W Bid (Mid) : $R$W$W Forward route: Address added: @$v$W F>$W >$W NO - Incorrect parameter$W NO - Duplicate BID$W OK$W *** Done$W Size: %n bytes$W No forwarding route known for this address.$WThe message will be held for review by F6FBB.$W Your reply will be sent to %G @$v$W OR: Unrestricted access to all mail : $0$W OM: Show messages listing at Log-On : $0$W Please enter your Home BBS:- Example: "F6FBB "$W Please enter your Postal area:- Example: "WV16 "$W HomeBBS: $0 Postcode: $1$W Address unknown:-$WType ENTER to abort and readdress manually$W $W$0 message(s) are currently on "Hold"$W $W(A)rchive,(K)ill,(L)ocal,(Q)uit,(R)ead,(V)erbose,(U)nhold, (CR) finished >$W Message held.$W *** The circuit is busy at present - Please wait a moment.$W *** $0 is busy with an active task - Please try later.$W *** Sorry, $0 is not connected.$W $W$B*** Connected to $0 (End = Ctrl Z).$W *** Disconnected.$W *** "Break" from $0 ***$W *** End of "break" ***$W "Break"... ...Message from $0.$W Interrupt request from $0. Code : $1$W Stop request accepted, no connection.$W Reset request accepted, performing initialization.$W Continue bort .....> Interrupt request rejected.$W $WMAILBOX: Type "F " to return to SERVER mode.$W $W $WServer Menu$W-----------$W(B) Bye$W(C) Connect Statistics$W(F) Return to Mailbox$W(D) Library$W(N) User-Database$W(Q) Qra-Locator$W(T) Satellites$W$WFor Help type "?(Command)"$W> $W $WServer Menu$W-----------$W(B) Bye$W(C) Connect St@tistics$W(F) Return to Mailbox$W(D) Library$W(N) User-Database$W(Q) Qra-Locator$W(T) Satellites$W$WFor Help type "?(Command)"$W> $WStatistics Menu$W---------------$W(B) Bye$W(F) Return to Server Menu$W(G) General information$W(H) Hourly histogram$W(I) Callsigns of users$W(J) Daily histogram$W(L) List recent callers$W(O) Occupancy$W$WFor Help type "?(command)"$W> $W $WStatistics Menu$W---------------$=(B) Bye$W(F) Return to Server Menu$W(G) General information$W(H) Hourly histogram$W(I) Callsigns of users$W(J) Daily histogram$W(L) List recent callers$W(O) Occupancy$W$WFor Help type "?(command)"$W> Use per day$W MON TUE WED THU FRI SAT SUN$W Use per hour$W 0 0 0 0 0 1 1 1 1 1 2 2 Hour$W 0 2 4 6 8 0 2 4 6 8 0 2$W $N active messages$W $0 Connections since $j$W Connections$W Average time per connection: $0min $1s$W Average daily connections : $0$W Rush-hours : At $1:00hrs and $0:00hrs.$W Usage (in percent)$W BBS : $0 % $W Server : $0 % $W Server details:$W DOS : $0 % $W Qth-Locator : $0 % $W Docs : $0 % $W Connections-stat : $0 % $W User-data : $0 % $W Satellites : $0 % $W $0 $1 $2 $3 $j $K = $4'$5"$W $WUser-Database Menu$W------------------$W(B) Bye$W(R) Search for a user$W(I) Callsigns$W(N) Change Name and Adress$W(F) Return to Server menu$W$WFor Help type "?(command)"$W$W> $W $WUser-Database Menu$W------------------$W(B) Bye$W(R) Search for a user$W(I) Callsigns$W(N) Change Name and Adress$W(F) Return to Server menu$W$WFor Help type "?(command)"$W$W> $WCallsign: $0$W Last connection was on $j at $K.$W $WCurrent record:$W$WName: $1 $0$WAddress: $2, $3$WQra-Locator: $4. Phone (Home): $5, Phone (Other): $6$W Please enter your Surname:-$W Example: "Smith "$W Please enter your House-number$Wand the name of your street:- Example: "27, High Street "$W> Please enter your Town name:- Example: "London "$W Please enter your phone number:- (Or type ENTER to ignore)$W Please enter your Fax number:- (Or type ENTER to ignore)$W Please enter your QRA Locator:- Example: "IO82TK "$W $WTotal $0 callsigns$W *** Callsign $0 is unknown.$W *** Wrong Qra-locator.$W $WSatellites Menu$W---------------$W(C) Characteristics$W(P) Print Keplerian Elements$W(T) In-Range Calendar$W(F) Return to Server Menu$W(B) Bye$W$WFor Help type "?(command)"$W$W> $W(M) Modify Keplerian Elements$W $WSatellites Menu$W---------------$W(C) Characteristics$W(P) Print Keplerian Elements$W(T) In-Range Calendar$W(F) Return to Server Menu$W(B) Bye$W$WFor Help type "?(command)"$W$W> $WLocator : $0 Satellite $1$W --------------------------------------------------------------$W | Time | Az. | El. | Dpl. | Dist. | Alti. | Lon | Lat | Ph. |$W | UTC | Deg | Deg | KHz | Km | Km | Deg | Deg | 256 |$W --------------- $j-$y ------ Orbit #$0 ----------------$W | $0:$1 | $2 | $3 | $4 | $5 | $6 | $7 | $8 | $9 |$W Enter start-date for calculation (DD/MM/YY):$W(Carriage return only for date $d) : Enter start-time for calculation (HH:MM) :$W(Carriage return only for time $H) : $W$WStand-By your In-Range calendar is being processed.....$W $WThere is no information available for this satellite.$W Updated on $j-$y.$W Satellite name : Reference orbit : Reference year : Reference day : Mean anomaly : Arg. of perigee : R.A.A.N. : Inclination : Eccentricity : Mean motion : Derived mean moion : Estimated step : Doppler frequency : $WOrbiting parameters for $0$W Orbit number : $0$W Epoch year : $0$W Epoch day : $0$W Mean anomaly : $0$W Arg. of perigee : $0$W R.A.A.N. : $0$W Inclination : $0$W Eccentricity : $0$W Mean motion : $0$W Derived mean motion : $0$W Estimated step : $0$W$W ($0) $1 $W $WLocator Menu$W------------$W(Q) Qra to Lat/Long.$W(L) Lat/Long to Qra$W(D) Distance & Azimuth$W(C) Cumulative calculation$W(F) Return to Server Menu$W(B) Bye$W$WFor Help type "?(command)"$W$W> $W $WLocator Menu$W------------$W(Q) Qra to Lat>Long.$W(L) Lat/Long to Qra$W(D) Distance & Azimuth$W(C) Cumulative calculation$W(F) Return to Server Menu$W(B) Bye$W$WFor Help type "?(command)"$W$W> $WPlease enter your Qra Locator (or Q to Quit) ?:$W Geographical coordinates in the centre of the square :$W Longitude : $0 degrees $1' $2 : $3 gr $2$W Latitude : $0 degrees $1' $2 : $3 gr $2$W $WUse the following format$WIn degrees :1:45:00 (Direction).$WIn gradians :1.5 (Direction)$W(Direction) should be replaced by North, South, East or West.$W $WLongitude (East/West) : $WLatitude (North/South) : $WQra Locator : $0$W $WFrom Qra Locator : $WTo Qra Locator : Azimuth : $0 degr $1' : $2 gr$W Distance : $0 Km$W $WPlease enter your Qra Locator (or Q to Quit) ?:$W $WTo Qra Locator? (F = Finish) : Calculation # $0 - Total distance : $1 Km$W End of Calculation.$W $W"WHERE filename" locates a file in the Dos file system (Wildcards accepted)$W$W[Downloaded : %d Kb]$W[Authorised : %m Kb]$W$W$u:$0>$W Directory <$0> has been deleted.$W No File(s) / File(s) not found$W $0 $1 $2 $3 $4 $5 $6 $7$W $WDownload of $f was aborted!$W $WTransfer of $f was successful ($0 bytes - $1 bytes/sec)$W Ready to accept upload of $f.$W(End transfer with ^Z)$W $0 bytes copied.$W $WF6FBB User Files Area (v$E) $j $T$W$WDownload protocols:-$WPacket Modem$W$WGET = Ascii Xfer XGET = Xmodem$WYGET = YAPPc Xfer YGET = Ymodem$WBGET = GP/SP Xfer ZGET = Zmodem$W$W $WAvailable DOS commands are:-$W$W File $f has been deleted.$W $W$0 bytes are available for user upload$W$W $WLibrary Menu$W------------$W(B) Bye$W(F) Return to Server menu $W(L) List Directories/filenames$W(#) The number you wish to view $W$WLIBRARY:$0>$W $W $WLibrary Menu$W------------$W(B) Bye$W(F) Return to Server menu $W(R) Refresh Options menu$W(#) The number you wish to view $W$WLIBRARY:$0>$W The information requested does not exist.$W F6FBB Cross-Band Gateway:-$WYou are currently on PORT $!$WYou have access to the following frequencies.$WAccess to F6FBB-10 LINUX-FpacNode on port NETWORK$W$W $WChoose a port number, or type "Q " to return to the mailbox$W$W> $W Sorry there are no channels available on $m$W Cmd : $W *** Error : You're already on this port!$W *** Error : Invalid port number$W *** Gateway non-operational.$W $O: $0 is an invalid command. Options are: (C,D,J,K,H,M,P,Q?)$W Ready to send file: $f $W Text capture opened in $f.$W Text capture closed.$W Ready to send $f with $0 protocol$W Ready to receive $f with $0 protocol$W Sorry, $0 is not allowed on this frequency.$W Enter the descriptive file label :$W $0 $1 $2 $3 $4$W CONFERENCE:$WType ".? " for assistance$W Stations in the conference at $Hz are:$W $0, on channel $1.$W [$Hz] $0 is joining the conference.$W You have quit the conference.$W [$Hz] $0 has left the conference.$W [$H - $0]$W Nobody else is in the conference.$W $H $0 : Retry count exceeded.$W $H $0 busy.$W $H $0 is not in the conference !$W Msg # Size To From Subject (NewsGroup: %T)$W $M $n $G $P $1$W $WNewsGroup <%T> - %t Bulletins$W$W<#>Change NewsGroup eaders of Groups ist inish ye$W # # EOF fbb-7.04j/conf/lang/english.ent.sample0100644000175100017510000000026307726646106015710 0ustar abaaba ********************************************************** This is the content of /etc/ax25/fbb/lang/english.ent file ********************************************************** fbb-7.04j/conf/lang/francais.ent.sample0100644000175100017510000000023307726646106016042 0ustar abaaba ************************************************** Contenu du fichier /etc/ax25/fbb/lang/francais.ent ************************************************** fbb-7.04j/fbb_old_ax25.patch.gz0100755000175100017510000001003407726646106014307 0ustar abaabad9fbb_old_ax25.patch[{sHlb[aq;)l|P*Y[,XId_$F/^qvUig73={0q`XmL#4t>)5;rbn 6 *5PZ@mZ;br݃7W#PmծAEQ/\mPOU/w'xP88/O^_ ;^3]/1(N`w"klW$_-`Ǩ);5 |zOCa۩Czr*(OfN͛~OycdT5 [ ]& ߺj W•ZfcL }rk}QDk}y ΃Q/Qx1(l+&#*I"+>f"^BJTZWNaA`_SܕfL`Wb F@b(ZTa2vID? [mimRRȱ>΁!X]Ai99 vUm+A/_~)5ZEOyq0x Hg3 ǧucj[߄NvuĂ*Z :[#ykql˳59pXJve{djZcd\ZB:>k(x#)(ƪ J]E8XZ.5[%UA1thSo5M')VK1 $Z}4r;~V.j#8=]Ac`1MȻnkc2w3 lԼI@$iB[1MQ p^xԉ 麂Uv"W@zHgH9i#V5 -P0&hȓAPG-ߨZh7Ւ,#5vubcޚ|œP8[*3G2 P'ѓ;q 57(O#Zʹ=kh |L#wqc#Fi@5} ry2H3SLZ=ϭ$ zo'Z5N4渇8pC 7lscF]Ku룮wf})Q_m%M]㳂ʩJ%_}d\tqE ~%PNr5n [/A2 tGi䘈+2I. bԦ V2"Lb~DSFv\{->H2%OJ{/+SG>܈:)[[CIrZUA(AVPd3ϑe@c g\0BޗQq(#`y7fBsoHpS"Fv3Rt5"q8$KFc{.,}BO{:;Ⰴ!}#3,,i%{-1+'d֖z]{XnM\~ċ7-z^ob 89Aס ]od:FCAӛ\e{ܽ6L Gӛ;: >rAh }5} ů*|eʹIH-w{dDnf -Y)icA(oqK_a GVp*%jqhʳ{Û~AH2<\2Q)L" d rb_ޖAR!xlh@& ⚴:=gD*DcMt^i,v( P$PIOVNR= ݇8ED Be_%E,h PSV Yp;f>T6}Fо>t:s/?TIN4*XH[ X6I '$E\/Г~pJ]rc+1ft1bMOplLІx :Cا@4D}YQf͖$OoY]clįX^/d^Yb7=Zy|&SpաTyʑ *GP&=41F{v;!Ȉn5Wѳ",ER=Kk#NŞ]Z X.DQDWtF1,]23)-ZWrn@L9>zكd),i+T1(Pê%G )TNsf'ϔUDD/וaI)^^( 9@G3)&+R3nZת*"hGrA<#RjWE(a(̼r\sM޿b t h_l.JjUK{f|e4C)o!CLp<Q6*@wޝMϳQ+uж:_D"Γgby,zM oW\A C8|{ȹn(j$7ĊܾߘOp׽>0ք܎Tt$ > $MAIL_IN SP $SYSOP Segmentation error FBB gave a segmentation violation on `date` /EX EOF } replace() { if [ ! -f $1 ] ; then return 0 else echo -n "file `basename $1` already exists. Replace (Y/N) ? " read REP if [ "$REP" = "N" -o "$REP" = "n" ] ; then return 1 else return 0 fi fi } make_fbb_conf() { echo "#" echo "# FBB Set-up file" echo "#" echo "version = FBB$VERSION" echo "# Callsign of BBS" echo "callsign = $CALL.$ROUTE" echo "# SSID of BBS" echo "ssid = $SSID" echo "# Qra Locator of BBS" echo "qraloc = $QRALOC" echo "# Qth of BBS" echo "city = $CITY" echo "# First name of SYSOP" echo "name = $SYSOP_NAME" echo "# Callsign of SYSOP" echo "sysop = $SYSOP_CALL" echo "# Local time" echo "loca = $LOCALTIME" echo "# servers" echo "server = REQDIR reqdir Directory request" } make_epurmess_ini() { cat < PX 60 # # PY -> PX 5 # # PF -> PK 1 # # PX -> PK 2 # # PK -> PA 2 # # Cleaning parameters for bulletins (in days) # # BN -> BX 7 # # B$ -> BX 7 # # BY -> BX 7 # # BX -> BK 4 # # BF -> BX 7 # # BK -> BA 1 # # Automatic messages for not-forwarded messages. Days = 0 disables the message. # 255 characters maximum for the line. # # Private messages returned : Timeout link default. (Days + text, $W=new line). 10 Sorry, the following message could not be routed due to link default.$W # # Private messages returned : Unknown route. (Days + text, $W=new line). 2 No defined route for the following message. Please check the h-address.$W # # Nb of lines max in a returned message 10 # ------ # # Special tests # # Type To Number_of_days @ ALL 1 > ALL 1 # # End of file # EOF } get_fbb_conf() { echo "" echo -n "Configuration files does not exist. Create them (Y/N) ?" read REP if [ "$REP" = "N" -o "$REP" = "n" ] ; then echo "Cannot run FBB without conf files" exit 0 fi while true ; do echo echo -n "Callsign of the BBS without ssid (Ex: F6FBB) : " read CALL echo -n "SSID of the BBS (Ex : 1) : " read SSID echo -n "Hierarchical address (Ex : FMLR.FRA.EU) : " read ROUTE echo -n "QRA-Locator of the BBS (Ex : JN03QL) : " read QRALOC echo -n "City of the BBS (Ex : Toulouse) : " read CITY echo -n "Name of the SysOp (Ex : Jean-Paul) : " read SYSOP_NAME echo -n "Callsign of the SysOp without SSID (Ex : F6FBB) : " read SYSOP_CALL echo -n "Difference with GMT time (Ex : +1) : " read LOCALTIME echo echo "BBS : $CALL.$ROUTE" echo "SSID : $SSID" echo "LOCATOR : $QRALOC ($CITY)" echo "SYSOP : $SYSOP_CALL ($SYSOP_NAME)" echo "TIME : GMT $LOCALTIME" while true ; do echo echo -n "Correct (Y/N) ? " read REP if [ "$REP" = "Y" -o "$REP" = "y" ] ; then break 2 elif [ "$REP" = "N" -o "$REP" = "n" ] ; then break 1 fi done done # Create fbb.conf file make_fbb_conf > /etc/ax25/fbb.conf # Create epurmess.ini file if replace $CONFDIR/epurmess.ini ; then make_epurmess_ini > $CONFDIR/epurmess.ini fi } make_port_fbb() { NB=1 echo "# FBB$VERSION" echo "#" echo "#Ports TNCs" echo " 1 $[ $NUMPORT - 1 ]" echo "#" echo "#Com Interface Adress (Hex) Baud" echo " 1 9 0 9600" echo "#" echo "#TNC NbCh Com MultCh Pacln Maxfr NbFwd MxBloc M/P-Fwd Mode Freq" echo " 0 0 0 0 0 0 0 0 00/01 ---- File-fwd." while [ $NB -lt $NUMPORT ] ; do printf " %-2s %-2s 1 %-6s 250 2 1 10 00/15 XUWYL %s\n"\ $NB ${NB_CH[$NB]} ${PORT_NAME[$NB]} ${PORT_FREQ[$NB]} NB=$[ $NB + 1 ] done echo "#" echo "# End of file." echo "#" } get_fbb_port() { if replace $CONFDIR/port.sys ; then NUMPORT=1 while true ; do while true ; do echo echo -n "Name of the port #$NUMPORT as named in axport ( to end) : " read REP if [ -z "$REP" ] ; then break; fi PORT_NAME[$NUMPORT]=$REP echo -n "Number of channels : " read REP NB_CH[$NUMPORT]=$REP echo -n "Frequency : " read REP PORT_FREQ[$NUMPORT]=$REP NUMPORT=$[ $NUMPORT + 1 ] done NB=1 echo while [ $NB -lt $NUMPORT ] ; do echo "Port $NB on axport ${PORT_NAME[$NB]} (${NB_CH[$NB]} channels) Freq=${PORT_FREQ[$NB]}" NB=$[ $NB + 1 ] done while true ; do echo echo -n "Correct (Y/N) ? " read REP if [ "$REP" = "Y" -o "$REP" = "y" ] ; then break 2 elif [ "$REP" = "N" -o "$REP" = "n" ] ; then break 1 fi done done # Create port.sys file echo "Creating port.sys ... Ok" make_port_fbb > $CONFDIR/port.sys # Create beaconN.sys files NB=1 while [ $NB -lt $NUMPORT ] ; do FILE=$CONFDIR/beacon$NB.sys if replace $FILE ; then echo "Creating beacon$NB.sys ... Ok" echo "% 15" > $FILE echo "! MAIL" >> $FILE echo "\$d \$Tz Mailbox \$O-\$o (LINUX version)" >> $FILE fi NB=$[ $NB + 1 ] done fi } check_dir() { if [ ! -d $1 ] ; then echo echo "Error : directory $1 does not exist." echo "FBB software was not correctly installed or configured" echo "Giving up !" exit 1; fi } fbb_tree() { echo -n "Checking fbb tree." check_dir $CONFDIR check_dir $CONFDIR/lang echo -n "." check_dir $DATADIR check_dir $DATADIR/mail for n in 0 1 2 3 4 5 6 7 8 9 ; do check_dir $DATADIR/mail/mail$n done echo -n "." check_dir $DATADIR/binmail for n in 0 1 2 3 4 5 6 7 8 9 ; do check_dir $DATADIR/binmail/mail$n done echo -n "." check_dir $DATADIR/oldmail check_dir $DATADIR/docs check_dir $DATADIR/log check_dir $DATADIR/sat check_dir $DATADIR/wp check_dir $DOSDIR check_dir $DOSDIR/yapp check_dir $LIBDIR/pg check_dir $LIBDIR/filter check_dir $LIBDIR/server check_dir $LIBDIR/script check_dir $LIBDIR/tool echo " Ok" } fbb_conf() { echo "Checking fbb configuration :" if [ -x $FBB ] ; then cd $FBBDIR $FBB -i if [ $? -ne 2 ] ; then echo "Configuration error ! Giving up." exit 1 fi else echo "Program $FBB is not found or not executable ! Giving up." exit 1 fi } fbb_end() { echo "Received TERM signal" echo "killproc -TERM $FBB" killproc -TERM $FBB exit 1 } fbb_return() { echo case $1 in 1) # SIGTERM received housekeeping end_session exit 0 ;; 2) # /L and /M sysop commands housekeeping rerun ;; 3) # /K sysop command and normal housekeeping housekeeping maintenance ;; 4) # /A sysop command housekeeping stop_system exit 0 ;; 5) # "Segmentation violation" or "bus error" segv housekeeping sig_segv ;; 6) # /R sysop command housekeeping reset exit 0 ;; *) echo "Unknown return value $1" housekeeping error_return $ret ;; esac } fbb_loop() { PATH=$LIBDIR/tool:$SBINDIR:$PATH export PATH trap fbb_end TERM while true ; do cd $FBBDIR $FBB $FBB_PARAM & wait $! fbb_return $? done } fbb_run() { echo echo -n "FBB options :" if [ -n "$FBB_PARAM" ] ; then echo "$FBB_PARAM" else echo " (none)" fi if [ $FBB_FG -eq 1 ] ; then echo "Running XFBB in foreground mode ^C to abort" sleep 5 echo "Starting XFBB (pwd = `pwd`)..." fbb_loop > $FBBLOG 2>&1 else echo "Running XFBB in background mode ^C to abort" sleep 5 FBB_BACKGROUND=1 export FBB_BACKGROUND echo "Starting XFBB (pwd = `pwd`)..." (cd $LOCALDIR ; $MY_SHELL $FBB_PARAM > $FBBLOG 2>&1 & ) exit 0 fi } fbb_help() { echo "format : fbb [-f] [-h] [-s] [-l log_file]" echo "-f : run fbb in foreground" echo "-h : this help information" echo "-l : log debug info to log_file" echo "-q : run fbb silently" exit 0 } fbb_opt() { MY_SHELL=$0 FBB_FG=0 RUN_BG=0 FBB_SILENT=0 while [ $# -gt 0 ]; do case "$1" in -h) fbb_help ;; -f) FBB_FG=1 ;; -q) FBB_SILENT=1 ;; -l) FBBLOG=$2 shift ;; *) FBB_PARAM="$FBB_PARAM $1" ;; esac shift done if [ -n "$FBB_BACKGROUND" ] ; then fbb_loop exit 0 fi } LOCALDIR=`pwd` if [ ! -f /etc/ax25/fbb.conf ] ; then get_fbb_conf get_fbb_port fi fbb_opt $* if [ $FBB_SILENT -eq 1 ] ; then fbb_tree > /dev/null 2>&1 fbb_conf > /dev/null 2>&1 fbb_run > /dev/null 2>&1 else fbb_tree fbb_conf fbb_run fi exit 0 fbb-7.04j/rc.fbb0100744000175100017510000000150607726646106011502 0ustar abaaba#! /bin/sh # # /sbin/init.d/fbb # . /etc/rc.config base=${0##*/} link=${base#*[SK][0-9][0-9]} test $link = $base && START_FBB=yes test "$START_FBB" = yes || exit 0 test -x /usr/sbin/fbb || exit 0 return=$rc_done case "$1" in start) echo -n "Starting FBB daemon" if [ -f /etc/ax25/fbb.conf ] ; then startproc /usr/sbin/fbb -s -l /tmp/fbb.log || return=$rc_failed else return=$rc_failed fi echo -e "$return" ;; stop) echo -n "Shutting down FBB daemon" killproc -TERM /usr/sbin/fbb || return=$rc_failed sleep 4 echo -e "$return" ;; restart|reload) $0 stop && $0 start || return=$rc_failed ;; status) echo -n "Checking for FBB daemon : " checkproc /usr/sbin/fbb && echo "FBB is up" || echo "No FBB daemon" ;; *) echo "Usage: $0 {start|stop|status|restart}" exit 1 esac test "$return" = "$rc_done" || exit 1 exit 0 fbb-7.04j/FBBTREE0100644000175100017510000000213407726646106011414 0ustar abaabaSpecial files : - configuration : /etc/ax25/fbb.conf - mail import : /var/ax25/fbb/mail/mail.in binaries : ---------- /usr/sbin configuration tree : -------------------- /etc/ax25/fbb \_ lang utilities tree : ---------------- /usr/lib/fbb |\_ filter | |\_ pg | |\_ script | |\_ error_return | | | |\_ end_session | | | |\_ rerun | | | |\_ maintenance | | | |\_ stop_system | | | |\_ sig_segv | | | \_ reset | |\_ server | \_ tool data tree : ----------- /var/ax25/fbb |\_ docs | |\_ log | |\_ oldmail | |\_ sat | |\_ wp | |\_ fbbdos | \_ yapp | |\_ mail | \_ mail[0-9] | \_ binmail \_ mail[0-9] fbb-7.04j/COPYING0100644000175100017510000004311007726646106011452 0ustar abaaba GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. fbb-7.04j/20_epurmess0100755000175100017510000000011507726646106012507 0ustar abaaba#!/bin/sh echo echo "--- Running epurmess" echo epurmess ret=$? exit $ret fbb-7.04j/README_KERNEL_2.00100644000175100017510000000040507726646106012716 0ustar abaabaThis version should work with the "old" 2.0 kernel and axutils. The Makefile checks the presence of the "OLD AX25" include files in /usr/src/ax25. This has to be changed in the Makefile in case of other installation path of AX25. Jean-Paul ROUBELAT - F6FBB fbb-7.04j/20_epurwp0100755000175100017510000000011707726646106012170 0ustar abaaba#!/bin/sh echo echo "--- Running epurwp" echo epurwp 40 90 ret=$? exit $ret fbb-7.04j/end_session/0042755000175100017510000000000007726646106012736 5ustar abaabafbb-7.04j/stop_system/0042755000175100017510000000000007726646106013016 5ustar abaabafbb-7.04j/error_return/0042755000175100017510000000000007726646106013155 5ustar abaabafbb-7.04j/INFO0100644000175100017510000000276707726646106011112 0ustar abaaba Command line options of the fbb script : ---------------------------------------- -f : Software is run in foreground -h : help information -q : run silent -l logfile : log debug info to logfile Other options given to xfbbd : ------------------------------ -a : monitor all frames -v : verbose -i : only check init files -n : no client (xfbbC, xfbbX or fbbW) interface -s service : client service name (default none) -p port_num : client port number (default 3286) xfbbd exit values : ------------------- 0 : Error (configuration...) 1 : Sigterm received 2 : re-run (no housekeeping) 3 : housekeeping 4 : Software stop 5 : Segv or BusError 6 : System Reboot asked Sysop exit commands : --------------------- /A : Software stop ------------------ Immediate software exit (value 4) /K : Housekeeping --------------------------- Delayed software exit (value 4) /L : Re-run --------------------------- Delayed software exit (value 2) /M : Re-run --------------------------- Immediate software exit (value 2) /R : Reboot --------------------------- Immediate software exit (value 6) Scripts : --------- By default, the script directories are in /usr/lib/fbb/script. When an exit value is received from xfbbd, all executable commands (scripts or programs) included in the directory are executed in alphanumeric order. Script directories (by value) : ------------------------------- 0 : error_return 1 : end_session 2 : rerun 3 : maintenance 4 : stop_system 5 : sig_segv 6 : reset