Ejemplo n.º 1
0
/* -------------------------------------------------------------------- */
void putheader(void)
{
    char dtstr[80];

    cit_strftime(dtstr, 79, cfg.datestamp, 0l);

    termCap(TERM_BOLD);
    mPrintf("    %s", dtstr);
    if (loggedIn) {
        if (msgBuf->mbtitle[0]) {
            mPrintf(" From [%s] %s", msgBuf->mbtitle, msgBuf->mbauth);
        } else {
            mPrintf(" From %s", msgBuf->mbauth);
        }
        if (msgBuf->mbsur[0]) {
            mPrintf(" [%s]", msgBuf->mbsur, msgBuf->mbauth);
        }
    }
    if (msgBuf->mbto[0])
        mPrintf(" To %s", msgBuf->mbto);
    if (msgBuf->mbzip[0])
        mPrintf(" @ %s", msgBuf->mbzip);
    if (msgBuf->mbrzip[0])
        mPrintf(", %s", msgBuf->mbrzip);
    if (msgBuf->mbczip[0])
        mPrintf(", %s", msgBuf->mbczip);
    if (msgBuf->mbfwd[0])
        mPrintf(" Forwarded to %s", msgBuf->mbfwd);
    if (msgBuf->mbgroup[0])
        mPrintf(" (%s Only)", msgBuf->mbgroup);
    termCap(TERM_NORMAL);
}
Ejemplo n.º 2
0
/*
** printdir() prints out one filename and size, for a dir listing
*/
static int printdir (struct dirList *fn)
{
    char *desc;
    extern char *getTag();
    extern char *monthTab[];

    if (fn->fd_name[0] != '$')  /* $dir is the directory file */
    {
        outFlag = OUTOK;

        if (FDextended) 
        {
            desc = getTag(fn->fd_name);
            CRfill = (termWidth > 62) ? "%13c|                " : "  ";
            mPrintf("%-13s|%7ld ", fn->fd_name,fn->fd_size);
            mPrintf("%02d%s%02d ", fn->fd_date._year,
                monthTab[fn->fd_date._month],
                fn->fd_date._day);
            if (desc) 
            {
                if (termWidth <= 62)
                    doCR();
                mFormat(desc);
            }
            CRfill = NULL;
            doCR();
        }
        else
            mPrintf("%-14s%7ld ", fn->fd_name, fn->fd_size);
        FDSectCount += fn->fd_size;
        mAbort();                       /* chance to next(!)/pause/skip */
    }
    return (outFlag != OUTSKIP);
}
Ejemplo n.º 3
0
/* -------------------------------------------------------------------- */
void hallinfo()
{
	uchar i;

    mPrintf(" Hallway %s", hallBuf->hall[thisHall].hallname);

    if (hallBuf->hall[thisHall].owned) {
        mPrintf(", owned by group %s",
		grpBuf->group[hallBuf->hall[thisHall].grpno].groupname);
    }

	if (hallBuf->hall[thisHall].mult_grp) {
		for(i=0; i<MAXGROUPS; i++) {
			if(debug) {
				if( grpBuf->group[i].g_inuse) {
					cPrintf("grpBuf=%d hallgrp=%d   ",
						grpBuf->group[i].groupgen,
						hallgrp->hall[thisHall].grp[i].grpgen);
				}
			}
			if ( grpBuf->group[i].g_inuse &&
				(hallgrp->hall[thisHall].grp[i].grpgen ==
				grpBuf->group[i].groupgen))
			{
				mPrintf(", shared by group %s",
				grpBuf->group[i].groupname);
			}
		}
	}
	doCR();
}
Ejemplo n.º 4
0
/* -------------------------------------------------------------------- */
void killhall(void)
{
    int empty = TRUE, i;

    if (thisHall == 0 || thisHall == 1)
    {
        mPrintf("\nThe Main and Maintenance hallways cannot be killed.");
        return;
    }
    
    /* Check hall for any rooms */
    for (i = 0; i < MAXROOMS; i++)
    {
        if ( hallBuf->hall[thisHall].hroomflags[i].inhall
          && roomTab[i].rtflags.INUSE) empty = FALSE;
    }

    if (!empty) 
    {
        mPrintf("\n Hall still has rooms.");
        return;
    }

    if (getYesNo(confirm, 0))
    {
        hallBuf->hall[thisHall].h_inuse = FALSE;
        hallBuf->hall[thisHall].owned   = FALSE;
        putHall();

       sprintf(msgBuf->mbtext,
       "Hallway %s deleted", hallBuf->hall[thisHall].hallname );

       trap(msgBuf->mbtext, T_SYSOP);
    }
}
Ejemplo n.º 5
0
/*
 * CopyFile()
 *
 * This function copies a file into a room.
 */
