Annotation of sbbs/sbbs3/atcodes.cpp, revision 1.1

1.1     ! root        1: /* atcodes.cpp */
        !             2: 
        !             3: /* Synchronet "@code" functions */
        !             4: 
        !             5: /* $Id: atcodes.cpp,v 1.3 2000/11/14 02:16:57 rswindell Exp $ */
        !             6: 
        !             7: /****************************************************************************
        !             8:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
        !             9:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
        !            10:  *                                                                                                                                                     *
        !            11:  * Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html         *
        !            12:  *                                                                                                                                                     *
        !            13:  * This program is free software; you can redistribute it and/or                       *
        !            14:  * modify it under the terms of the GNU General Public License                         *
        !            15:  * as published by the Free Software Foundation; either version 2                      *
        !            16:  * of the License, or (at your option) any later version.                                      *
        !            17:  * See the GNU General Public License for more details: gpl.txt or                     *
        !            18:  * http://www.fsf.org/copyleft/gpl.html                                                                                *
        !            19:  *                                                                                                                                                     *
        !            20:  * Anonymous FTP access to the most recent released source is available at     *
        !            21:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
        !            22:  *                                                                                                                                                     *
        !            23:  * Anonymous CVS access to the development source and modification history     *
        !            24:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
        !            25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
        !            26:  *     (just hit return, no password is necessary)                                                     *
        !            27:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
        !            28:  *                                                                                                                                                     *
        !            29:  * For Synchronet coding style and modification guidelines, see                                *
        !            30:  * http://www.synchro.net/source.html                                                                          *
        !            31:  *                                                                                                                                                     *
        !            32:  * You are encouraged to submit any modifications (preferably in Unix diff     *
        !            33:  * format) via e-mail to [email protected]                                                                      *
        !            34:  *                                                                                                                                                     *
        !            35:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
        !            36:  ****************************************************************************/
        !            37: 
        !            38: #include "sbbs.h"
        !            39: #include "cmdshell.h"
        !            40: 
        !            41: /****************************************************************************/
        !            42: /* Returns 0 if invalid @ code. Returns length of @ code if valid.          */
        !            43: /****************************************************************************/
        !            44: int sbbs_t::atcodes(char *instr)
        !            45: {
        !            46:        char    str[64],str2[64],*p,*tp,*sp;
        !            47:     int     i,len;
        !            48:        long    l;
        !            49:     stats_t stats;
        !            50:     node_t  node;
        !            51:        struct  tm tm;
        !            52:        struct  tm * tm_p;
        !            53: 
        !            54:        sprintf(str,"%.40s",instr);
        !            55:        tp=strchr(str+1,'@');
        !            56:        if(!tp)                 /* no terminating @ */
        !            57:                return(0);
        !            58:        sp=strchr(str+1,SP);
        !            59:        if(sp && sp<tp)         /* space before terminating @ */
        !            60:                return(0);
        !            61:        len=(tp-str)+1;
        !            62:        (*tp)=0;
        !            63:        sp=(str+1);
        !            64: 
        !            65:        if(!strcmp(sp,"VER"))
        !            66:                bputs(VERSION);
        !            67: 
        !            68:        else if(!strcmp(sp,"REV"))
        !            69:                bprintf("%c",REVISION);
        !            70: 
        !            71:        else if(!strcmp(sp,"BBS") || !strcmp(sp,"BOARDNAME"))
        !            72:                bputs(cfg.sys_name);
        !            73: 
        !            74:        else if(!strcmp(sp,"BAUD") || !strcmp(sp,"BPS"))
        !            75:                bprintf("%lu",cur_rate);
        !            76: 
        !            77:        else if(!strcmp(sp,"CONN"))
        !            78:                bputs(connection);
        !            79: 
        !            80:        else if(!strcmp(sp,"SYSOP"))
        !            81:                bputs(cfg.sys_op);
        !            82: 
        !            83:        else if(!strcmp(sp,"LOCATION"))
        !            84:                bputs(cfg.sys_location);
        !            85: 
        !            86:        else if(!strcmp(sp,"NODE"))
        !            87:                bprintf("%u",cfg.node_num);
        !            88: 
        !            89:        else if(!strcmp(sp,"TNODE"))
        !            90:                bprintf("%u",cfg.sys_nodes);
        !            91: 
        !            92:        else if(!strcmp(sp,"INETADDR"))
        !            93:                bputs(cfg.sys_inetaddr);
        !            94: 
        !            95:        else if(!strcmp(sp,"FIDOADDR")) {
        !            96:                if(cfg.total_faddrs)
        !            97:                        bputs(faddrtoa(cfg.faddr[0]));
        !            98:        }
        !            99: 
        !           100:        else if(!strcmp(sp,"QWKID"))
        !           101:                bputs(cfg.sys_id);
        !           102: 
        !           103:        else if(!strcmp(sp,"TIME") || !strcmp(sp,"SYSTIME")) {
        !           104:                now=time(NULL);
        !           105:                tm_p=gmtime(&now);
        !           106:                if(tm_p!=NULL)
        !           107:                        tm=*tm_p;
        !           108:                else
        !           109:                        memset(&tm,0,sizeof(tm));
        !           110:                bprintf("%02d:%02d %s"
        !           111:                        ,tm.tm_hour==0 ? 12
        !           112:                        : tm.tm_hour>12 ? tm.tm_hour-12
        !           113:                        : tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am"); 
        !           114:        }
        !           115: 
        !           116:        else if(!strcmp(sp,"DATE") || !strcmp(sp,"SYSDATE")) {
        !           117:                now=time(NULL);
        !           118:                bputs(unixtodstr(&cfg,now,str2)); }
        !           119: 
        !           120:        else if(!strcmp(sp,"TMSG")) {
        !           121:                l=0;
        !           122:                for(i=0;i<cfg.total_subs;i++)
        !           123:                        l+=getposts(i);                 /* l=total posts */
        !           124:                bprintf("%lu",l); }
        !           125: 
        !           126:        else if(!strcmp(sp,"TUSER"))
        !           127:                bprintf("%u",lastuser(&cfg));
        !           128: 
        !           129:        else if(!strcmp(sp,"TFILE")) {
        !           130:                l=0;
        !           131:                for(i=0;i<cfg.total_dirs;i++)
        !           132:                        l+=getfiles(i);
        !           133:                bprintf("%lu",l); }
        !           134: 
        !           135:        else if(!strcmp(sp,"TCALLS") || !strcmp(sp,"NUMCALLS")) {
        !           136:                getstats(&cfg,0,&stats);
        !           137:                bprintf("%lu",stats.logons); }
        !           138: 
        !           139:        else if(!strcmp(sp,"PREVON") || !strcmp(sp,"LASTCALLERNODE")
        !           140:                || !strcmp(sp,"LASTCALLERSYSTEM"))
        !           141:                bputs(lastuseron);
        !           142: 
        !           143:        else if(!strcmp(sp,"CLS"))
        !           144:                CLS;
        !           145: 
        !           146:        else if(!strcmp(sp,"PAUSE") || !strcmp(sp,"MORE"))
        !           147:                pause();
        !           148: 
        !           149:        else if(!strcmp(sp,"NOPAUSE") || !strcmp(sp,"POFF"))
        !           150:                sys_status^=SS_PAUSEOFF;
        !           151: 
        !           152:        else if(!strcmp(sp,"PON") || !strcmp(sp,"AUTOMORE"))
        !           153:                sys_status^=SS_PAUSEON;
        !           154: 
        !           155:        /* NOSTOP */
        !           156: 
        !           157:        /* STOP */
        !           158: 
        !           159:        else if(!strcmp(sp,"BELL") || !strcmp(sp,"BEEP"))
        !           160:                outchar(BEL);
        !           161: 
        !           162:        // else if(!strcmp(sp,"EVENT"))
        !           163:        //        bputs(sectostr(sys_eventtime,str2));
        !           164: 
        !           165:        /* LASTCALL */
        !           166: 
        !           167:        else if(!strncmp(sp,"NODE",4)) {
        !           168:                i=atoi(sp+4);
        !           169:                if(i && i<=cfg.sys_nodes) {
        !           170:                        getnodedat(i,&node,0);
        !           171:                        printnodedat(i,&node); } }
        !           172: 
        !           173:        else if(!strcmp(sp,"WHO"))
        !           174:                whos_online(true);
        !           175: 
        !           176:        /* User Codes */
        !           177: 
        !           178:        else if(!strcmp(sp,"USER") || !strcmp(sp,"ALIAS") || !strcmp(sp,"NAME"))
        !           179:                bputs(useron.alias);
        !           180: 
        !           181:        else if(!strcmp(sp,"FIRST")) {
        !           182:                strcpy(str2,useron.alias);
        !           183:                tp=strchr(str2,SP);
        !           184:                if(tp) *tp=0;
        !           185:                bputs(str2); }
        !           186: 
        !           187:        else if(!strcmp(sp,"USERNUM")) 
        !           188:                bprintf("%u",useron.number);
        !           189: 
        !           190:        else if(!strcmp(sp,"PHONE") || !strcmp(sp,"HOMEPHONE")
        !           191:                || !strcmp(sp,"DATAPHONE") || !strcmp(sp,"DATA"))
        !           192:                bputs(useron.phone);
        !           193: 
        !           194:        else if(!strcmp(sp,"ADDR1"))
        !           195:                bputs(useron.address);
        !           196: 
        !           197:        else if(!strcmp(sp,"FROM"))
        !           198:                bputs(useron.location);
        !           199: 
        !           200:        else if(!strcmp(sp,"CITY")) {
        !           201:                strcpy(str2,useron.location);
        !           202:                p=strchr(str2,',');
        !           203:                if(p) {
        !           204:                        *p=0;
        !           205:                        bputs(str2); } }
        !           206: 
        !           207:        else if(!strcmp(sp,"STATE")) {
        !           208:                p=strchr(useron.location,',');
        !           209:                if(p) {
        !           210:                        p++;
        !           211:                        if(*p==SP)
        !           212:                                p++;
        !           213:                        bputs(p); } }
        !           214: 
        !           215:        else if(!strcmp(sp,"CPU") || !strcmp(sp,"HOST"))
        !           216:                bputs(useron.comp);
        !           217: 
        !           218:        else if(!strcmp(sp,"BDATE"))
        !           219:                bputs(useron.birth);
        !           220: 
        !           221:        else if(!strcmp(sp,"CALLS") || !strcmp(sp,"NUMTIMESON"))
        !           222:                bprintf("%u",useron.logons);
        !           223: 
        !           224:        else if(!strcmp(sp,"MEMO"))
        !           225:                bputs(unixtodstr(&cfg,useron.pwmod,str2));
        !           226: 
        !           227:        else if(!strcmp(sp,"SEC") || !strcmp(sp,"SECURITY"))
        !           228:                bprintf("%u",useron.level);
        !           229: 
        !           230:        else if(!strcmp(sp,"SINCE"))
        !           231:                bputs(unixtodstr(&cfg,useron.firston,str2));
        !           232: 
        !           233:        else if(!strcmp(sp,"TIMEON") || !strcmp(sp,"TIMEUSED")) {
        !           234:                now=time(NULL);
        !           235:                bprintf("%u",(now-logontime)/60); }
        !           236: 
        !           237:        else if(!strcmp(sp,"TUSED")) {              /* Synchronet only */
        !           238:                now=time(NULL);
        !           239:                bputs(sectostr(now-logontime,str2)+1); }
        !           240: 
        !           241:        else if(!strcmp(sp,"TLEFT")) {              /* Synchronet only */
        !           242:                gettimeleft();
        !           243:                bputs(sectostr(timeleft,str2)+1); }
        !           244: 
        !           245:        else if(!strcmp(sp,"TPERD"))                /* Synchronet only */
        !           246:                bputs(sectostr(cfg.level_timeperday[useron.level],str)+1);
        !           247: 
        !           248:        else if(!strcmp(sp,"TPERC"))                /* Synchronet only */
        !           249:                bputs(sectostr(cfg.level_timepercall[useron.level],str)+1);
        !           250: 
        !           251:        else if(!strcmp(sp,"TIMELIMIT"))
        !           252:                bprintf("%u",cfg.level_timepercall[useron.level]);
        !           253: 
        !           254:        else if(!strcmp(sp,"MINLEFT") || !strcmp(sp,"LEFT") || !strcmp(sp,"TIMELEFT")) {
        !           255:                gettimeleft();
        !           256:                bprintf("%u",timeleft/60); }
        !           257: 
        !           258:        else if(!strcmp(sp,"LASTON"))
        !           259:                bputs(timestr(&useron.laston));
        !           260: 
        !           261:        else if(!strcmp(sp,"LASTDATEON"))
        !           262:                bputs(unixtodstr(&cfg,useron.laston,str2));
        !           263: 
        !           264:        else if(!strcmp(sp,"LASTTIMEON")) {
        !           265:                tm_p=gmtime(&useron.laston);
        !           266:                if(tm_p)
        !           267:                        tm=*tm_p;
        !           268:                else
        !           269:                        memset(&tm,0,sizeof(tm));
        !           270:                bprintf("%02d:%02d %s"
        !           271:                        ,tm.tm_hour==0 ? 12
        !           272:                        : tm.tm_hour>12 ? tm.tm_hour-12
        !           273:                        : tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am"); 
        !           274:        }
        !           275: 
        !           276:        else if(!strcmp(sp,"MSGLEFT") || !strcmp(sp,"MSGSLEFT"))
        !           277:                bprintf("%u",useron.posts);
        !           278: 
        !           279:        else if(!strcmp(sp,"MSGREAD"))
        !           280:                bprintf("%u",posts_read);
        !           281: 
        !           282:        else if(!strcmp(sp,"FREESPACE")) 
        !           283:                bprintf("%lu",getfreediskspace(cfg.temp_dir)); 
        !           284: 
        !           285:        else if(!strcmp(sp,"UPBYTES"))
        !           286:                bprintf("%lu",useron.ulb);
        !           287: 
        !           288:        else if(!strcmp(sp,"UPK"))
        !           289:                bprintf("%lu",useron.ulb/1024L);
        !           290: 
        !           291:        else if(!strcmp(sp,"UPS") || !strcmp(sp,"UPFILES"))
        !           292:                bprintf("%u",useron.uls);
        !           293: 
        !           294:        else if(!strcmp(sp,"DLBYTES"))
        !           295:                bprintf("%lu",useron.dlb);
        !           296: 
        !           297:        else if(!strcmp(sp,"DOWNK"))
        !           298:                bprintf("%lu",useron.dlb/1024L);
        !           299: 
        !           300:        else if(!strcmp(sp,"DOWNS") || !strcmp(sp,"DLFILES"))
        !           301:                bprintf("%u",useron.dls);
        !           302: 
        !           303:        else if(!strcmp(sp,"LASTNEW"))
        !           304:                bputs(unixtodstr(&cfg,ns_time,str2));
        !           305: 
        !           306:        else if(!strcmp(sp,"NEWFILETIME"))
        !           307:                bputs(timestr(&ns_time));
        !           308: 
        !           309:        /* MAXDL */
        !           310: 
        !           311:        else if(!strcmp(sp,"MAXDK") || !strcmp(sp,"DLKLIMIT") || !strcmp(sp,"KBLIMIT"))
        !           312:                bprintf("%lu",cfg.level_freecdtperday[useron.level]/1024L);
        !           313: 
        !           314:        else if(!strcmp(sp,"DAYBYTES"))     /* amt of free cdts used today */
        !           315:                bprintf("%lu",cfg.level_freecdtperday[useron.level]-useron.freecdt);
        !           316: 
        !           317:        else if(!strcmp(sp,"BYTELIMIT"))
        !           318:                bprintf("%lu",cfg.level_freecdtperday[useron.level]);
        !           319: 
        !           320:        else if(!strcmp(sp,"KBLEFT"))
        !           321:                bprintf("%lu",(useron.cdt+useron.freecdt)/1024L);
        !           322: 
        !           323:        else if(!strcmp(sp,"BYTESLEFT"))
        !           324:                bprintf("%lu",useron.cdt+useron.freecdt);
        !           325: 
        !           326:        else if(!strcmp(sp,"CONF"))
        !           327:                bprintf("%s %s"
        !           328:                        ,usrgrps ? cfg.grp[usrgrp[curgrp]]->sname :nulstr
        !           329:                        ,usrgrps ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->sname : nulstr);
        !           330: 
        !           331:        else if(!strcmp(sp,"CONFNUM"))
        !           332:                bprintf("%u %u",curgrp+1,cursub[curgrp]+1);
        !           333: 
        !           334:        else if(!strcmp(sp,"NUMDIR"))
        !           335:                bprintf("%u %u",usrlibs ? curlib+1 : 0,usrlibs ? curdir[curlib]+1 : 0);
        !           336: 
        !           337:        else if(!strcmp(sp,"EXDATE") || !strcmp(sp,"EXPDATE"))
        !           338:                bputs(unixtodstr(&cfg,useron.expire,str2));
        !           339: 
        !           340:        else if(!strcmp(sp,"EXPDAYS")) {
        !           341:                now=time(NULL);
        !           342:                l=useron.expire-now;
        !           343:                if(l<0)
        !           344:                        l=0;
        !           345:                bprintf("%u",l/(1440L*60L)); }
        !           346: 
        !           347:        else if(!strcmp(sp,"MEMO1"))
        !           348:                bputs(useron.note);
        !           349: 
        !           350:        else if(!strcmp(sp,"MEMO2") || !strcmp(sp,"COMPANY"))
        !           351:                bputs(useron.name);
        !           352: 
        !           353:        else if(!strcmp(sp,"ZIP"))
        !           354:                bputs(useron.zipcode);
        !           355: 
        !           356:        else if(!strcmp(sp,"HANGUP"))
        !           357:                hangup();
        !           358: 
        !           359:        else
        !           360:                return(syncatcodes(sp, len));
        !           361: 
        !           362:        return(len);
        !           363: }
        !           364: 
        !           365: int sbbs_t::syncatcodes(char *sp, int len)
        !           366: {
        !           367:        char str2[128],*tp;
        !           368:     stats_t stats;
        !           369: 
        !           370:        /* Synchronet Specific */
        !           371: 
        !           372:        if(!strncmp(sp,"SETSTR:",7))
        !           373:                strcpy(main_csi.str,sp+7);
        !           374: 
        !           375:        else if(!strncmp(sp,"EXEC:",5))
        !           376:                exec_bin(sp+5,&main_csi);
        !           377: 
        !           378:        else if(!strncmp(sp,"MENU:",5))
        !           379:                menu(sp+5);
        !           380: 
        !           381:        else if(!strncmp(sp,"TYPE:",5))
        !           382:                printfile(cmdstr(sp+5,nulstr,nulstr,str2),0);
        !           383: 
        !           384:        else if(!strcmp(sp,"QUESTION"))
        !           385:                bputs(question);
        !           386: 
        !           387:        else if(!strncmp(sp,"NAME-L",6))
        !           388:                bprintf("%-*.*s",len,len,useron.alias);
        !           389: 
        !           390:        else if(!strncmp(sp,"NAME-R",6))
        !           391:                bprintf("%*.*s",len,len,useron.alias);
        !           392: 
        !           393:        else if(!strcmp(sp,"HANDLE"))
        !           394:                bputs(useron.handle);
        !           395: 
        !           396:        else if(!strcmp(sp,"CID") || !strcmp(sp,"IP"))
        !           397:                bputs(cid);
        !           398: 
        !           399:        else if(!strcmp(sp,"LOCAL-IP")) {
        !           400:                struct in_addr in_addr;
        !           401:                in_addr.s_addr=local_addr;
        !           402:                bprintf("%s",inet_ntoa(in_addr));
        !           403:        }
        !           404: 
        !           405:        else if(!strcmp(sp,"CRLF")) {
        !           406:                CRLF;
        !           407:        }
        !           408: 
        !           409:        else if(!strcmp(sp,"PUSHXY")) 
        !           410:                ANSI_SAVE();
        !           411: 
        !           412:        else if(!strcmp(sp,"POPXY")) 
        !           413:                ANSI_RESTORE();
        !           414: 
        !           415:        else if(!strcmp(sp,"UP")) 
        !           416:                rputs("\x1b[A");
        !           417: 
        !           418:        else if(!strcmp(sp,"DOWN")) 
        !           419:                rputs("\x1b[B");
        !           420: 
        !           421:        else if(!strcmp(sp,"RIGHT")) 
        !           422:                rputs("\x1b[C");
        !           423: 
        !           424:        else if(!strcmp(sp,"LEFT")) 
        !           425:                rputs("\x1b[D");
        !           426: 
        !           427:        else if(!strncmp(sp,"UP:",3))
        !           428:                rprintf("\x1b[%dA",atoi(sp+3));
        !           429: 
        !           430:        else if(!strncmp(sp,"DOWN:",5))
        !           431:                rprintf("\x1b[%dB",atoi(sp+5));
        !           432: 
        !           433:        else if(!strncmp(sp,"LEFT:",5))
        !           434:                rprintf("\x1b[%dC",atoi(sp+5));
        !           435: 
        !           436:        else if(!strncmp(sp,"RIGHT:",6))
        !           437:                rprintf("\x1b[%dD",atoi(sp+6));
        !           438: 
        !           439:        else if(!strncmp(sp,"GOTOXY:",7)) {
        !           440:                tp=strchr(sp,',');
        !           441:                if(tp!=NULL) {
        !           442:                        tp++;
        !           443:                        GOTOXY(atoi(sp+7),atoi(tp));
        !           444:                }
        !           445:        }
        !           446: 
        !           447:        else if(!strcmp(sp,"GRP"))
        !           448:                bputs(usrgrps ? cfg.grp[usrgrp[curgrp]]->sname : nulstr);
        !           449: 
        !           450:        else if(!strncmp(sp,"GRP-L",5))
        !           451:                bprintf("%-*.*s",len,len,usrgrps ? cfg.grp[usrgrp[curgrp]]->sname : nulstr);
        !           452: 
        !           453:        else if(!strncmp(sp,"GRP-R",5))
        !           454:                bprintf("%*.*s",len,len,usrgrps ? cfg.grp[usrgrp[curgrp]]->sname : nulstr);
        !           455: 
        !           456:        else if(!strcmp(sp,"GRPL"))
        !           457:                bputs(usrgrps ? cfg.grp[usrgrp[curgrp]]->lname : nulstr);
        !           458: 
        !           459:        else if(!strncmp(sp,"GRPL-L",6))
        !           460:                bprintf("%-*.*s",len,len,usrgrps ? cfg.grp[usrgrp[curgrp]]->lname : nulstr);
        !           461: 
        !           462:        else if(!strncmp(sp,"GRPL-R",6))
        !           463:                bprintf("%*.*s",len,len,usrgrps ? cfg.grp[usrgrp[curgrp]]->lname : nulstr);
        !           464: 
        !           465:        else if(!strcmp(sp,"GN"))
        !           466:                bprintf("%u",usrgrps ? curgrp+1 : 0);
        !           467: 
        !           468:        else if(!strcmp(sp,"GL"))
        !           469:                bprintf("%-4u",usrgrps ? curgrp+1 : 0);
        !           470: 
        !           471:        else if(!strcmp(sp,"GR"))
        !           472:                bprintf("%4u",usrgrps ? curgrp+1 : 0);
        !           473: 
        !           474:        else if(!strcmp(sp,"SUB"))
        !           475:                bputs(usrgrps ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->sname : nulstr);
        !           476: 
        !           477:        else if(!strncmp(sp,"SUB-L",5))
        !           478:                bprintf("%-*.*s",len,len,usrgrps
        !           479:                        ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->sname : nulstr);
        !           480: 
        !           481:        else if(!strncmp(sp,"SUB-R",5))
        !           482:                bprintf("%*.*s",len,len,usrgrps
        !           483:                        ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->sname : nulstr);
        !           484: 
        !           485:        else if(!strcmp(sp,"SUBL"))
        !           486:                bputs(usrgrps  ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->lname : nulstr);
        !           487: 
        !           488:        else if(!strncmp(sp,"SUBL-L",6))
        !           489:                bprintf("%-*.*s",len,len,usrgrps
        !           490:                        ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->lname : nulstr);
        !           491: 
        !           492:        else if(!strncmp(sp,"SUBL-R",6))
        !           493:                bprintf("%*.*s",len,len,usrgrps
        !           494:                        ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->lname : nulstr);
        !           495: 
        !           496:        else if(!strcmp(sp,"SN"))
        !           497:                bprintf("%u",usrgrps ? cursub[curgrp]+1 : 0);
        !           498: 
        !           499:        else if(!strcmp(sp,"SL"))
        !           500:                bprintf("%-4u",usrgrps ? cursub[curgrp]+1 : 0);
        !           501: 
        !           502:        else if(!strcmp(sp,"SR"))
        !           503:                bprintf("%4u",usrgrps ? cursub[curgrp]+1 : 0);
        !           504: 
        !           505:        else if(!strcmp(sp,"LIB"))
        !           506:                bputs(usrlibs ? cfg.lib[usrlib[curlib]]->sname : nulstr);
        !           507: 
        !           508:        else if(!strncmp(sp,"LIB-L",5))
        !           509:                bprintf("%-*.*s",len,len,usrlibs ? cfg.lib[usrlib[curlib]]->sname : nulstr);
        !           510: 
        !           511:        else if(!strncmp(sp,"LIB-R",5))
        !           512:                bprintf("%*.*s",len,len,usrlibs ? cfg.lib[usrlib[curlib]]->sname : nulstr);
        !           513: 
        !           514:        else if(!strcmp(sp,"LIBL"))
        !           515:                bputs(usrlibs ? cfg.lib[usrlib[curlib]]->lname : nulstr);
        !           516: 
        !           517:        else if(!strncmp(sp,"LIBL-L",6))
        !           518:                bprintf("%-*.*s",len,len,usrlibs ? cfg.lib[usrlib[curlib]]->lname : nulstr);
        !           519: 
        !           520:        else if(!strncmp(sp,"LIBL-R",6))
        !           521:                bprintf("%*.*s",len,len,usrlibs ? cfg.lib[usrlib[curlib]]->lname : nulstr);
        !           522: 
        !           523:        else if(!strcmp(sp,"LN"))
        !           524:                bprintf("%u",usrlibs ? curlib+1 : 0);
        !           525: 
        !           526:        else if(!strcmp(sp,"LL"))
        !           527:                bprintf("%-4u",usrlibs ? curlib+1 : 0);
        !           528: 
        !           529:        else if(!strcmp(sp,"LR"))
        !           530:                bprintf("%4u",usrlibs  ? curlib+1 : 0);
        !           531: 
        !           532:        else if(!strcmp(sp,"DIR"))
        !           533:                bputs(usrlibs ? cfg.dir[usrdir[curlib][curdir[curlib]]]->sname :nulstr);
        !           534: 
        !           535:        else if(!strncmp(sp,"DIR-L",5))
        !           536:                bprintf("%-*.*s",len,len,usrlibs
        !           537:                        ? cfg.dir[usrdir[curlib][curdir[curlib]]]->sname : nulstr);
        !           538: 
        !           539:        else if(!strncmp(sp,"DIR-R",5))
        !           540:                bprintf("%*.*s",len,len,usrlibs
        !           541:                        ? cfg.dir[usrdir[curlib][curdir[curlib]]]->sname : nulstr);
        !           542: 
        !           543:        else if(!strcmp(sp,"DIRL"))
        !           544:                bputs(usrlibs ? cfg.dir[usrdir[curlib][curdir[curlib]]]->lname : nulstr);
        !           545: 
        !           546:        else if(!strncmp(sp,"DIRL-L",6))
        !           547:                bprintf("%-*.*s",len,len,usrlibs
        !           548:                        ? cfg.dir[usrdir[curlib][curdir[curlib]]]->lname : nulstr);
        !           549: 
        !           550:        else if(!strncmp(sp,"DIRL-R",6))
        !           551:                bprintf("%*.*s",len,len,usrlibs
        !           552:                        ? cfg.dir[usrdir[curlib][curdir[curlib]]]->lname : nulstr);
        !           553: 
        !           554:        else if(!strcmp(sp,"DN"))
        !           555:                bprintf("%u",usrlibs ? curdir[curlib]+1 : 0);
        !           556: 
        !           557:        else if(!strcmp(sp,"DL"))
        !           558:                bprintf("%-4u",usrlibs ? curdir[curlib]+1 : 0);
        !           559: 
        !           560:        else if(!strcmp(sp,"DR"))
        !           561:                bprintf("%4u",usrlibs ? curdir[curlib]+1 : 0);
        !           562: 
        !           563:        else if(!strcmp(sp,"NOACCESS")) {
        !           564:                if(noaccess_str==text[NoAccessTime])
        !           565:                        bprintf(noaccess_str,noaccess_val/60,noaccess_val%60);
        !           566:                else if(noaccess_str==text[NoAccessDay])
        !           567:                        bprintf(noaccess_str,wday[noaccess_val]);
        !           568:                else
        !           569:                        bprintf(noaccess_str,noaccess_val); }
        !           570: 
        !           571:        else if(!strcmp(sp,"LAST")) {
        !           572:                tp=strrchr(useron.alias,SP);
        !           573:                if(tp) tp++;
        !           574:                else tp=useron.alias;
        !           575:                bputs(tp); }
        !           576: 
        !           577:        else if(!strcmp(sp,"REAL")) {
        !           578:                strcpy(str2,useron.name);
        !           579:                tp=strchr(str2,SP);
        !           580:                if(tp) *tp=0;
        !           581:                bputs(str2); }
        !           582: 
        !           583:        else if(!strcmp(sp,"FIRSTREAL")) {
        !           584:                strcpy(str2,useron.name);
        !           585:                tp=strchr(str2,SP);
        !           586:                if(tp) *tp=0;
        !           587:                bputs(str2); }
        !           588: 
        !           589:        else if(!strcmp(sp,"LASTREAL")) {
        !           590:                tp=strrchr(useron.name,SP);
        !           591:                if(tp) tp++;
        !           592:                else tp=useron.name;
        !           593:                bputs(tp); }
        !           594: 
        !           595:        else if(!strcmp(sp,"MAILW"))
        !           596:                bprintf("%u",getmail(&cfg,useron.number,0));
        !           597: 
        !           598:        else if(!strcmp(sp,"MAILP"))
        !           599:                bprintf("%u",getmail(&cfg,useron.number,1));
        !           600: 
        !           601:        else if(!strncmp(sp,"MAILW:",6))
        !           602:                bprintf("%u",getmail(&cfg,atoi(sp+6),0));
        !           603: 
        !           604:        else if(!strncmp(sp,"MAILP:",6))
        !           605:                bprintf("%u",getmail(&cfg,atoi(sp+6),1));
        !           606: 
        !           607:        else if(!strcmp(sp,"MSGREPLY"))
        !           608:                bprintf("%c",cfg.sys_misc&SM_RA_EMU ? 'R' : 'A');
        !           609: 
        !           610:        else if(!strcmp(sp,"MSGREREAD"))
        !           611:                bprintf("%c",cfg.sys_misc&SM_RA_EMU ? 'A' : 'R');
        !           612: 
        !           613:        else if(!strncmp(sp,"STATS.",6)) {
        !           614:                getstats(&cfg,0,&stats);
        !           615:                sp+=6;
        !           616:                if(!strcmp(sp,"LOGONS")) 
        !           617:                        bprintf("%u",stats.logons);
        !           618:                else if(!strcmp(sp,"LTODAY")) 
        !           619:                        bprintf("%u",stats.ltoday);
        !           620:                else if(!strcmp(sp,"TIMEON")) 
        !           621:                        bprintf("%u",stats.timeon);
        !           622:                else if(!strcmp(sp,"TTODAY")) 
        !           623:                        bprintf("%u",stats.ttoday);
        !           624:                else if(!strcmp(sp,"ULS")) 
        !           625:                        bprintf("%u",stats.uls);
        !           626:                else if(!strcmp(sp,"ULB")) 
        !           627:                        bprintf("%u",stats.ulb);
        !           628:                else if(!strcmp(sp,"DLS")) 
        !           629:                        bprintf("%u",stats.dls);
        !           630:                else if(!strcmp(sp,"DLB")) 
        !           631:                        bprintf("%u",stats.dlb);
        !           632:                else if(!strcmp(sp,"PTODAY")) 
        !           633:                        bprintf("%u",stats.ptoday);
        !           634:                else if(!strcmp(sp,"ETODAY")) 
        !           635:                        bprintf("%u",stats.etoday);
        !           636:                else if(!strcmp(sp,"FTODAY")) 
        !           637:                        bprintf("%u",stats.ftoday);
        !           638:                else if(!strcmp(sp,"NUSERS")) 
        !           639:                        bprintf("%u",stats.nusers);
        !           640:        }
        !           641: 
        !           642:        else return(0);
        !           643: 
        !           644:        return(len);
        !           645: }
        !           646: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.