Category : BBS Programs+Doors
Archive   : MULTILNE.ZIP
Filename : ML.1

 
Output of file : ML.1 contained in archive : MULTILNE.ZIP
E
Arc Angel #1 @3144
Sat Aug 22 12:32:55 1992
#include "vars.h"

#pragma hdrstop

#include

/* MOD */ int lockchain=-1, locknetdial=-1, locknetlocal=-1;

/* MOD */ int filecopy(char *oldfilename, char *newfilename)
/* MOD */ {
/* MOD */ char *buffer;
/* MOD */ int i,f1,f2;
/* MOD */ struct ftime filetime;
/* MOD */
/* MOD */ f1=open_r(oldfilename);
/* MOD */ if ((freek1(newfilename)*1024)<(double)filelength(f1)) {
/* MOD */ close(f1);
/* MOD */ return(0);
/* MOD */ }
/* MOD */ if ((buffer=(char *)malloca(16400))==NULL)
/* MOD */ return(0);
/* MOD */ f2=open_w(newfilename,O_TRUNC);
/* MOD */ i=read(f1,(void *)buffer,16384);
/* MOD */ while (i>0) {
/* MOD */ write(f2,(void *)buffer,i);
/* MOD */ i=read(f1,(void *)buffer,16384);
/* MOD */ }
/* MOD */ farfree(buffer);
/* MOD */ getftime(f1, &filetime);
/* MOD */ setftime(f2, &filetime);
/* MOD */ close(f1);
/* MOD */ close(f2);
/* MOD */ return(1);
/* MOD */ }



/* MOD */ void lockchain_release()
/* MOD */ {
/* MOD */ if (lockchain!=-1) {
/* MOD */ close(lockchain);
/* MOD */ lockchain=-1;
/* MOD */ }
/* MOD */ }

/* MOD */ int lockchain_set(int cn)
/* MOD */ {
/* MOD */ char s[81];
/* MOD */
/* MOD */ lockchain_release();
/* MOD */ sprintf(s,"%sLOCKCHN.%d",syscfg.datadir,cn);
/* MOD */ lockchain=open(s,O_RDWR | O_BINARY | O_CREAT | O_DENYWRITE, S_IREAD | S_IWRITE);
/* MOD */ if (lockchain!=-1)
/* MOD */ return(1);
/* MOD */ else
/* MOD */ return(0);
/* MOD */ }

/* MOD */ int lockchain_test(int cn)
/* MOD */ {
/* MOD */ if (lockchain_set(cn)) {
/* MOD */ lockchain_release();
/* MOD */ return(1);
/* MOD */ }
/* MOD */ else
/* MOD */ return(0);
/* MOD */ }

/* MOD */ void locknetdial_release()
/* MOD */ {
/* MOD */ if (locknetdial!=-1) {
/* MOD */ close(locknetdial);
/* MOD */ locknetdial=-1;
/* MOD */ }
/* MOD */ }

/* MOD */ int locknetdial_set()
/* MOD */ {
/* MOD */ char s[81];
/* MOD */
/* MOD */ locknetdial_release();
/* MOD */ sprintf(s,"%sLOCKNETD",syscfg.datadir);
/* MOD */ locknetdial=open(s,O_RDWR | O_BINARY | O_CREAT | O_DENYWRITE, S_IREAD | S_IWRITE);
/* MOD */ if (locknetdial!=-1)
/* MOD */ return(1);
/* MOD */ else
/* MOD */ return(0);
/* MOD */ }

/* MOD */ void locknetlocal_release()
/* MOD */ {
/* MOD */ if (locknetlocal!=-1) {
/* MOD */ close(locknetlocal);
/* MOD */ locknetlocal=-1;
/* MOD */ }
/* MOD */ }

/* MOD */ int locknetlocal_set()
/* MOD */ {
/* MOD */ char s[81];
/* MOD */
/* MOD */ locknetlocal_release();
/* MOD */ sprintf(s,"%sLOCKNETL",syscfg.datadir);
/* MOD */ locknetlocal=open(s,O_RDWR | O_BINARY | O_CREAT | O_DENYWRITE, S_IREAD | S_IWRITE);
/* MOD */ if (locknetlocal!=-1)
/* MOD */ return(1);
/* MOD */ else
/* MOD */ return(0);
/* MOD */ }

/* MOD */ FILE *fopen_r(char *s, char *mode) /* open stream for read only */
/* MOD */ {
/* MOD */ return(_fsopen(s,mode,SH_DENYNONE));
/* MOD */ }