char CopyFile(char *oldname, int room, long *size)
{
    struct stat buf;
    char *temp;
    char buffer[150];

    if ((temp = FindDirName(room)) == NULL) {
	mPrintf("Can't find room's directory.\n ");
	return FALSE;
    }

    if (stat(oldname, &buf) != 0 || !(buf.st_mode & S_IFREG)) {
	mPrintf("Is not a copyable file.\n ");
	return FALSE;
    }

    *size = buf.st_size;

    CitSystem(FALSE, "copy %s %s > nul", oldname, temp);

    if ((temp = strrchr(oldname, '\\')) != NULL)
	strcpy(oldname, temp + 1);
    else if (oldname[1] == ':')
	strcpy(oldname, oldname + 2);

    temp = FindDirName(room);

    sprintf(buffer, "%s%s%s", temp, (temp[strlen(temp) - 1] == ':') ? "" : "\\",
								oldname);

    return (access(buffer, 0) == 0);
}
Ejemplo n.º 6
0
/* -------------------------------------------------------------------- */
void newgroup(void)
{
    label groupname;
    int slot, i;

    getString("group", groupname, NAMESIZE, FALSE, ECHO, "");

    if ( (groupexists(groupname) != ERROR) || !strlen(groupname) )
    {
        mPrintf("\n We already have a \'%s\' group.", groupname);
        return;
    }

    /* search for a free group slot */

    for (i = 0, slot = 0; i < MAXGROUPS && !slot ; i++)
    {
        if (!grpBuf.group[i].g_inuse) slot = i;
    }

    if (!slot)
    {
        mPrintf("\n Group table full.");
        return;
    }
    
    getString("group description", grpBuf.group[slot].desc, 79, FALSE, ECHO,"");
    
    grpBuf.group[slot].lockout = (getYesNo("Lock group from aides", 0 ));

    grpBuf.group[slot].hidden  = (getYesNo("Hide group", 0 ));
    
    grpBuf.group[slot].autoAdd = (getYesNo("Auto-Add group", 0 ));

    strcpy(grpBuf.group[slot].groupname, groupname);
    grpBuf.group[slot].g_inuse = 1;

    /* increment group generation # */
    grpBuf.group[slot].groupgen =
   (uchar)((grpBuf.group[slot].groupgen + 1) % MAXGROUPGEN);

    if (getYesNo(confirm, 0))
    {
        putGroup();

        sprintf(msgBuf->mbtext,
        "Group %s created", grpBuf.group[slot].groupname );

        trap(msgBuf->mbtext, T_SYSOP);
        
        logBuf.groups[slot] = grpBuf.group[slot].groupgen;
        storeLog();
    }
    else
    {
        getGroup();
    }
}
Ejemplo n.º 7
0
void TERMWINDOWMEMBER dumpRoom(Bool infoLineAndAutoApp)
	{
	doCR();

	if (infoLineAndAutoApp)
		{
		char Buffer[80];
		if (*CurrentRoom->GetDescFile(Buffer, sizeof(Buffer)) &&  !Talley->Visited(thisRoom))
			{
			showRoomDescription();
			}
		else if (*CurrentRoom->GetInfoLine(Buffer, sizeof(Buffer)) && CurrentUser->IsViewRoomInfoLines())
			{
			mPrintfCR(getmsg(634), Buffer);
			}
		}

	// hmmm... where to put this?
	if (infoLineAndAutoApp && CurrentRoom->IsApplication() && CurrentRoom->IsAutoApp() && !Talley->Visited(thisRoom))
		{
		ExeAplic();
		}

	if (CurrentUser->IsAide())
		{
		mPrintf(getmsg(635), ltoac(Talley->TotalMessagesInRoom(thisRoom)));
		}

	const m_slot messages = Talley->MessagesInRoom(thisRoom);
	mPrintf(getmsg(636), ltoac(messages), (messages == 1) ? cfg.Lmsg_nym : cfg.Lmsgs_nym);

	const m_slot newMsgs = Talley->NewInRoom(thisRoom);
	if (newMsgs && loggedIn)
		{
		mPrintf(getmsg(637), ltoac(newMsgs));
		}

	mPrintfCR(getmsg(433));

	if (Talley->HasNewMail(thisRoom) && loggedIn)
		{
		mPrintfCR(getmsg(591));
		}

	if (Talley->HasOldMail(thisRoom) && loggedIn)
		{
		mPrintfCR(getmsg(599));
		}

	label NetID;
	RoomTab[thisRoom].GetNetID(NetID, sizeof(NetID));

	// maybe IsRoomShared check? definitely not!
	if (*NetID && CurrentUser->IsSysop() && IsNetIDCorrupted(NetID))
		{
		mPrintfCR(getmsg(464));
		}
	}
Ejemplo n.º 8
0
void greeting(void)
{
    int messages;
    char dtstr[80];

    if (loggedIn)
        terminate(FALSE, FALSE);
    echo = BOTH;

    setdefaultconfig();
    initroomgen();
    cleargroupgen();
    if (cfg.accounting)
        unlogthisAccount();

    delay(100);

    if (newCarrier)
        hello();

    mPrintf("\n Welcome to %s, %s", cfg.nodeTitle, cfg.nodeRegion);
    mPrintf("\n Running %s v%s", softname, version);
# ifdef ALPHA_TEST
    mPrintf("\n Alpha Test Site");
# endif
# ifdef BETA_TEST
    mPrintf("\n Beta Test Site");
# endif
#ifdef FLOPPY
	mPrintf("\n Floppy edition");
#endif
    doCR();
    doCR();

    cit_strftime(dtstr, 79, cfg.vdatestamp, 0L);
    mPrintf(" %s", dtstr);

    if (!cfg.forcelogin) {
        mPrintf("\n H for Help");
        mPrintf("\n ? for Menu");
        mPrintf("\n L to Login");
    }
    getRoom(LOBBY);

    messages = talleyBuf.room[thisRoom].messages;

    doCR();

    mPrintf("  %d %s ", messages,
    (messages == 1) ? "message" : "messages");

    doCR();

    while (MIReady())
        getMod();
    logBuf.linesScreen = 23;
}
Ejemplo n.º 9
0
void exclude(void)
{
    if  (!logBuf.lbroom[thisRoom].xclude) {
        mPrintf("\n \n Room now excluded from G)oto loop.\n ");
        logBuf.lbroom[thisRoom].xclude = TRUE;
    } else {
        mPrintf("\n \n Room now in G)oto loop.\n ");
        logBuf.lbroom[thisRoom].xclude = FALSE;
    }
}
Ejemplo n.º 10
0
int main(){
	setlogmask (LOG_UPTO (LOG_NOTICE));
	
	openlog ("exampleprog", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
	syslog (LOG_NOTICE, "Program started by User %d", getuid ());
	mPrintf(1, "B tree falls in a forest\n");
	mPrintf(0, "A tree falls in a forest\n");
	//syslog (LOG_INFO, "A tree falls in a forest");
	closelog ();
}
Ejemplo n.º 11
0
/* -------------------------------------------------------------------- */
void killgroup(void)
{
    label groupname;
    int groupslot, i;

    getString("group", groupname, NAMESIZE, FALSE, ECHO, "");

    groupslot = groupexists(groupname);

    if ( groupslot == 0 || groupslot == 1)
    {
        mPrintf("\n Cannot delete Null or Reserved_2 groups.");
        return;
    }

    if ( groupslot == ERROR || !strlen(groupname) )
    {
        mPrintf("\n No such group.");
        return;
    }

    for (i = 0; i < MAXROOMS; i++)
    {
         if  (   roomTab[i].rtflags.INUSE
             &&  roomTab[i].rtflags.GROUPONLY
             && (roomTab[i].grpno  == (unsigned char)groupslot)
          /* && (roomTab[i].grpgen == grpBuf.group[groupslot].groupgen)*/ )
         {
             mPrintf("\n Group still has rooms.");
             return;
         }
    }

    for (i = 0; i < MAXHALLS; i++)
    {
        if ( hallBuf->hall[i].h_inuse
        &&   hallBuf->hall[i].owned 
        &&   hallBuf->hall[i].grpno == (unsigned char)groupslot)
        {
            mPrintf("\n Group still has hallways.");
            return;
        }
    }

    if (!getYesNo(confirm, 0)) return;

    grpBuf.group[groupslot].g_inuse = 0;

    putGroup();

    sprintf(msgBuf->mbtext,
    "Group %s deleted", groupname );

    trap(msgBuf->mbtext, T_SYSOP);
}
Ejemplo n.º 12
0
void EventShow()
{
    void ExamineEvent(), ShowTW();
int i;

    mPrintf("\nCurAbs=%ld\n ", CurAbsolute());
    mPrintf("ANYTIME NET is %d\n ", ClassActive[CL_ANYTIME_NET]);
    mPrintf("non-preempt nextabs is %ld, %ld seconds away\n ",
	Types[2].NextAbs, Types[2].NextAbs - CurAbsolute());
    mPrintf("Preemptive list (%ld):\n ", Types[0].NextAbs);
    RunList(&Types[0].List, ExamineEvent);
    modIn();
    mPrintf("Non-Preemptive list (%ld):\n ", Types[1].NextAbs);
    RunList(&Types[1].List, ExamineEvent);
    modIn();
    mPrintf("Quiet list (%ld):\n ", Types[2].NextAbs);
    RunList(&Types[2].List, ExamineEvent);
    modIn();
    mPrintf("Event ending list:\n ");
    RunList(&EventEnds, ShowTW);
    mPrintf("Anytime net is %s\n ", (ClassActive[CL_ANYTIME_NET]) ? "On" : "Off");
    if (ClassActive[CL_ANYTIME_NET]) {
	msgBuf.mbtext[0] = 0;
	for (i = 0; i < 32; i++)
	    if ((1l << i) & AnyTimeNets)
		sprintf(lbyte(msgBuf.mbtext), "%d, ", i + 1);
	if (strlen(msgBuf.mbtext))
	    msgBuf.mbtext[strLen(msgBuf.mbtext) - 2] = 0;

	mPrintf("Anytime nets: %s\n ", msgBuf.mbtext);
    }
}
Ejemplo n.º 13
0
/* -------------------------------------------------------------------- */
void tutorial(char *filename)
{
    int  i;
    char temp[14];
    char oldverbose;
    
    outFlag     = OUTOK;
    setio(whichIO, echo, outFlag);

    if (!expert)  mPrintf("\n <3J0>ump <3N0>ext <3P0>ause <3S0>top\n");
    /* doCR(); */

    if (changedir(cfg.helppath) == -1 ) return;

    /* no bad files */
    if (checkfilename(filename, 0) == ERROR)
    {
        mPrintf(" No helpfile %s", filename);
        changedir(cfg.homepath);
        return;
    }

    if (ambig(filename))
    {
        /* fill our directory array according to filename */
        oldverbose = verbose;
        verbose = FALSE;
        filldirectory(filename);
        verbose = oldverbose;

        /* print out all the files */
        for (i = 0; filedir[i].entry[0] && 
        ( dumpf(filedir[i].entry) != ERROR) ; i++);

        if ( !i) mPrintf(" No helpfile %s", filename);

        /* free file directory structure */
        if(filedir != NULL)
        _ffree((void *)filedir);
    }
    else
    {
       strcpy(temp, filename);
       temp[strlen(temp)-1] = '@';

       if (filexists(temp) && *term.bold)
         dump(temp);
       else
         dumpf(filename);
    }

    /* go to our home-path */
    changedir(cfg.homepath);
}
Ejemplo n.º 14
0
static void command_loop(void)
{
	char c, more = FALSE, help = FALSE;
    int i;

    while (!ExitToMsdos) {
		
        if (sysReq && !loggedIn && !haveCarrier) {
            sysReq = FALSE;
			if (cfg.offhook) {
                offhook();
            } else {
                drop_dtr();
            }
            ringSystemREQ();
        }
		
		if (parm.door) {
			if (!loggedIn && cfg.forcelogin) {
				for (i = 0; !loggedIn && i < 4; ++i)
					doLogin(2);
				if (!loggedIn) {
					ExitToMsdos = 1;
					break;
				}
			}
		}
		
		more = getCommand(&c);
		
		outFlag = IMPERVIOUS;

		if (chatkey)
			chat();
		
		if (eventkey && !haveCarrier) {
			do_cron(CRON_TIMEOUT);
			eventkey = FALSE;
		}
		
		if (sysopkey)
			help = doSysop();
		else
			help = doRegular(more, c);

		if (help) {
			if (!gl_user.expert)
				mPrintf("\n '?' for menu, 'H' for help.\n \n");
			else
				mPrintf(" ?\n \n");
		}
    }
}
Ejemplo n.º 15
0
/* -------------------------------------------------------------------- */
void displaypw(char *name, char *in, char *pw)
{
    mPrintf("\n nm: %s",name);
    mPrintf("\n in: ");
    echo = CALLER;
    mPrintf("%s", in);
    echo = BOTH;
    mPrintf("\n pw: ");
    echo = CALLER;
    mPrintf("%s",pw);
    echo = BOTH;
    doCR();
}
Ejemplo n.º 16
0
/*
** fileok() check download permissions
*/
static int fileok()
{
    if (roomBuf.rbflags.ISDIR) 
    {
        if (roomBuf.rbflags.DOWNLOAD || SomeSysop())
            return TRUE;
        else
            mPrintf("\b This directory %s is for uploads only.\n ", room_area);
    }
    else
        mPrintf("\b - This is not a directory %s\n ", room_area);
    return NO;
}
Ejemplo n.º 17
0
/* -------------------------------------------------------------------- */
void systat(void)
{
    unsigned int i;
    unsigned long average, work;
    char summary[256];
    char dtstr[80];
    int public = 0, private = 0, group = 0, problem = 0, moderated = 0;

    outFlag = OUTOK;

    /* even the name of the BBS program is not cast in concrete! */
    mPrintf("%s @ %s, %s ", softname, cfg.nodeTitle, cfg.nodeRegion);
    doCR();
    mPrintf(" Running Version %s Compiled on %s at %s",
    version, compdate, comptime);
    doCR();

    cit_strftime(dtstr, 79, cfg.vdatestamp, 0l);
    mPrintf(" %s", dtstr);
    doCR();
    mPrintf(" Up time: ");
    diffstamp(uptimestamp);

    if (gotCarrier()) {
        doCR();
        mPrintf(" Connect time: ");
        diffstamp(conntimestamp);
    }
    if (loggedIn) {
        doCR();
        mPrintf(" Logon time: ");
        diffstamp(logtimestamp);
    }
    doCR();
    mPrintf(" Maximum of %d log entries,", cfg.MAXLOGTAB);

    mPrintf(" Call number %lu", cfg.callno);

    doCR();
    mPrintf(" %ld messages, Last is %lu",
    cfg.newest - cfg.oldest + 1, cfg.newest);

    for (i = 0; i < sizetable(); ++i) {
        if (msgTab[i].mtmsgflags.PROBLEM)
            problem++;
        if (msgTab[i].mtmsgflags.MODERATED)
            moderated++;
        if (msgTab[i].mtmsgflags.LIMITED)
            group++;
        else if (msgTab[i].mtmsgflags.MAIL)
            private++;
        else
            public++;
    }
Ejemplo n.º 18
0
/* -------------------------------------------------------------------- */
void setlbvisit(void)
{
    int i;

    /* see if the message base was cleared since last call */
    for (i = 0; i < MAXROOMS; i++)
    {
        if (logBuf.newpointer[i] > cfg.newest)
        {
            for (i = 0; i < MAXROOMS; i++)
                logBuf.newpointer[i] = cfg.oldest;

#ifdef GOODBYE
            logBuf.lbvisit[ 0            ]= cfg.newest;
            logBuf.lbvisit[ (MAXVISIT-1) ]= cfg.oldest;
#endif

            doCR();
            mPrintf("%s base destroyed since last call!", cfg.msg_nym); doCR();
            mPrintf("All %s pointers reset.", cfg.msg_nym); doCR();
            return;
        }
    }
    
    /* slide lbvisit array down and change lbgen entries to match: */

#ifdef GOODBYE
    for (i = (MAXVISIT - 2);  i;  i--)
    {
        logBuf.lbvisit[i] = logBuf.lbvisit[i-1];
    }
    logBuf.lbvisit[(MAXVISIT - 1)] = cfg.oldest;
    logBuf.lbvisit[0             ] = cfg.newest;
#endif

    for (i = 0;  i < MAXROOMS;  i++)
    {
#ifdef GOODBYE
        if ((logBuf.lbroom[i].lvisit)  <  (MAXVISIT-2))
        {
            logBuf.lbroom[i].lvisit++;
        }
#endif

        logBuf.lbroom[i].bypass = FALSE;
        
        MessageRoom[i] = 0;
    } 
}
Ejemplo n.º 19
0
Bool GroupBuffer::Load(const char *Name)
	{
	assert(this);
	Bool Good = TRUE;
	VerifyHeap();

	if (IsValid())
		{
		FILE *File;
		char FileName[256];

		sprintf(FileName, sbs, cfg.homepath, Name);

		if ((File = fopen(FileName, FO_RB)) != NULL)
			{
			fseek(File, sizeof(long), SEEK_SET);

			for (g_slot Index = 0; Index < NumGroups; Index++)
				{
				if (!Groups[Index].Load(File))
					{
#ifndef WINCIT
					mPrintf(getmsg(83), FileName);
#endif
					Good = FALSE;
					break;
					}

				Groups[Index].Verify();
				}

			fclose(File);
			}
		else
			{
#ifndef WINCIT
			mPrintf(getmsg(78), FileName);
#endif
			Good = FALSE;
			}
		}
	else
		{
		Good = FALSE;
		}

	VerifyHeap();
	return (Good);
	}
Ejemplo n.º 20
0
Bool GroupBuffer::Save(const char *Name) const
	{
	assert(this);
	Bool Good = TRUE;
	VerifyHeap();

	if (IsValid())
		{
		FILE *File;
		char FileName[256];

		sprintf(FileName, sbs, cfg.homepath, Name);

		if ((File = fopen(FileName, FO_WB)) != NULL)
			{
			long l = Groups[0].SizeOfDiskRecord();
			fwrite(&l, sizeof(long), 1, File);

			for (g_slot Index = 0; Index < NumGroups; Index++)
				{
				if (!Groups[Index].Save(File))
					{
#ifndef WINCIT
					mPrintf(getmsg(661), FileName);
#endif
					Good = FALSE;
					break;
					}
				}

			fclose(File);
			}
		else
			{
#ifndef WINCIT
			mPrintf(getmsg(78), FileName);
#endif
			Good = FALSE;
			}
		}
	else
		{
		Good = FALSE;
		}

	VerifyHeap();
	return (Good);
	}
Ejemplo n.º 21
0
/* -------------------------------------------------------------------- */
int dump(char *filename)
{
    FILE *fbuf;
    int c, returnval = TRUE;

    /* last itteration might have been N>exted */
    outFlag = OUTOK;
    setio(whichIO, echo, outFlag);

    doCR();

    if ( (fbuf = fopen(filename, "r")) == NULL)
    {
        mPrintf(" No file %s", filename);
        return(ERROR);
    }

    /* looks like a kludge, but we need speed!! */

    while ( (c = getc(fbuf) ) != ERROR && (c != 26 /* CPMEOF */ )
    && (outFlag != OUTNEXT) && (outFlag != OUTSKIP) && !mAbort(FALSE) )
    {
        if (c == '\n')  doCR();
        else            oChar((char)c);
    }

    if ( outFlag == OUTSKIP) returnval = ERROR;
    
    fclose(fbuf);

    return  returnval;
}
Ejemplo n.º 22
0
/*
 * SetSpace()
 *
 * This moves us to an area associated with the specified room.
 */
char SetSpace(char *area)
{
    char   dir[150], drive;

    if (area == NULL) {
	mPrintf("?Directory not present! (internal error)\n ");
	return FALSE;
    }
    strCpy(dir, area);
    MSDOSparse(dir, &drive);
    if (!realSetSpace(toUpper(drive) - 'A', dir)) {
	mPrintf("?Directory not present!\n ");
	return FALSE;
    }
    return TRUE;
}
Ejemplo n.º 23
0
/* -------------------------------------------------------------------- */
dumpf(char *filename)
{
    FILE *fbuf;
    char line[MAXWORD];
    int returnval = TRUE;

    /* last itteration might have been N>exted */
    outFlag = OUTOK;
    setio(whichIO, echo, outFlag);

    doCR();

    if ( (fbuf = fopen(filename, "r")) == NULL)
    {
        mPrintf(" No helpfile %s", filename);
        return(ERROR);
    }
    /* looks like a kludge, but we need speed!! */

    while ( fgets(line, MAXWORD, fbuf) && (outFlag != OUTNEXT)
    && (outFlag != OUTSKIP) && !mAbort(FALSE) )
    {
        mFormat(line);
    }
    if ( outFlag == OUTSKIP) returnval = ERROR;
    
    fclose(fbuf);

    return  returnval;
}
Ejemplo n.º 24
0
void doLogin(char moreYet)	/* TRUE to accept following parameters  */
{
    char InitPw[NAMESIZE*2+2];
    char passWord[NAMESIZE*2+2];
    char Initials[NAMESIZE*2+2];
    char *semicolon;

    if (justLostCarrier || ExitToMsdos)
        return;

    if (moreYet == 2)
        moreYet = FALSE;
    else
        mPrintf("\bLogin");

    /* we want to be in console mode when we log in from local */
    if (!gotCarrier() && !loggedIn) {
        whichIO = CONSOLE;
        onConsole = (char) (whichIO == CONSOLE);
        /* update25();	*/
		do_idle(0);
        if (cfg.offhook)
            offhook();
    }
    if (loggedIn) {
        mPrintf("\n Already logged in!\n ");
        return;
    }
    getNormStr((moreYet) ? "" : "your initials", InitPw, NAMESIZE*2+2, NO_ECHO);
    dospCR();

    semicolon = strchr(InitPw, ';');

    if (!semicolon) {
        strncpy(Initials, InitPw,NAMESIZE);
		Initials[NAMESIZE] = '\0';
        getNormStr("password", passWord, NAMESIZE, NO_ECHO);
        dospCR();
    } else
        normalizepw(InitPw, Initials, passWord, semicolon);

    /* don't allow anything over NAMESIZE characters */
    Initials[NAMESIZE] = '\0';

    login(Initials, passWord);
}
Ejemplo n.º 25
0
/*
** getpdate() get a date for reading from
*/
static int getpdate()
{
    label adate;
    long parsedate();

    if (dPass) 
    {
        mPrintf("%s when? ", (dPass==dAFTER)?"After":"Before");
        getNormStr("", adate, NAMESIZE, YES);
        if ((dDate = parsedate(adate)) == ERROR) 
        {
            mPrintf("bad date\n ");
            return NO;
        }
    }
    return TRUE;
}
Ejemplo n.º 26
0
/* -------------------------------------------------------------------- */
void systat(char verbose)
{
    union REGS r;
    int i;
    int tablesize;
    long average, work;
    char summary[250];
    char dtstr[80];
    int  public    = 0,
         private   = 0,
         group     = 0,
         problem   = 0,
         moderated = 0;

    outFlag = OUTOK;

    mPrintf("%s %s, %s ", softname, cfg.nodeTitle, cfg.nodeRegion
                                   );
    doCR();
    mPrintf(" Running Version %s Compiled on %s at %s",
              version, cmpDate, cmpTime);
    doCR();

    sstrftime(dtstr, 79, cfg.vdatestamp, 0l);
    mPrintf(" %s", dtstr);
    doCR();
    mPrintf(" Up time: ");  diffstamp(uptimestamp);

    if (gotCarrier())
    {
        doCR();
        mPrintf(" Connect time: ");  diffstamp(conntimestamp);
    }

    doCR();
    mPrintf(" Maximum of %d log entries,", cfg.MAXLOGTAB);

    mPrintf(" Call number %s", ltoac(cfg.callno));

    doCR();
    strcpy(dtstr, ltoac(cfg.newest - cfg.oldest + 1));
    mPrintf(" %s %s, numbered %lu to %lu",
        dtstr, cfg.msgs_nym, cfg.oldest, cfg.newest);

    tablesize = (int)sizetable();
    for( i = 0; i < tablesize; ++i)
    {
             if (msgTab1[i].mtmsgflags.PROBLEM  ) problem++;
             if (msgTab1[i].mtmsgflags.MODERATED) moderated++;
             if (msgTab1[i].mtmsgflags.LIMITED  ) group++  ;
       else  if (msgTab1[i].mtmsgflags.MAIL     ) private++;
       else                                      public++ ;
    }
Ejemplo n.º 27
0
/* -------------------------------------------------------------------- */
void replaceString(char *buf, int lim, char ver)
{
    char oldString[256];
    char newString[256];
    char *loc, *textEnd;
    char *pc;
    int incr, length;

    /* find terminal null */
    for (textEnd = buf, length = 0; *textEnd; length++, textEnd++);

    getString("text", oldString, 256, FALSE, ECHO, "");
    if (!*oldString) {
        mPrintf(" Text not found.\n");
        return;
    }
    if ((loc = matchString(buf, oldString, textEnd, ver)) == NULL) {
        mPrintf(" Text not found.\n ");
        return;
    }
    getString("replacement text", newString, 256, FALSE, ECHO, "");
    if (strlen(newString) > strlen(oldString)
    && ((strlen(newString) - strlen(oldString)) >= lim - length)) {
        mPrintf(" Buffer overflow.\n ");    /* FJM: should be trapped ??? */
        return;         /* nope, it's a user error.   */
    }
    /* delete old string: */
    for (pc = loc, incr = strlen(oldString); (*pc = *(pc + incr)) != 0; pc++)
        ;
    textEnd -= incr;

    /* make room for new string: */
    for (pc = textEnd, incr = strlen(newString); pc >= loc; pc--) {
        *(pc + incr) = *pc;
    }

    /* insert new string: */
    for (pc = newString; *pc; *loc++ = *pc++)
        ;
}
Ejemplo n.º 28
0
static void listExterns(void)
{
	int i;
	int cmnds_visable=0;
	char *p;

	doCR();
	if (onConsole && extCmd[0].name[0]) {
			cmnds_visable = 1;
	} else {
		for (i = 0; i < MAXEXTERN && extCmd[i].name[0]; ++i)
			if (!extCmd[i].local) {
				cmnds_visable = 1;
				break;
			}
	}

	outFlag = OUTOK;
	if (cmnds_visable) {
		mtPrintf(TERM_BOLD,"External Commands:");
		doCR();
		doCR();
		for (i = 0; i < MAXEXTERN && extCmd[i].name[0]; ++i) {
			if (onConsole || !extCmd[i].local) {
				p = extCmd[i].name;
				mtPrintf(TERM_BOLD,"%c",*p);
				++p;
				if (*p)
					mPrintf("%s", p);
				if (extCmd[i].local)
					mPrintf(" (local)");
				doCR();
			}
		}
	} else {
		mtPrintf(TERM_BOLD,"No external commands.");
		doCR();
	}
}
Ejemplo n.º 29
0
void doHelp(char expand)	/* TRUE to accept following parameters  */
{
    label fileName;

    mPrintf("\bHelp File(s)");
    if (!expand) {
        mPrintf("\n\n");
        nexthelp("dohelp", &(cfg.cnt.dohelptut), 1);
        return;
    }
    getString("", fileName, 9, 1, ECHO, "");
    normalizeString(fileName);

    if (strlen(fileName) == 0)
        strcpy(fileName, "dohelp");

    if (fileName[0] == '?') {
        nexthelp("helpopt", &(cfg.cnt.helpopttut), 1);
    } else {
        nexthelp(fileName, &(cfg.cnt.fileNametut), 1);
    }
}
Ejemplo n.º 30
0
/* -------------------------------------------------------------------- */
void moveHall(int offset)
{
    struct hall_buffer tmp;
    
    mPrintf("Move hall"); doCR(); doCR();
    
    if  (   
            (thisHall > (2)        || offset ==  1)    
         && (thisHall < (MAXHALLS) || offset == -1)
        )
    {
        tmp                             = hallBuf->hall[thisHall];
        hallBuf->hall[thisHall]         = hallBuf->hall[thisHall+offset];
        hallBuf->hall[thisHall+offset]  = tmp;
        
        thisHall += offset;
        
        mPrintf("Hall moved to just after %s.",
                hallBuf->hall[thisHall-1].hallname);  doCR();
        
        putHall();
    }
}