/* MOD */ FILE *fopen_w(char *s, char *mode) /* open stream for write */
/* MOD */ {
/* MOD */ FILE *f;
/* MOD */
/* MOD */ do
/* MOD */ f=_fsopen(s,mode,SH_DENYWR);
/* MOD */ while (f<0);
/* MOD */ return(f);
/* MOD */ }

/* MOD */ int open_r(char *s) /* open file for read only */
/* MOD */ {
/* MOD */ return(open(s,O_RDONLY | O_BINARY | O_DENYNONE));
/* MOD */ }

/* MOD */ int open_w(char * s, int access) /* open file for write */
/* MOD */ {
/* MOD */ int f;
/* MOD */
/* MOD */ do
/* MOD */ f=open(s,O_RDWR | O_BINARY | O_CREAT | O_DENYWRITE | access, S_IREAD | S_IWRITE);
/* MOD */ while (f<0);
/* MOD */ return(f);
/* MOD */ }

/* MOD */ int open_w_exist(char * s, int access) /* open file for write if it exists */
/* MOD */ {
/* MOD */ int f;
/* MOD */
/* MOD */ if (exist(s))
/* MOD */ do
/* MOD */ f=open(s,O_RDWR | O_BINARY | O_DENYWRITE | access);
/* MOD */ while (f<0);
/* MOD */ else
/* MOD */ f=-1;
/* MOD */ return(f);
/* MOD */ }

/* MOD */ void opendlf_w1(int dn) /* open a download file for write */
/* MOD */ {
/* MOD */ char s[81];
/* MOD */
/* MOD */ closedlf_w();
/* MOD */ sprintf(s,"%s%s.DIR",syscfg.datadir,directories[dn].filename);
/* MOD */ dlf_w=open_w(s,0);
/* MOD */ }

/* MOD */ void opendlf_w() /* open current download file for write */
/* MOD */ {
/* MOD */ opendlf_w1(udir[curdir].subnum);
/* MOD */ }

/* MOD */ void closedlf_w() /* close download file */
/* MOD */ {
/* MOD */ if (dlf_w!=-1)
/* MOD */ close(dlf_w);
/* MOD */ dlf_w=-1;
/* MOD */ }

/* MOD */ void openedlf_w1(int dn) /* open an extended download file for write */
/* MOD */ {
/* MOD */ char s[81];
/* MOD */
/* MOD */ closeedlf_w();
/* MOD */ sprintf(s,"%s%s.EXT",syscfg.datadir,directories[dn].filename);
/* MOD */ edlf_w=open_w(s,0);
/* MOD */ }

/* MOD */ void openedlf_w() /* open current extended download file for write */
/* MOD */ {
/* MOD */ openedlf_w1(edlf_dn);
/* MOD */ }

/* MOD */ void closeedlf_w() /* close extended download file */
/* MOD */ {
/* MOD */ if (edlf_w!=-1)
/* MOD */ close(edlf_w);
/* MOD */ edlf_w=-1;
/* MOD */ }

/* MOD */ int openemail()
/* MOD */ {
/* MOD */ char s[81];
/* MOD */
/* MOD */ if (emailfile<0) {
/* MOD */ sprintf(s,"%sEMAIL.DAT",syscfg.datadir);
/* MOD */ emailfile=open_r(s);
/* MOD */ }
/* MOD */ return(emailfile);
/* MOD */ }

/* MOD */ void closeemail()
/* MOD */ {
/* MOD */ if (emailfile>=0) {
/* MOD */ close(emailfile);
/* MOD */ emailfile=-1;
/* MOD */ }
/* MOD */ }

/* MOD */ int openemail_w()
/* MOD */ {
/* MOD */ char s[81];
/* MOD */
/* MOD */ if (emailfile_w<0) {
/* MOD */ sprintf(s,"%sEMAIL.DAT",syscfg.datadir);
/* MOD */ emailfile_w=open_w(s,0);
/* MOD */ }
/* MOD */ return(emailfile_w);
/* MOD */ }

/* MOD */ void closeemail_w()
/* MOD */ {
/* MOD */ if (emailfile_w>=0) {
/* MOD */ close(emailfile_w);
/* MOD */ emailfile_w=-1;
/* MOD */ }
/* MOD */ }

/* MOD */ void load_status()
/* MOD */ {
/* MOD */ char s[80];
/* MOD */
/* MOD */ if (statusfile<0) {
/* MOD */ sprintf(s,"%sSTATUS.DAT",syscfg.datadir);
/* MOD */ do
/* MOD */ statusfile=open(s,O_RDWR | O_BINARY | O_DENYALL);
/* MOD */ while (statusfile<0);
/* MOD */ }
/* MOD */ read(statusfile, (void *)(&status), sizeof(statusrec));
/* MOD */ }

/* MOD */ void load_user(unsigned int un, userrec *u)
/* MOD */ {
/* MOD */ long pos;
/* MOD */ char s[80];
/* MOD */ unsigned char oldsl;
/* MOD */ int i;
/* MOD */
/* MOD */ if (un>0) {
/* MOD */ open_user_w();
/* MOD */ pos=((long) syscfg.userreclen) * ((long) un);
/* MOD */ lseek(userfile_w,pos,SEEK_SET);
/* MOD */ i=read(userfile_w, (void *)u, syscfg.userreclen);
/* MOD */ if (i==-1) {
/* MOD */ open_user_w();
/* MOD */ pos=((long) syscfg.userreclen) * ((long) un);
/* MOD */ lseek(userfile_w,pos,SEEK_SET);
/* MOD */ i=read(userfile_w, (void *)u, syscfg.userreclen);
/* MOD */ if (i==-1) {
/* MOD */ pl("COULDN'T LOAD USER.");
/* MOD */ }
/* MOD */ }
/* MOD */ }
/* MOD */ }

/* MOD */ int open_user_w()
/* MOD */ {
/* MOD */ char s[81];
/* MOD */
/* MOD */ close_user_w();
/* MOD */ sprintf(s,"%sUSER.LST",syscfg.datadir);
/* MOD */ userfile_w=open_w(s,0);
/* MOD */ return(userfile_w);
/* MOD */ }

/* MOD */ void close_user_w()
/* MOD */ {
/* MOD */ if (userfile_w!=-1) {
/* MOD */ close(userfile_w);
/* MOD */ userfile_w = -1;
/* MOD */ }
/* MOD */ }

/* MOD */ void prnodestatus()
/* MOD */ {
/* MOD */ typedef struct {
/* MOD */ char name[31], /* node user's name */
/* MOD */ action[31]; /* node user's current action */
/* MOD */ unsigned short number; /* node user's number */
/* MOD */ } nodestatusrec;
/* MOD */ char s[81],s1[81];
/* MOD */ int abort=0, i=1, otherstatusfile;
/* MOD */ nodestatusrec nodestatus;
/* MOD */
/* MOD */ nl();
/* MOD */ pla("Who is currently online: ",&abort);
/* MOD */ nl();
/* MOD */ sprintf(s,"%sSTATUS.1",syscfg.datadir);
/* MOD */ for (i=1; (!abort) && (exist(s)); i++) {
/* MOD */ otherstatusfile=open_r(s);
/* MOD */ read(otherstatusfile, (void *)(&nodestatus), sizeof(nodestatusrec));
/* MOD */ close(otherstatusfile);
/* MOD */ sprintf(s,"%s #%d ...................",nodestatus.name,nodestatus.number);
/* MOD */ sprintf(s1," Node %d %-.25s %s",i,(nodestatus.number ? s : ".........................."),nodestatus.action);
/* MOD */ pla(s1,&abort);
/* MOD */ sprintf(s,"%sSTATUS.%d",syscfg.datadir,i+1);
/* MOD */ }
/* MOD */ nl();
/* MOD */ }

/* MOD */ void save_nodestatus(char *action)
/* MOD */ {
/* MOD */ typedef struct {
/* MOD */ char name[31], /* node user's name */
/* MOD */ action[31]; /* node user's current action */
/* MOD */ unsigned short number; /* node user's number */
/* MOD */ } nodestatusrec;
/* MOD */ nodestatusrec nodestatus;
/* MOD */
/* MOD */ strcpy(nodestatus.name,thisuser.name);
/* MOD */ strcpy(nodestatus.action,action);
/* MOD */ nodestatus.number=usernum;
/* MOD */ lseek(nodestatusfile,0L,SEEK_SET);
/* MOD */ write(nodestatusfile, (void *)(&nodestatus), sizeof(nodestatusrec));
/* MOD */ }



  3 Responses to “Category : BBS Programs+Doors
Archive   : MULTILNE.ZIP
Filename : ML.1

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/