Annotation of sbbs/src/sbbs3/baja.c, revision 1.1.1.2

1.1       root        1: /* baja.c */
                      2: 
                      3: /* Synchronet command shell/module compiler */
                      4: 
1.1.1.2 ! root        5: /* $Id: baja.c,v 1.44 2007/07/11 01:28:15 deuce Exp $ */
1.1       root        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 2005 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: /* OS-specific */
                     39: #ifndef __unix__
                     40:        #include <io.h>
                     41:        #include <share.h>
                     42: #endif
                     43: #ifdef _WIN32
                     44:        #include <windows.h>
                     45: #endif
                     46: 
                     47: /* ANSI */
                     48: #include <stdio.h>
                     49: #include <string.h>
                     50: #include <ctype.h>
                     51: #include <fcntl.h>
                     52: #include <errno.h>
                     53: 
                     54: /* Synchronet-specific */
                     55: #include "cmdshell.h"
                     56: #include "ars_defs.h"
                     57: #include "crc32.h"
                     58: #include "genwrap.h"   /* portability wrappers */
                     59: #include "dirwrap.h"   /* MAX_PATH */
                     60: 
                     61: #ifdef __BORLANDC__
                     62: unsigned _stklen=20000;        /* Set stack size in code, not header */
                     63: #endif
                     64: 
                     65: char **label_name=NULL
                     66:        ,**goto_file=NULL
                     67:        ,**goto_label=NULL
                     68:        ,**call_file=NULL
                     69:        ,**call_label=NULL;
                     70: 
1.1.1.2 ! root       71: uint32_t *var_name=NULL,vars=0;
1.1       root       72: 
                     73: char **define_str=NULL
                     74:        ,**define_val=NULL;
                     75: 
                     76: char *linestr="%s %d: %s\n";
                     77: char tmp[256];
                     78: 
                     79: uint *label_indx=NULL
                     80:        ,*goto_indx=NULL
                     81:        ,*goto_line=NULL
                     82:        ,*call_indx=NULL
                     83:        ,*call_line=NULL;
                     84: 
                     85: char bin_file[MAX_PATH+1];
                     86: char output_dir[MAX_PATH+1];
                     87: char include_dir[MAX_PATH+1];
                     88: 
                     89: uint display=0,line=0,labels=0,gotos=0,calls=0,defines=0,case_sens=0;
                     90: BOOL pause_on_error=FALSE;
                     91: 
                     92: FILE *out=NULL;
                     93: 
                     94: void bail(int retval)
                     95: {
                     96:        if(out) 
                     97:                fclose(out);
                     98: 
                     99:        if(retval!=0) {
                    100:                if(bin_file[0]!=0)
                    101:                        remove(bin_file);
                    102:                if(pause_on_error) {
                    103:                        printf("\nHit enter to contiue...");
                    104:                        getchar();
                    105:                }
                    106:        }
                    107: 
                    108:        exit(retval);
                    109: }
                    110: 
                    111: /****************************************************************************/
                    112: /* Converts an ASCII Hex string into an ulong                                                          */
                    113: /****************************************************************************/
1.1.1.2 ! root      114: uint32_t ahtoul(char *str)
1.1       root      115: {
1.1.1.2 ! root      116:        uint32_t l,val=0;
1.1       root      117: 
                    118:        while((l=(*str++)|0x20)!=0x20)
                    119:                val=(l&0xf)+(l>>6&1)*9+val*16;
                    120:        return(val);
                    121: }
                    122: 
                    123: /* C Escape char */
                    124: 
                    125: uchar cesc(char ch)
                    126: {
                    127:        switch(ch) {
                    128:                case 'e':
                    129:                        return(ESC);
                    130:                case 'r':
                    131:                        return(CR);
                    132:                case 'n':
                    133:                        return(LF);
                    134:                case 't':
                    135:                        return(TAB);
                    136:                case 'b':
                    137:                        return(BS);
                    138:                case 'a':
                    139:                        return(BEL);
                    140:                case 'f':
                    141:                        return(FF);
                    142:                case 'v':
                    143:                        return(11);
                    144:                default:
                    145:                        return(ch); 
                    146:        }
                    147: }
                    148: 
1.1.1.2 ! root      149: int32_t val(char *src, char *p)
1.1       root      150: {
                    151:        static int inside;
1.1.1.2 ! root      152:        int32_t l;
1.1       root      153: 
                    154:        if(isdigit(*p) || *p=='-')      /* Dec, Hex, or Oct */
                    155:                l=strtol(p,&p,0);
                    156:        else if(*p=='\'') {  /* Char */
                    157:                p++;
                    158:                if(*p=='\\') {
                    159:                        p++;
                    160:                        l=cesc(*p); }
                    161:                else
                    162:                        l=*p;
                    163:                p++; }
                    164:        else if(*p=='.')    /* Bit */
                    165:                l=1L<<strtol(p+1,&p,0);
                    166:        else {
                    167:                printf("!SYNTAX ERROR (expecting integer constant):\n");
                    168:                printf(linestr,src,line,*p ? p : "<end of line>");
                    169:                bail(1);
                    170:                return(0); }
                    171:        if(inside) {
                    172:                return(l); }
                    173:        inside=1;
                    174:        while(*p)
                    175:                switch(*(p++)) {
                    176:                        case '+':
                    177:                                l+=val(src,p);
                    178:                                break;
                    179:                        case '-':
                    180:                                l-=val(src,p);
                    181:                                break;
                    182:                        case '*':
                    183:                                l*=val(src,p);
                    184:                                break;
                    185:                        case '/':
                    186:                                l/=val(src,p);
                    187:                                break;
                    188:                        case '%':
                    189:                                l%=val(src,p);
                    190:                                break;
                    191:                        case '&':
                    192:                                l&=val(src,p);
                    193:                                break;
                    194:                        case '|':
                    195:                                l|=val(src,p);
                    196:                                break;
                    197:                        case '~':
                    198:                                l&=~val(src,p);
                    199:                                break;
                    200:                        case '^':
                    201:                                l^=val(src,p);
                    202:                                break;
                    203:                        case '>':
                    204:                                if(*p=='>') {
                    205:                                        p++;
                    206:                                        l>>=val(src,p); }
                    207:                                break;
                    208:                        case '<':
                    209:                                if(*p=='<') {
                    210:                                        p++;
                    211:                                        l<<=val(src,p); }
                    212:                                break;
                    213:                        case ' ':
                    214:                        case '#':
                    215:                                inside=0;
                    216:                                return(l); }
                    217:        inside=0;
                    218:        return(l);
                    219: }
                    220: 
                    221: 
                    222: void writecstr(uchar *p)
                    223: {
                    224:        char str[1024];
                    225:        int j=0,inquotes=0;
                    226: 
                    227:        while(*p) {
                    228:                if(*p=='"') {   /* ignore quotes */
                    229:                        if(inquotes)
                    230:                                break;
                    231:                        inquotes=1;
                    232:                        p++;
                    233:                        continue; }
                    234:                if(*p=='\\')    { /* escape */
                    235:                        p++;
                    236:                        if(isdigit(*p)) {
                    237:                                sprintf(tmp,"%.3s",p);
                    238:                                str[j]=atoi(tmp);               /* decimal, NOT octal */
                    239:                                if(isdigit(*(++p)))     /* skip up to 3 digits */
                    240:                                        if(isdigit(*(++p)))
                    241:                                                p++;
                    242:                                j++;
                    243:                                continue; }
                    244:                        switch(*(p++)) {
                    245:                                case 'x':
                    246:                                        tmp[0]=*(p++);
                    247:                                        tmp[1]=0;
                    248:                                        if(isxdigit(*p)) {      /* if another hex digit, skip too */
                    249:                                                tmp[1]=*(p++);
                    250:                                                tmp[2]=0; }
                    251:                                        str[j]=(char)ahtoul(tmp);
                    252:                                        break;
                    253:                                case 'e':
                    254:                                        str[j]=ESC;
                    255:                                        break;
                    256:                                case 'r':
                    257:                                        str[j]=CR;
                    258:                                        break;
                    259:                                case 'n':
                    260:                                        str[j]=LF;
                    261:                                        break;
                    262:                                case 't':
                    263:                                        str[j]=TAB;
                    264:                                        break;
                    265:                                case 'b':
                    266:                                        str[j]=BS;
                    267:                                        break;
                    268:                                case 'a':
                    269:                                        str[j]=BEL;
                    270:                                        break;
                    271:                                case 'f':
                    272:                                        str[j]=FF;
                    273:                                        break;
                    274:                                case 'v':
                    275:                                        str[j]=11;      /* VT */
                    276:                                        break;
                    277:                                default:
                    278:                                        str[j]=*(p-1);
                    279:                                        break; }
                    280:                        j++;
                    281:                        continue; }
                    282:                str[j++]=*(p++); }
                    283:        str[j]=0;
                    284:        fwrite(str,1,j+1,out);
                    285: }
                    286: 
                    287: void writestr(uchar *p)
                    288: {
                    289:        char str[1024];
                    290:        int j=0;
                    291: 
                    292:        while(*p) {
                    293:                if(*p=='"') {   /* ignore quotes */
                    294:                        p++;
                    295:                        continue; }
                    296:                if(*p=='\\' && *(p+1)=='"' && *(p+2))
                    297:                        p++;
                    298:                str[j++]=*(p++); }
                    299:        str[j]=0;
                    300:        fwrite(str,1,j+1,out);
                    301: }
                    302: 
                    303: void cvttab(char *str)
                    304: {
                    305:        int i;
                    306: 
                    307:        for(i=0;str[i];i++)
                    308:                if(str[i]==TAB)
                    309:                        str[i]=' ';
                    310: }
                    311: 
                    312: void newvar(uchar* src, uchar *in)
                    313: {
                    314:        uchar name[128];
1.1.1.2 ! root      315:        int32_t i,l;
1.1       root      316: 
                    317:        if(isdigit(*in)) {
                    318:                printf("!SYNTAX ERROR (illegal variable name):\n");
                    319:                printf(linestr,src,line,(char*)in);
                    320:                bail(1); 
                    321:        }
                    322: 
                    323:        sprintf(name,"%.80s",in);
                    324:        if(strncmp(name,"var_",4)==0)   /* decompiled source? */
                    325:                l=strtoul(name+4,NULL,16);
                    326:        else {
                    327:                if(!case_sens)
                    328:                        strupr(name);
                    329:                l=crc32(name,0);
                    330:                for(i=0;i<vars;i++)
                    331:                        if(var_name[i]==l)
                    332:                                break;
                    333:                if(i<vars)
                    334:                        return;
                    335:        }
1.1.1.2 ! root      336:        if((var_name=(uint32_t *)realloc(var_name,sizeof(int32_t)*(vars+1)))==NULL) {
1.1       root      337:                printf("Too many (%lu) variables!\n",vars);
                    338:                bail(1); }
                    339:        var_name[vars]=l;
                    340:        if(display)
                    341:                printf("newvar(%08lX)=%s\n",l,in);
                    342:        vars++;
                    343: }
                    344: 
                    345: void writecrc(uchar *src, uchar *in)
                    346: {
                    347:        uchar   name[128];
                    348:        uchar*  p;
1.1.1.2 ! root      349:        int32_t l;
        !           350:        int             i;
1.1       root      351: 
                    352:        /* Automatically terminate variable name Oct-09-2000 rswindell */
                    353:        sprintf(name,"%.80s",in);
                    354:        p=strchr(name,' ');
                    355:        if(p) *p=0;
                    356: 
                    357:        if(!stricmp(name,"STR") || !name[0])
                    358:                l=0;
                    359:        else if(strncmp(name,"var_",4)==0)      /* decompiled source? */
                    360:                l=strtoul(name+4,NULL,16);
                    361:        else {
                    362:                if(!case_sens)
                    363:                        strupr(name);
                    364:                l=crc32(name,0);
                    365: 
                    366:                for(i=0;i<vars;i++)
                    367:                        if(var_name[i]==l)
                    368:                                break;
                    369:                if(i==vars) {
                    370:                        printf("!SYNTAX ERROR (expecting variable name):\n");
                    371:                        printf(linestr,src,line,*in ? (char*)in : "<end of line>");
                    372:                        bail(1); 
                    373:                }
                    374:        }
                    375:        fwrite(&l,4,1,out);
                    376: }
                    377: 
1.1.1.2 ! root      378: int32_t isvar(uchar *arg)
1.1       root      379: {
                    380:        uchar name[128],*p;
1.1.1.2 ! root      381:        int32_t i,l;
1.1       root      382: 
                    383:        if(!arg || !(*arg) || isdigit(*arg))
                    384:                return(0);
                    385: 
                    386:        sprintf(name,"%.80s",arg);
                    387:        if((p=strchr(name,' '))!=NULL)  /* Truncate at first space */
                    388:                *p=0;
                    389:        if(strncmp(name,"var_",4)==0)   /* decompiled source? */
                    390:                return(strtoul(name+4,NULL,16));
                    391:        if(!case_sens)
                    392:                strupr(name);
                    393:        l=crc32(name,0);
                    394: 
                    395:        for(i=0;i<vars;i++)
                    396:                if(var_name[i]==l)
                    397:                        break;
                    398:        if(i==vars)
                    399:                return(0);
                    400:        return(l);
                    401: }
                    402: 
                    403: int str_cmp(char *s1, char *s2)
                    404: {
                    405:        if(case_sens)
                    406:                return(strcmp(s1,s2));
                    407:        return(stricmp(s1,s2));
                    408: }
                    409: 
                    410: void expdefs(uchar *line)
                    411: {
                    412:        uchar str[512],*p,*sp,sav[2]={0};
                    413:        int i;
                    414: 
                    415:        str[0]=0;
                    416:        for(p=line;*p;p++) {
                    417:                if(*p==' ') {
                    418:                        strcat(str," ");
                    419:                        continue; }
                    420: 
                    421:                if(*p=='"') {               /* Skip quoted text */
                    422:                        sp=strchr(p+1,'"');
                    423:                        if(sp) *sp=0;
                    424:                        strcat(str,p);
                    425:                        if(!sp)
                    426:                                break;
                    427:                        strcat(str,"\"");
                    428:                        p+=strlen(p);
                    429:                        continue; }
                    430: 
                    431:                for(sp=p;*sp;sp++)
                    432:                        if(!isalnum(*sp) && *sp!='_')
                    433:                                break;
                    434:                sav[0]=*sp;             /* Save delimiter */
                    435:                sav[1]=0;
                    436:                *sp=0;
                    437:                for(i=0;i<defines;i++)
                    438:                        if(!str_cmp(define_str[i],p))
                    439:                                break;
                    440:                if(i<defines)
                    441:                        strcat(str,define_val[i]);
                    442:                else
                    443:                        strcat(str,p);
                    444:                if(!sav[0])             /* Last argument */
                    445:                        break;
                    446:                p+=strlen(p);
                    447:                strcat(str,sav);        /* Restore delimiter */
                    448:                }
                    449:        strcpy(line,str);
                    450: }
                    451: 
                    452: 
                    453: 
                    454: void compile(char *src)
                    455: {
                    456:        uchar *str,*save,*p,*sp,*tp,*arg,*arg2,*arg3,*arg4,*ar,ch;
                    457:        char path[MAX_PATH+1];
1.1.1.2 ! root      458:        uint16_t i;
        !           459:     uint16_t j;
        !           460:        int32_t l;
        !           461:        int savline;
1.1       root      462:        FILE *in;
                    463: 
                    464:        if((in=fopen(src,"rb"))==NULL) {
                    465:                printf("error %d opening %s for read\n",errno,src);
                    466:                bail(1); }
                    467:        line=0;
                    468: 
                    469:        if((str=malloc(1024))==NULL) {
                    470:                printf("malloc error\n");
                    471:                bail(1);
                    472:        }
                    473: 
                    474:        if((save=malloc(1024))==NULL) {
                    475:                printf("malloc error\n");
                    476:                bail(1);
                    477:        }
                    478: 
                    479:        while(!feof(in) && !ferror(in)) {
                    480:                if(!fgets(str,1000,in))
                    481:                        break;
                    482:                truncsp(str);
                    483:                cvttab(str);
                    484:                line++;
                    485:                strcpy(save,str);
                    486:                p=str;
                    487:                while(*p && *p<=' ')   /* look for beginning of command */
                    488:                        p++;
                    489:                if((*p)==0)
                    490:                        continue;
                    491:                if(*p=='#')             /* remarks start with # */
                    492:                        continue;
                    493:                expdefs(p);                     /* expand defines */
                    494:                if(display)
                    495:                        printf("%s\n",p);
                    496:                sp=strchr(p,' ');
                    497:                arg=arg2=arg3=arg4="";
                    498:                if(sp) {
                    499:                        *sp=0;
                    500:                        arg=sp+1;
                    501:                        while(*arg && *arg<=' ') arg++;
                    502:                        sp=strchr(arg,' ');
                    503:                        if(sp) {
                    504:                                arg2=sp+1;
                    505:                                while(*arg2 && *arg2<=' ') arg2++;
                    506:                                sp=strchr(arg2,' ');
                    507:                                if(sp) {
                    508:                                        arg3=sp+1;
                    509:                                        while(*arg3 && *arg3<=' ') arg3++; 
                    510:                                        sp=strchr(arg3,' ');
                    511:                                        if(sp) {
                    512:                                                arg4=sp+1;
                    513:                                                while(*arg4 && *arg4<=' ') arg4++; } } } }
                    514: 
                    515:                if(!stricmp(p,"!INCLUDE")) {
                    516:                        savline=line;
                    517:                        sp=strchr(arg,' ');
                    518:                        if(sp) *sp=0;
                    519:                        sprintf(path,"%s%s",include_dir,arg);
                    520:                        compile(path);
                    521:                        line=savline;
                    522:                        continue; 
                    523:                }
                    524: 
                    525:                if(!stricmp(p,"!DEFINE")) {                     /* define */
                    526:                        sp=strchr(arg,' ');
                    527:                        if(sp)
                    528:                                *sp=0;
                    529:                        else
                    530:                                break;
                    531:                        tp=strrchr(arg2,'\"');
                    532:                        if(!tp)
                    533:                                tp=arg2;
                    534:                        sp=strchr(tp,'#');
                    535:                        if(sp)
                    536:                                *sp=0;
                    537:                        truncsp(arg2);
                    538:                        if((define_str=(char **)realloc(define_str,sizeof(char *)*(defines+1)))
                    539:                                ==NULL) {
                    540:                                printf("Too many defines.\n");
                    541:                                bail(1); }
                    542:                        if((define_str[defines]=(char *)malloc(strlen(arg)+1))==NULL) {
                    543:                                printf("Too many defines.\n");
                    544:                                bail(1); }
                    545:                        if((define_val=(char **)realloc(define_val,sizeof(char *)*(defines+1)))
                    546:                                ==NULL) {
                    547:                                printf("Too many defines.\n");
                    548:                                bail(1); }
                    549:                        if((define_val[defines]=(char *)malloc(strlen(arg2)+1))==NULL) {
                    550:                                printf("Too many defines.\n");
                    551:                                bail(1); }
                    552:                        strcpy(define_str[defines],arg);
                    553:                        strcpy(define_val[defines],arg2);
                    554:                        defines++;
                    555:                        continue; }
                    556: 
                    557:                if(!stricmp(p,"!GLOBAL")) {             /* declare global variables */
                    558:                        if(!(*arg)) break;
                    559:                        for(p=arg;*p && *p!='#';) {
                    560:                                sp=strchr(p,' ');
                    561:                                if(sp) *sp=0;
                    562:                                newvar(src,p);
                    563:                                if(!sp)
                    564:                                        break;
                    565:                                p=sp+1;
                    566:                                while(*p && *p<=' ')
                    567:                                        p++; }
                    568:                        continue; }
                    569: 
                    570:                if(!stricmp(p,"PATCH")) {
                    571:                        if(!(*arg)) break;
                    572:                        p=arg;
                    573:                        while(*p) {
                    574:                                while(*p && *p<=' ') p++;
                    575:                                tmp[0]=*p++;
                    576:                                tmp[1]=*p++;
                    577:                                tmp[2]=0;
                    578:                                if(!tmp[0])
                    579:                                        break;
                    580:                                ch=ahtoul(tmp);
                    581:                                fputc(ch,out); }
                    582:                        continue; }
                    583: 
                    584:                if(!stricmp(p,"SHOW_VARS")) {
                    585:                        fputc(CS_VAR_INSTRUCTION,out);
                    586:                        fputc(SHOW_VARS,out);
                    587:                        continue; }
                    588: 
                    589:                if(!stricmp(p,"COMPARE_ARS")) {
                    590:                        if(!(*arg)) break;
                    591:                        strupr(arg);
                    592:                        ar=arstr(&i,arg,NULL);
                    593:                        fprintf(out,"%c%c",CS_COMPARE_ARS,(uchar)i);
                    594:                        fwrite(ar,i,1,out);
                    595:                        continue; }
                    596: 
                    597:                if(!stricmp(p,"CHKSYSPASS")) {
                    598:                        fprintf(out,"%c",CS_CHKSYSPASS);
                    599:                        continue; }
                    600:                if(!stricmp(p,"INFO_SYSTEM")) {
                    601:                        fprintf(out,"%c",CS_INFO_SYSTEM);
                    602:                        continue; }
                    603:                if(!stricmp(p,"INFO_SUBBOARD")) {
                    604:                        fprintf(out,"%c",CS_INFO_SUBBOARD);
                    605:                        continue; }
                    606:                if(!stricmp(p,"INFO_DIRECTORY")) {
                    607:                        fprintf(out,"%c",CS_INFO_DIRECTORY);
                    608:                        continue; }
                    609:                if(!stricmp(p,"INFO_VERSION")) {
                    610:                        fprintf(out,"%c",CS_INFO_VERSION);
                    611:                        continue; }
                    612:                if(!stricmp(p,"INFO_USER")) {
                    613:                        fprintf(out,"%c",CS_INFO_USER);
                    614:                        continue; }
                    615:                if(!stricmp(p,"INFO_XFER_POLICY")) {
                    616:                        fprintf(out,"%c",CS_INFO_XFER_POLICY);
                    617:                        continue; }
                    618:                if(!stricmp(p,"LOGKEY")) {
                    619:                        fprintf(out,"%c",CS_LOGKEY);
                    620:                        continue; }
                    621:                if(!stricmp(p,"LOGKEY_COMMA")) {
                    622:                        fprintf(out,"%c",CS_LOGKEY_COMMA);
                    623:                        continue; }
                    624:                if(!stricmp(p,"LOGSTR")) {
                    625:                        fprintf(out,"%c",CS_LOGSTR);
                    626:                        continue; }
                    627: 
                    628:                if(!stricmp(p,"ONLINE")) {
                    629:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_ONLINE);
                    630:                        continue; }
                    631:                if(!stricmp(p,"OFFLINE")) {
                    632:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_OFFLINE);
                    633:                        continue; }
                    634:                if(!stricmp(p,"NEWUSER")) {
                    635:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_NEWUSER);
                    636:                        continue; }
                    637:                if(!stricmp(p,"LOGON")) {
                    638:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_LOGON);
                    639:                        continue; }
                    640:                if(!stricmp(p,"LOGOUT")) {
                    641:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_LOGOUT);
                    642:                        continue; }
                    643:                if(!stricmp(p,"EXIT")) {
                    644:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_EXIT);
                    645:                        continue; }
                    646: 
                    647:                if(!stricmp(p,"LOOP") || !stricmp(p,"LOOP_BEGIN")) {
                    648:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_LOOP_BEGIN);
                    649:                        continue; }
                    650:                if(!stricmp(p,"CONTINUE") || !stricmp(p,"CONTINUE_LOOP")) {
                    651:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_CONTINUE_LOOP);
                    652:                        continue; }
                    653:                if(!stricmp(p,"BREAK") || !stricmp(p,"BREAK_LOOP")) {
                    654:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_BREAK_LOOP);
                    655:                        continue; }
                    656:                if(!stricmp(p,"END_LOOP")) {
                    657:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_END_LOOP);
                    658:                        continue; }
                    659: 
                    660:                if(!stricmp(p,"USER_EVENT")) {
                    661:                        if(!(*arg))
                    662:                                break;
                    663:                        if((l=isvar(arg))!=0) {
                    664:                                fputc(CS_USE_INT_VAR,out);
                    665:                                fwrite(&l,4,1,out); /* variable */
                    666:                                fputc(2,out);           /* int offset */
                    667:                                fputc(1,out);       /* int length */
                    668:                                ch=0; }             /* place holder */
                    669:                        else
                    670:                                ch=val(src,arg);
                    671:                        fprintf(out,"%c%c",CS_TWO_MORE_BYTES,CS_USER_EVENT);
                    672:                        fwrite(&ch,1,1,out);
                    673:                        continue; }
                    674: 
                    675:                if(!stricmp(p,"PUT_NODE")) {
                    676:                        fprintf(out,"%c",CS_PUT_NODE);
                    677:                        continue; }
                    678:                if(!stricmp(p,"SYNC")) {
                    679:                        fprintf(out,"%c",CS_SYNC);
                    680:                        continue; }
                    681:                if(!stricmp(p,"ASYNC")) {
                    682:                        fprintf(out,"%c",CS_ASYNC);
                    683:                        continue; }
                    684:                if(!stricmp(p,"RIOSYNC")) {             /* deprecated */
                    685:                        fprintf(out,"%c",CS_SYNC);
                    686:                        continue; }
                    687:                if(!stricmp(p,"GETTIMELEFT")) {
                    688:                        fprintf(out,"%c",CS_GETTIMELEFT);
                    689:                        continue; }
                    690:                if(!stricmp(p,"SAVELINE")) {
                    691:                        fprintf(out,"%c",CS_SAVELINE);
                    692:                        continue; }
                    693:                if(!stricmp(p,"RESTORELINE")) {
                    694:                        fprintf(out,"%c",CS_RESTORELINE);
                    695:                        continue; }
                    696:                if(!stricmp(p,"IF_TRUE") || !stricmp(p,"IF_EQUAL")) {
                    697:                        fprintf(out,"%c",CS_IF_TRUE);
                    698:                        continue; }
                    699:                if(!stricmp(p,"IF_FALSE") || !stricmp(p,"IF_NOT_EQUAL")) {
                    700:                        fprintf(out,"%c",CS_IF_FALSE);
                    701:                        continue; }
                    702:                if(!stricmp(p,"IF_GREATER")) {
                    703:                        fprintf(out,"%c",CS_IF_GREATER);
                    704:                        continue; }
                    705:                if(!stricmp(p,"IF_GREATER_OR_EQUAL")
                    706:                        || !stricmp(p,"IF_EQUAL_OR_GREATER")) {
                    707:                        fprintf(out,"%c",CS_IF_GREATER_OR_EQUAL);
                    708:                        continue; }
                    709:                if(!stricmp(p,"IF_LESS")) {
                    710:                        fprintf(out,"%c",CS_IF_LESS);
                    711:                        continue; }
                    712:                if(!stricmp(p,"IF_LESS_OR_EQUAL")
                    713:                        || !stricmp(p,"IF_EQUAL_OR_LESS")) {
                    714:                        fprintf(out,"%c",CS_IF_LESS_OR_EQUAL);
                    715:                        continue; }
                    716:                if(!stricmp(p,"ENDIF") || !stricmp(p,"END_IF")) {
                    717:                        fprintf(out,"%c",CS_ENDIF);
                    718:                        continue; }
                    719:                if(!stricmp(p,"ELSE")) {
                    720:                        fprintf(out,"%c",CS_ELSE);
                    721:                        continue; }
                    722:                if(p[0]==':') {                     /* :label */
                    723:                        p++;
                    724:                        sp=strchr(p,' ');
                    725:                        if(sp)
                    726:                                *sp=0;
                    727:                        for(i=0;i<labels;i++)
                    728:                                if(!stricmp(label_name[i],p))
                    729:                                        break;
                    730:                        if(i<labels) {
                    731:                                printf("!SYNTAX ERROR (duplicate label name):\n");
                    732:                                printf(linestr,src,line,p);
                    733:                                bail(1); }
                    734:                        if((label_name=(char **)realloc(label_name,sizeof(char *)*(labels+1)))
                    735:                                ==NULL) {
                    736:                                printf("Too many labels.\n");
                    737:                                bail(1); }
                    738:                        if((label_indx=(uint *)realloc(label_indx,sizeof(int)*(labels+1)))
                    739:                                ==NULL) {
                    740:                                printf("Too many labels.\n");
                    741:                                bail(1); }
                    742:                        if((label_name[labels]=(char *)malloc(strlen(p)+1))==NULL) {
                    743:                                printf("Too many labels.\n");
                    744:                                bail(1); }
                    745:                        strcpy(label_name[labels],p);
                    746:                        label_indx[labels]=ftell(out);
                    747:                        labels++;
                    748:                        continue; }
                    749:                if(!stricmp(p,"GOTO")) {           /* goto */
                    750:                        if(!(*arg)) break;
                    751:                        sp=strchr(arg,' ');
                    752:                        if(sp)
                    753:                                *sp=0;
                    754:                        if((goto_label=(char **)realloc(goto_label,sizeof(char *)*(gotos+1)))
                    755:                                ==NULL) {
                    756:                                printf("Too many gotos.\n");
                    757:                                bail(1); }
                    758:                        if((goto_file=(char **)realloc(goto_file,sizeof(char *)*(gotos+1)))
                    759:                                ==NULL) {
                    760:                                printf("Too many gotos.\n");
                    761:                                bail(1); }
                    762:                        if((goto_indx=(uint *)realloc(goto_indx,sizeof(int)*(gotos+1)))
                    763:                                ==NULL) {
                    764:                                printf("Too many gotos.\n");
                    765:                                bail(1); }
                    766:                        if((goto_line=(uint *)realloc(goto_line,sizeof(int)*(gotos+1)))
                    767:                                ==NULL) {
                    768:                                printf("Too many gotos.\n");
                    769:                                bail(1); }
                    770:                        if((goto_label[gotos]=(char *)malloc(strlen(arg)+1))==NULL) {
                    771:                                printf("Too many gotos.\n");
                    772:                                bail(1); }
                    773:                        if((goto_file[gotos]=(char *)malloc(strlen(str)+1))==NULL) {
                    774:                                printf("Too many gotos.\n");
                    775:                                bail(1); }
                    776:                        strcpy(goto_label[gotos],arg);
                    777:                        strcpy(goto_file[gotos],str);
                    778:                        goto_indx[gotos]=ftell(out);
                    779:                        goto_line[gotos]=line;
                    780:                        gotos++;
                    781:                        fprintf(out,"%c%c%c",CS_GOTO,0xff,0xff);
                    782:                        continue; }
                    783:                if(!stricmp(p,"CALL")) {          /* call */
                    784:                        if(!(*arg)) break;
                    785:                        sp=strchr(arg,' ');
                    786:                        if(sp)
                    787:                                *sp=0;
                    788:                        if((call_label=(char **)realloc(call_label,sizeof(char *)*(calls+1)))
                    789:                                ==NULL) {
                    790:                                printf("Too many calls.\n");
                    791:                                bail(1); }
                    792:                        if((call_file=(char **)realloc(call_file,sizeof(char *)*(calls+1)))
                    793:                                ==NULL) {
                    794:                                printf("Too many calls.\n");
                    795:                                bail(1); }
                    796:                        if((call_indx=(uint *)realloc(call_indx,sizeof(int)*(calls+1)))
                    797:                                ==NULL) {
                    798:                                printf("Too many calls.\n");
                    799:                                bail(1); }
                    800:                        if((call_line=(uint *)realloc(call_line,sizeof(int)*(calls+1)))
                    801:                                ==NULL) {
                    802:                                printf("Too many calls.\n");
                    803:                                bail(1); }
                    804:                        if((call_label[calls]=(char *)malloc(strlen(arg)+1))==NULL) {
                    805:                                printf("Too many calls.\n");
                    806:                                bail(1); }
                    807:                        if((call_file[calls]=(char *)malloc(strlen(src)+1))==NULL) {
                    808:                                printf("Too many calls.\n");
                    809:                                bail(1); }
                    810: 
                    811:                        strcpy(call_label[calls],arg);
                    812:                        strcpy(call_file[calls],src);
                    813:                        call_indx[calls]=ftell(out);
                    814:                        call_line[calls]=line;
                    815:                        calls++;
                    816:                        fprintf(out,"%c%c%c",CS_CALL,0xff,0xff);
                    817:                        continue; }
                    818: 
                    819:                if(!stricmp(p,"RETURN")) {
                    820:                        fprintf(out,"%c",CS_RETURN);
                    821:                        continue; }
                    822:                if(!stricmp(p,"CMD_HOME")) {
                    823:                        fprintf(out,"%c",CS_CMD_HOME);
                    824:                        continue; }
                    825:                if(!stricmp(p,"CMDKEY")) {
                    826:                        if(!(*arg)) break;
                    827:                        if(!stricmp(arg,"DIGIT"))
                    828:                                ch=CS_DIGIT;
                    829:                        else if(!stricmp(arg,"EDIGIT"))
                    830:                                ch=CS_EDIGIT;
                    831:                        else
                    832:                                ch=toupper(*arg);
                    833:                        if(ch=='/')
                    834:                                ch=*(arg+1)|0x80;   /* high bit indicates slash required */
                    835:                        else if(ch=='^' && *(arg+1)>=0x40)
                    836:                                ch=*(arg+1)-0x40;   /* ctrl char */
                    837:                        else if(ch=='\\')
                    838:                                ch=cesc(*(arg+1));
                    839:                        else if(ch=='\'')
                    840:                                ch=*(arg+1);
                    841:                        fprintf(out,"%c%c",CS_CMDKEY,ch);
                    842:                        continue; }
                    843:                if(!stricmp(p,"CMDCHAR")) {
                    844:                        if(!(*arg)) break;
                    845:                        fprintf(out,"%c%c",CS_CMDKEY,*arg);
                    846:                        continue; }
                    847:                if(!stricmp(p,"SETLOGIC") || !stricmp(p,"SET_LOGIC")) {
                    848:                        if(!(*arg)) break;
                    849:                        if(!stricmp(arg,"TRUE") || !stricmp(arg,"EQUAL"))
                    850:                                ch=LOGIC_TRUE;
                    851:                        else if(!stricmp(arg,"GREATER"))
                    852:                                ch=LOGIC_GREATER;
                    853:                        else if(!stricmp(arg,"LESS"))
                    854:                                ch=LOGIC_LESS;
                    855:                        else
                    856:                                ch=LOGIC_FALSE;
                    857:                        fprintf(out,"%c%c",CS_SETLOGIC,ch);
                    858:                        continue; }
                    859: 
                    860:                if(!stricmp(p,"DEFINE_STR_VAR") || !stricmp(p,"STR")) {
                    861:                        if(!(*arg)) break;
                    862:                        for(p=arg;*p && *p!='#';) {
                    863:                                sp=strchr(p,' ');
                    864:                                if(sp) *sp=0;
                    865:                                fputc(CS_VAR_INSTRUCTION,out);
                    866:                                fputc(DEFINE_STR_VAR,out);
                    867:                                newvar(src,p);
                    868:                                writecrc(src,p);
                    869:                                if(!sp)
                    870:                                        break;
                    871:                                p=sp+1;
                    872:                                while(*p && *p<=' ')
                    873:                                        p++; }
                    874:                        continue; }
                    875:                if(!stricmp(p,"DEFINE_INT_VAR") || !stricmp(p,"INT")) {
                    876:                        if(!(*arg)) break;
                    877:                        for(p=arg;*p && *p!='#';) {
                    878:                                sp=strchr(p,' ');
                    879:                                if(sp) *sp=0;
                    880:                                fputc(CS_VAR_INSTRUCTION,out);
                    881:                                fputc(DEFINE_INT_VAR,out);
                    882:                                newvar(src,p);
                    883:                                writecrc(src,p);
                    884:                                if(!sp)
                    885:                                        break;
                    886:                                p=sp+1;
                    887:                                while(*p && *p<=' ')
                    888:                                        p++; }
                    889:                        continue; }
                    890:                if(!stricmp(p,"DEFINE_GLOBAL_STR_VAR") || !stricmp(p,"GLOBAL_STR")) {
                    891:                        if(!(*arg)) break;
                    892:                        for(p=arg;*p && *p!='#';) {
                    893:                                sp=strchr(p,' ');
                    894:                                if(sp) *sp=0;
                    895:                                fputc(CS_VAR_INSTRUCTION,out);
                    896:                                fputc(DEFINE_GLOBAL_STR_VAR,out);
                    897:                                newvar(src,p);
                    898:                                writecrc(src,p);
                    899:                                if(!sp)
                    900:                                        break;
                    901:                                p=sp+1;
                    902:                                while(*p && *p<=' ')
                    903:                                        p++; }
                    904:                        continue; }
                    905:                if(!stricmp(p,"DEFINE_GLOBAL_INT_VAR") || !stricmp(p,"GLOBAL_INT")) {
                    906:                        if(!(*arg)) break;
                    907:                        for(p=arg;*p && *p!='#';) {
                    908:                                sp=strchr(p,' ');
                    909:                                if(sp) *sp=0;
                    910:                                fputc(CS_VAR_INSTRUCTION,out);
                    911:                                fputc(DEFINE_GLOBAL_INT_VAR,out);
                    912:                                newvar(src,p);
                    913:                                writecrc(src,p);
                    914:                                if(!sp)
                    915:                                        break;
                    916:                                p=sp+1;
                    917:                                while(*p && *p<=' ')
                    918:                                        p++; }
                    919:                        continue; }
                    920: 
                    921:                if(!stricmp(p,"LOGIN")) {
                    922:                        if(!(*arg)) break;
                    923:                        fputc(CS_STR_FUNCTION,out);
                    924:                        fputc(CS_LOGIN,out);
                    925:                        writecstr(arg);
                    926:                        continue; }
                    927: 
                    928:                if(!stricmp(p,"LOAD_TEXT")) {
                    929:                        if(!(*arg)) break;
                    930:                        fputc(CS_STR_FUNCTION,out);
                    931:                        fputc(CS_LOAD_TEXT,out);
                    932:                        writestr(arg);
                    933:                        continue; }
                    934: 
                    935:                if(!stricmp(p,"SET_STR_VAR")
                    936:                        || (!stricmp(p,"SET") && strchr(arg,'"'))) {
                    937:                        if(!(*arg)) break;
                    938:                        fputc(CS_VAR_INSTRUCTION,out);
                    939:                        fputc(SET_STR_VAR,out);
                    940:                        p=strchr(arg,' ');
                    941:                        if(!p)
                    942:                                break;
                    943:                        *p=0;
                    944:                        writecrc(src,arg);
                    945:                        writecstr(arg2);
                    946:                        continue; }
                    947:                if(!stricmp(p,"CAT_STR_VAR")
                    948:                        || (!stricmp(p,"STRCAT") && strchr(arg,'"'))) {
                    949:                        fputc(CS_VAR_INSTRUCTION,out);
                    950:                        fputc(CAT_STR_VAR,out);
                    951:                        p=strchr(arg,' ');
                    952:                        if(!p)
                    953:                                break;
                    954:                        *p=0;
                    955:                        writecrc(src,arg);
                    956:                        writecstr(arg2);
                    957:                        continue; }
                    958:                if((!stricmp(p,"STRSTR") || !stricmp(p,"COMPARE_SUBSTR"))
                    959:                        && strchr(arg,'"')) {
                    960:                        fputc(CS_VAR_INSTRUCTION,out);
                    961:                        fputc(STRSTR_VAR,out);
                    962:                        p=strchr(arg,' ');
                    963:                        if(!p)
                    964:                                break;
                    965:                        *p=0;
                    966:                        writecrc(src,arg);
                    967:                        writecstr(arg2);
                    968:                        continue; }
                    969:                if(!stricmp(p,"STRSTR") || !stricmp(p,"COMPARE_SUBSTR")) {
                    970:                        if(!(*arg)) break;
                    971:                        fputc(CS_VAR_INSTRUCTION,out);
                    972:                        fputc(STRSTR_VARS,out);
                    973:                        p=strchr(arg,' ');
                    974:                        if(!p)
                    975:                                break;
                    976:                        *p=0;
                    977:                        writecrc(src,arg);
                    978:                        writecrc(src,arg2);
                    979:                        continue; }
                    980:                if(!stricmp(p,"COPY_CHAR") || !stricmp(p,"COPY_KEY")) {
                    981:                        if(!(*arg)) break;
                    982:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,COPY_CHAR);
                    983:                        writecrc(src,arg);
                    984:                        continue; }
                    985:                if(!stricmp(p,"COPY_FIRST_CHAR")) {
                    986:                        if(!(*arg) || !(*arg2)) break;
                    987:                        fputc(CS_VAR_INSTRUCTION,out);
                    988:                        fputc(COPY_FIRST_CHAR,out);
                    989:                        writecrc(src,arg);
                    990:                        writecrc(src,arg2);
                    991:                        continue; }
                    992:                if(!stricmp(p,"COMPARE_FIRST_CHAR")) {
                    993:                        if(!(*arg) || !(*arg2)) break;
                    994:                        fputc(CS_VAR_INSTRUCTION,out);
                    995:                        fputc(COMPARE_FIRST_CHAR,out);
                    996:                        writecrc(src,arg);
                    997:                        fputc((uchar)val(src,arg2),out);
                    998:                        continue; }
                    999:                if(!stricmp(p,"CAT_STR_VARS") || !stricmp(p,"STRCAT")) {
                   1000:                        if(!(*arg)) break;
                   1001:                        fputc(CS_VAR_INSTRUCTION,out);
                   1002:                        fputc(CAT_STR_VARS,out);
                   1003:                        p=strchr(arg,' ');
                   1004:                        if(!p)
                   1005:                                break;
                   1006:                        *p=0;
                   1007:                        writecrc(src,arg);
                   1008:                        writecrc(src,arg2);
                   1009:                        continue; }
                   1010:                if(!stricmp(p,"FORMAT") || !stricmp(p,"SPRINTF")) {
                   1011:                        if(!(*arg)) break;
                   1012:                        fputc(CS_VAR_INSTRUCTION,out);
                   1013:                        fputc(FORMAT_STR_VAR,out);
                   1014:                        p=strchr(arg,' ');
                   1015:                        if(!p)
                   1016:                                break;
                   1017:                        *p=0;
                   1018:                        writecrc(src,arg);                                      /* Write destination variable */
                   1019:                        p++;
                   1020:                        while(*p && *p<=' ') p++;
                   1021:                        arg=p;
                   1022:                        p=strrchr(arg,'"');
                   1023:                        if(!p)
                   1024:                                break;
                   1025:                        *p=0;
                   1026:                        p++;
                   1027:                        while(*p && *p<=' ') p++;
                   1028:                        writecstr(arg);                 /* Write string */
                   1029:                        l=ftell(out);
                   1030:                        fputc(0,out);                   /* Write total number of args */
                   1031:                        i=0;
                   1032:                        while(p && *p) {
                   1033:                                arg=p;
                   1034:                                p=strchr(arg,' ');
                   1035:                                if(p) {
                   1036:                                        *p=0;
                   1037:                                        p++; }
                   1038:                                writecrc(src,arg);
                   1039:                                i++; }
                   1040:                        fseek(out,l,SEEK_SET);
                   1041:                        fputc((char)i,out);
                   1042:                        fseek(out,i*4,SEEK_CUR);
                   1043:                        continue; }
                   1044: 
                   1045:                if(!stricmp(p,"STRFTIME") || !stricmp(p,"FTIME_STR")) {
                   1046:                        if(!(*arg) || !(*arg2) || !(*arg3)) break;
                   1047:                        fputc(CS_VAR_INSTRUCTION,out);
                   1048:                        fputc(FORMAT_TIME_STR,out);
                   1049:                        p=strchr(arg,' ');
                   1050:                        if(!p)
                   1051:                                break;
                   1052:                        *p=0;
                   1053:                        writecrc(src,arg);                                      /* Write destination variable */
                   1054:                        p++;
                   1055:                        while(*p && *p<=' ') p++;
                   1056:                        arg=p;
                   1057:                        p=strrchr(arg,'"');
                   1058:                        if(!p)
                   1059:                                break;
                   1060:                        *p=0;
                   1061:                        writecstr(arg);                 /* Write string */
                   1062:                        p++;
                   1063:                        while(*p && *p<=' ') p++;
                   1064:                        writecrc(src,p);
                   1065:                        continue; }
                   1066: 
                   1067:                if(!stricmp(p,"TIME_STR")) {
                   1068:                        if(!(*arg)) break;
                   1069:                        fputc(CS_VAR_INSTRUCTION,out);
                   1070:                        fputc(TIME_STR,out);
                   1071:                        p=strchr(arg,' ');
                   1072:                        if(!p)
                   1073:                                break;
                   1074:                        *p=0;
                   1075:                        writecrc(src,arg);
                   1076:                        writecrc(src,arg2);
                   1077:                        continue; }
                   1078: 
                   1079:                if(!stricmp(p,"DATE_STR")) {
                   1080:                        if(!(*arg)) break;
                   1081:                        fputc(CS_VAR_INSTRUCTION,out);
                   1082:                        fputc(DATE_STR,out);
                   1083:                        p=strchr(arg,' ');
                   1084:                        if(!p)
                   1085:                                break;
                   1086:                        *p=0;
                   1087:                        writecrc(src,arg);
                   1088:                        writecrc(src,arg2);
                   1089:                        continue; }
                   1090: 
                   1091:                if(!stricmp(p,"SECOND_STR")) {
                   1092:                        if(!(*arg)) break;
                   1093:                        fputc(CS_VAR_INSTRUCTION,out);
                   1094:                        fputc(SECOND_STR,out);
                   1095:                        p=strchr(arg,' ');
                   1096:                        if(!p)
                   1097:                                break;
                   1098:                        *p=0;
                   1099:                        writecrc(src,arg);
                   1100:                        writecrc(src,arg2);
                   1101:                        continue; }
                   1102: 
                   1103: 
                   1104:                if(!stricmp(p,"SET_INT_VAR")
                   1105:                        || (!stricmp(p,"SET") && *arg2!='"')) {
                   1106:                        if(!(*arg)) break;
                   1107:                        fputc(CS_VAR_INSTRUCTION,out);
                   1108:                        fputc(SET_INT_VAR,out);
                   1109:                        p=strchr(arg,' ');
                   1110:                        if(!p)
                   1111:                                break;
                   1112:                        *p=0;
                   1113:                        writecrc(src,arg);
                   1114:                        l=val(src,arg2);
                   1115:                        fwrite(&l,4,1,out);
                   1116:                        continue; }
                   1117: 
                   1118:                if(!stricmp(p,"COMPARE_STR_VAR") ||
                   1119:                        (!stricmp(p,"COMPARE") && *arg2=='"')) {
                   1120:                        if(!(*arg)) break;
                   1121:                        fputc(CS_VAR_INSTRUCTION,out);
                   1122:                        fputc(COMPARE_STR_VAR,out);
                   1123:                        p=strchr(arg,' ');
                   1124:                        if(!p)
                   1125:                                break;
                   1126:                        *p=0;
                   1127:                        writecrc(src,arg);
                   1128:                        writecstr(arg2);
                   1129:                        continue; }
                   1130: 
                   1131:                if(!stricmp(p,"COMPARE_STRN_VAR") ||
                   1132:                        ((!stricmp(p,"STRNCMP") || !stricmp(p,"COMPARE_STRN"))
                   1133:                                && *arg3 && strchr(arg3,'"'))) {
                   1134:                        if((l=isvar(arg))!=0) {
                   1135:                                fputc(CS_USE_INT_VAR,out);
                   1136:                                fwrite(&l,4,1,out); /* variable */
                   1137:                                fputc(2,out);           /* int offset */
                   1138:                                fputc(1,out);           /* int length */
                   1139:                                i=0; }                          /* place holder */
                   1140:                        else
                   1141:                                i=val(src,arg);
                   1142:                        fputc(CS_VAR_INSTRUCTION,out);
                   1143:                        fputc(STRNCMP_VAR,out);
                   1144:                        fwrite(&i,1,1,out); /* Length */
                   1145:                        p=strchr(arg2,' ');
                   1146:                        if(!p)
                   1147:                                break;
                   1148:                        *p=0;
                   1149:                        p++;
                   1150:                        while(*p && *p<=' ') p++;
                   1151:                        writecrc(src,arg2);
                   1152:                        writecstr(p);
                   1153:                        continue; }
                   1154: 
                   1155:                if(!stricmp(p,"COMPARE_STRN_VARS") || !stricmp(p,"STRNCMP")
                   1156:                        || !stricmp(p,"COMPARE_STRN")) {
                   1157:                        if(!(*arg) || !(*arg2) || !(*arg3))
                   1158:                                break;
                   1159:                        if((l=isvar(arg))!=0) {
                   1160:                                fputc(CS_USE_INT_VAR,out);
                   1161:                                fwrite(&l,4,1,out); /* variable */
                   1162:                                fputc(2,out);           /* int offset */
                   1163:                                fputc(1,out);           /* int length */
                   1164:                                i=0; }                          /* place holder */
                   1165:                        else
                   1166:                                i=val(src,arg);
                   1167:                        fputc(CS_VAR_INSTRUCTION,out);
                   1168:                        fputc(STRNCMP_VARS,out);
                   1169: 
                   1170:                        fwrite(&i,1,1,out); /* Length */
                   1171:                        p=strchr(arg2,' ');
                   1172:                        if(!p)
                   1173:                                break;
                   1174:                        *p=0;
                   1175:                        p++;
                   1176:                        while(*p && *p<=' ') p++;
                   1177:                        writecrc(src,arg2);
                   1178:                        writecrc(src,p);
                   1179:                        continue; }
                   1180: 
                   1181:                if(!stricmp(p,"COMPARE_INT_VAR") ||
                   1182:                        (!stricmp(p,"COMPARE")
                   1183:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1184:                        if(!(*arg)) break;
                   1185: 
                   1186:                        fputc(CS_VAR_INSTRUCTION,out);
                   1187:                        fputc(COMPARE_INT_VAR,out);
                   1188:                        p=strchr(arg,' ');
                   1189:                        if(!p)
                   1190:                                break;
                   1191:                        *p=0;
                   1192:                        writecrc(src,arg);
                   1193:                        l=val(src,arg2);
                   1194:                        fwrite(&l,4,1,out);
                   1195:                        continue; }
                   1196: 
                   1197:                if(!stricmp(p,"COMPARE")) {
                   1198:                        if(!(*arg)) break;
                   1199:                        fputc(CS_VAR_INSTRUCTION,out);
                   1200:                        fputc(COMPARE_VARS,out);
                   1201:                        p=strchr(arg,' ');
                   1202:                        if(!p)
                   1203:                                break;
                   1204:                        *p=0;
                   1205:                        writecrc(src,arg);
                   1206:                        writecrc(src,arg2);
                   1207:                        continue; }
                   1208:                if(!stricmp(p,"COPY")) {
                   1209:                        if(!(*arg)) break;
                   1210:                        fputc(CS_VAR_INSTRUCTION,out);
                   1211:                        fputc(COPY_VAR,out);
                   1212:                        p=strchr(arg,' ');
                   1213:                        if(!p)
                   1214:                                break;
                   1215:                        *p=0;
                   1216:                        writecrc(src,arg);
                   1217:                        writecrc(src,arg2);
                   1218:                        continue; }
                   1219:                if(!stricmp(p,"SWAP")) {
                   1220:                        if(!(*arg)) break;
                   1221:                        fputc(CS_VAR_INSTRUCTION,out);
                   1222:                        fputc(SWAP_VARS,out);
                   1223:                        p=strchr(arg,' ');
                   1224:                        if(!p)
                   1225:                                break;
                   1226:                        *p=0;
                   1227:                        writecrc(src,arg);
                   1228:                        writecrc(src,arg2);
                   1229:                        continue; }
                   1230: 
                   1231:                if(!stricmp(p,"TIME")) {
                   1232:                        if(!(*arg)) break;
                   1233:                        fputc(CS_VAR_INSTRUCTION,out);
                   1234:                        fputc(TIME_INT_VAR,out);
                   1235:                        writecrc(src,arg);
                   1236:                        continue; }
                   1237: 
                   1238:                if(!stricmp(p,"DATE_INT")) {
                   1239:                        if(!(*arg)) break;
                   1240:                        fputc(CS_VAR_INSTRUCTION,out);
                   1241:                        fputc(DATE_STR_TO_INT,out);
                   1242:                        p=strchr(arg,' ');
                   1243:                        if(!p)
                   1244:                                break;
                   1245:                        *p=0;
                   1246:                        writecrc(src,arg);
                   1247:                        writecrc(src,arg2);
                   1248:                        continue; }
                   1249: 
                   1250:                if(!stricmp(p,"CRC16")) {
                   1251:                        if(!(*arg)) break;
                   1252:                        fputc(CS_VAR_INSTRUCTION,out);
                   1253:                        fputc(CRC16_TO_INT,out);
                   1254:                        p=strchr(arg,' ');
                   1255:                        if(!p)
                   1256:                                break;
                   1257:                        *p=0;
                   1258:                        writecrc(src,arg);
                   1259:                        writecrc(src,arg2);
                   1260:                        continue; }
                   1261: 
                   1262:                if(!stricmp(p,"CRC32")) {
                   1263:                        if(!(*arg)) break;
                   1264:                        fputc(CS_VAR_INSTRUCTION,out);
                   1265:                        fputc(CRC32_TO_INT,out);
                   1266:                        p=strchr(arg,' ');
                   1267:                        if(!p)
                   1268:                                break;
                   1269:                        *p=0;
                   1270:                        writecrc(src,arg);
                   1271:                        writecrc(src,arg2);
                   1272:                        continue; }
                   1273: 
                   1274:                if(!stricmp(p,"CHKSUM")) {
                   1275:                        if(!(*arg)) break;
                   1276:                        fputc(CS_VAR_INSTRUCTION,out);
                   1277:                        fputc(CHKSUM_TO_INT,out);
                   1278:                        p=strchr(arg,' ');
                   1279:                        if(!p)
                   1280:                                break;
                   1281:                        *p=0;
                   1282:                        writecrc(src,arg);
                   1283:                        writecrc(src,arg2);
                   1284:                        continue; }
                   1285: 
                   1286:                if(!stricmp(p,"ADD_INT_VAR")
                   1287:                        || (!stricmp(p,"ADD")
                   1288:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1289:                        if(!(*arg)) break;
                   1290:                        fputc(CS_VAR_INSTRUCTION,out);
                   1291:                        fputc(ADD_INT_VAR,out);
                   1292:                        p=strchr(arg,' ');
                   1293:                        if(!p)
                   1294:                                break;
                   1295:                        *p=0;
                   1296:                        writecrc(src,arg);
                   1297:                        l=val(src,arg2);
                   1298:                        if(!l)
                   1299:                                break;
                   1300:                        fwrite(&l,4,1,out);
                   1301:                        continue; }
                   1302:                if(!stricmp(p,"ADD_INT_VARS") || !stricmp(p,"ADD")) {
                   1303:                        if(!(*arg)) break;
                   1304:                        fputc(CS_VAR_INSTRUCTION,out);
                   1305:                        fputc(ADD_INT_VARS,out);
                   1306:                        p=strchr(arg,' ');
                   1307:                        if(!p)
                   1308:                                break;
                   1309:                        *p=0;
                   1310:                        writecrc(src,arg);
                   1311:                        writecrc(src,arg2);
                   1312:                        continue; }
                   1313: 
                   1314:                if(!stricmp(p,"SUB_INT_VAR")
                   1315:                        || (!stricmp(p,"SUB")
                   1316:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1317:                        if(!(*arg)) break;
                   1318:                        fputc(CS_VAR_INSTRUCTION,out);
                   1319:                        fputc(SUB_INT_VAR,out);
                   1320:                        p=strchr(arg,' ');
                   1321:                        if(!p)
                   1322:                                break;
                   1323:                        *p=0;
                   1324:                        writecrc(src,arg);
                   1325:                        l=val(src,arg2);
                   1326:                        if(!l)
                   1327:                                break;
                   1328:                        fwrite(&l,4,1,out);
                   1329:                        continue; }
                   1330:                if(!stricmp(p,"SUB_INT_VARS") || !stricmp(p,"SUB")) {
                   1331:                        if(!(*arg)) break;
                   1332:                        fputc(CS_VAR_INSTRUCTION,out);
                   1333:                        fputc(SUB_INT_VARS,out);
                   1334:                        p=strchr(arg,' ');
                   1335:                        if(!p)
                   1336:                                break;
                   1337:                        *p=0;
                   1338:                        writecrc(src,arg);
                   1339:                        writecrc(src,arg2);
                   1340:                        continue; }
                   1341: 
                   1342:                if(!stricmp(p,"MUL_INT_VAR")
                   1343:                        || (!stricmp(p,"MUL")
                   1344:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1345:                        if(!(*arg)) break;
                   1346:                        fputc(CS_VAR_INSTRUCTION,out);
                   1347:                        fputc(MUL_INT_VAR,out);
                   1348:                        p=strchr(arg,' ');
                   1349:                        if(!p)
                   1350:                                break;
                   1351:                        *p=0;
                   1352:                        writecrc(src,arg);
                   1353:                        l=val(src,arg2);
                   1354:                        if(!l)
                   1355:                                break;
                   1356:                        fwrite(&l,4,1,out);
                   1357:                        continue; }
                   1358:                if(!stricmp(p,"MUL_INT_VARS") || !stricmp(p,"MUL")) {
                   1359:                        if(!(*arg)) break;
                   1360:                        fputc(CS_VAR_INSTRUCTION,out);
                   1361:                        fputc(MUL_INT_VARS,out);
                   1362:                        p=strchr(arg,' ');
                   1363:                        if(!p)
                   1364:                                break;
                   1365:                        *p=0;
                   1366:                        writecrc(src,arg);
                   1367:                        writecrc(src,arg2);
                   1368:                        continue; }
                   1369: 
                   1370:                if(!stricmp(p,"DIV_INT_VAR")
                   1371:                        || (!stricmp(p,"DIV")
                   1372:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1373:                        if(!(*arg)) break;
                   1374:                        fputc(CS_VAR_INSTRUCTION,out);
                   1375:                        fputc(DIV_INT_VAR,out);
                   1376:                        p=strchr(arg,' ');
                   1377:                        if(!p)
                   1378:                                break;
                   1379:                        *p=0;
                   1380:                        writecrc(src,arg);
                   1381:                        l=val(src,arg2);
                   1382:                        if(!l)
                   1383:                                break;
                   1384:                        fwrite(&l,4,1,out);
                   1385:                        continue; }
                   1386:                if(!stricmp(p,"DIV_INT_VARS") || !stricmp(p,"DIV")) {
                   1387:                        if(!(*arg)) break;
                   1388:                        fputc(CS_VAR_INSTRUCTION,out);
                   1389:                        fputc(DIV_INT_VARS,out);
                   1390:                        p=strchr(arg,' ');
                   1391:                        if(!p)
                   1392:                                break;
                   1393:                        *p=0;
                   1394:                        writecrc(src,arg);
                   1395:                        writecrc(src,arg2);
                   1396:                        continue; }
                   1397: 
                   1398:                if(!stricmp(p,"MOD_INT_VAR")
                   1399:                        || (!stricmp(p,"MOD")
                   1400:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1401:                        if(!(*arg)) break;
                   1402:                        fputc(CS_VAR_INSTRUCTION,out);
                   1403:                        fputc(MOD_INT_VAR,out);
                   1404:                        p=strchr(arg,' ');
                   1405:                        if(!p)
                   1406:                                break;
                   1407:                        *p=0;
                   1408:                        writecrc(src,arg);
                   1409:                        l=val(src,arg2);
                   1410:                        if(!l)
                   1411:                                break;
                   1412:                        fwrite(&l,4,1,out);
                   1413:                        continue; }
                   1414:                if(!stricmp(p,"MOD_INT_VARS") || !stricmp(p,"MOD")) {
                   1415:                        if(!(*arg)) break;
                   1416:                        fputc(CS_VAR_INSTRUCTION,out);
                   1417:                        fputc(MOD_INT_VARS,out);
                   1418:                        p=strchr(arg,' ');
                   1419:                        if(!p)
                   1420:                                break;
                   1421:                        *p=0;
                   1422:                        writecrc(src,arg);
                   1423:                        writecrc(src,arg2);
                   1424:                        continue; }
                   1425: 
                   1426:                if(!stricmp(p,"AND_INT_VAR")
                   1427:                        || (!stricmp(p,"AND")
                   1428:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1429:                        if(!(*arg)) break;
                   1430:                        fputc(CS_VAR_INSTRUCTION,out);
                   1431:                        fputc(AND_INT_VAR,out);
                   1432:                        p=strchr(arg,' ');
                   1433:                        if(!p)
                   1434:                                break;
                   1435:                        *p=0;
                   1436:                        writecrc(src,arg);
                   1437:                        l=val(src,arg2);
                   1438:                        fwrite(&l,4,1,out);
                   1439:                        continue; }
                   1440:                if(!stricmp(p,"AND_INT_VARS") || !stricmp(p,"AND")) {
                   1441:                        if(!(*arg)) break;
                   1442:                        fputc(CS_VAR_INSTRUCTION,out);
                   1443:                        fputc(AND_INT_VARS,out);
                   1444:                        p=strchr(arg,' ');
                   1445:                        if(!p)
                   1446:                                break;
                   1447:                        *p=0;
                   1448:                        writecrc(src,arg);
                   1449:                        writecrc(src,arg2);
                   1450:                        continue; }
                   1451: 
                   1452:                if(!stricmp(p,"COMPARE_ANY_BITS") || !stricmp(p,"COMPARE_ALL_BITS")) {
                   1453:                        if(!(*arg) || !(*arg2))
                   1454:                                break;
                   1455:                        if((l=isvar(arg2))!=0) {
                   1456:                                fputc(CS_USE_INT_VAR,out);
                   1457:                                fwrite(&l,4,1,out); /* variable */
                   1458:                                fputc(6,out);           /* int offset */
                   1459:                                fputc(4,out);           /* int length */
                   1460:                                l=0; }                          /* place holder */
                   1461:                        else
                   1462:                                l=val(src,arg2);
                   1463:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION
                   1464:                                ,!stricmp(p,"COMPARE_ANY_BITS") ? COMPARE_ANY_BITS : COMPARE_ALL_BITS);
                   1465:                        writecrc(src,arg);
                   1466:                        fwrite(&l,sizeof(l),1,out);
                   1467:                        continue;
                   1468:                }
                   1469: 
                   1470:                if(!stricmp(p,"OR_INT_VAR")
                   1471:                        || (!stricmp(p,"OR")
                   1472:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1473:                        if(!(*arg)) break;
                   1474:                        fputc(CS_VAR_INSTRUCTION,out);
                   1475:                        fputc(OR_INT_VAR,out);
                   1476:                        p=strchr(arg,' ');
                   1477:                        if(!p)
                   1478:                                break;
                   1479:                        *p=0;
                   1480:                        writecrc(src,arg);
                   1481:                        l=val(src,arg2);
                   1482:                        fwrite(&l,4,1,out);
                   1483:                        continue; }
                   1484:                if(!stricmp(p,"OR_INT_VARS") || !stricmp(p,"OR")) {
                   1485:                        if(!(*arg)) break;
                   1486:                        fputc(CS_VAR_INSTRUCTION,out);
                   1487:                        fputc(OR_INT_VARS,out);
                   1488:                        p=strchr(arg,' ');
                   1489:                        if(!p)
                   1490:                                break;
                   1491:                        *p=0;
                   1492:                        writecrc(src,arg);
                   1493:                        writecrc(src,arg2);
                   1494:                        continue; }
                   1495: 
                   1496:                if(!stricmp(p,"NOT_INT_VAR")
                   1497:                        || (!stricmp(p,"NOT")
                   1498:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1499:                        if(!(*arg)) break;
                   1500:                        fputc(CS_VAR_INSTRUCTION,out);
                   1501:                        fputc(NOT_INT_VAR,out);
                   1502:                        p=strchr(arg,' ');
                   1503:                        if(!p)
                   1504:                                break;
                   1505:                        *p=0;
                   1506:                        writecrc(src,arg);
                   1507:                        l=val(src,arg2);
                   1508:                        fwrite(&l,4,1,out);
                   1509:                        continue; }
                   1510:                if(!stricmp(p,"NOT_INT_VARS") || !stricmp(p,"NOT")) {
                   1511:                        if(!(*arg)) break;
                   1512:                        fputc(CS_VAR_INSTRUCTION,out);
                   1513:                        fputc(NOT_INT_VARS,out);
                   1514:                        p=strchr(arg,' ');
                   1515:                        if(!p)
                   1516:                                break;
                   1517:                        *p=0;
                   1518:                        writecrc(src,arg);
                   1519:                        writecrc(src,arg2);
                   1520:                        continue; }
                   1521: 
                   1522:                if(!stricmp(p,"XOR_INT_VAR")
                   1523:                        || (!stricmp(p,"XOR")
                   1524:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1525:                        if(!(*arg)) break;
                   1526:                        fputc(CS_VAR_INSTRUCTION,out);
                   1527:                        fputc(XOR_INT_VAR,out);
                   1528:                        p=strchr(arg,' ');
                   1529:                        if(!p)
                   1530:                                break;
                   1531:                        *p=0;
                   1532:                        writecrc(src,arg);
                   1533:                        l=val(src,arg2);
                   1534:                        fwrite(&l,4,1,out);
                   1535:                        continue; }
                   1536:                if(!stricmp(p,"XOR_INT_VARS") || !stricmp(p,"XOR")) {
                   1537:                        if(!(*arg)) break;
                   1538:                        fputc(CS_VAR_INSTRUCTION,out);
                   1539:                        fputc(XOR_INT_VARS,out);
                   1540:                        p=strchr(arg,' ');
                   1541:                        if(!p)
                   1542:                                break;
                   1543:                        *p=0;
                   1544:                        writecrc(src,arg);
                   1545:                        writecrc(src,arg2);
                   1546:                        continue; }
                   1547: 
                   1548:                if(!stricmp(p,"RANDOM_INT_VAR") || !stricmp(p,"RANDOM")) {
                   1549:                        if(!(*arg)) break;
                   1550:                        if((l=isvar(arg2))!=0) {
                   1551:                                fputc(CS_USE_INT_VAR,out);
                   1552:                                fwrite(&l,4,1,out); /* variable */
                   1553:                                fputc(6,out);           /* int offset */
                   1554:                                fputc(4,out);           /* int length */
                   1555:                                l=0; }                          /* place holder */
                   1556:                        else
                   1557:                                l=val(src,arg2);
                   1558:                        fputc(CS_VAR_INSTRUCTION,out);
                   1559:                        fputc(RANDOM_INT_VAR,out);
                   1560:                        p=strchr(arg,' ');
                   1561:                        if(!p)
                   1562:                                break;
                   1563:                        *p=0;
                   1564:                        writecrc(src,arg);
                   1565:                        fwrite(&l,4,1,out);
                   1566:                        continue; }
                   1567: 
                   1568:                if(!stricmp(p,"SWITCH")) {
                   1569:                        if(!(*arg)) break;
                   1570:                        fputc(CS_SWITCH,out);
                   1571:                        writecrc(src,arg);
                   1572:                        continue; }
                   1573:                if(!stricmp(p,"END_SWITCH")) {
                   1574:                        fputc(CS_END_SWITCH,out);
                   1575:                        continue; }
                   1576:                if(!stricmp(p,"CASE")) {
                   1577:                        if(!(*arg)) break;
                   1578:                        fputc(CS_CASE,out);
                   1579:                        l=val(src,arg);
                   1580:                        fwrite(&l,4,1,out);
                   1581:                        continue; }
                   1582:                if(!stricmp(p,"DEFAULT")) {
                   1583:                        fputc(CS_DEFAULT,out);
                   1584:                        continue; }
                   1585:                if(!stricmp(p,"END_CASE")) {
                   1586:                        fputc(CS_END_CASE,out);
                   1587:                        continue; }
                   1588: 
                   1589:                if(!stricmp(p,"PRINT") && !strchr(arg,'"') && !strchr(arg,'\\')
                   1590:                        && !strchr(arg,' ')) {
                   1591:                        if(!(*arg)) break;
                   1592:                        fputc(CS_VAR_INSTRUCTION,out);
                   1593:                        fputc(PRINT_VAR,out);
                   1594:                        writecrc(src,arg);
                   1595:                        continue; }
                   1596: 
                   1597:                if(!stricmp(p,"PRINTF") || !stricmp(p,"LPRINTF") || !stricmp(p,"PRINTF_LOCAL")) {
                   1598:                        if(!(*arg)) break;
                   1599:                        fputc(CS_VAR_INSTRUCTION,out);
                   1600:                        if(!stricmp(p,"PRINTF"))
                   1601:                                fputc(VAR_PRINTF,out);
                   1602:                        else
                   1603:                                fputc(VAR_PRINTF_LOCAL,out);
                   1604:                        p=strrchr(arg,'"');
                   1605:                        if(!p)
                   1606:                                break;
                   1607:                        *p=0;
                   1608:                        p++;
                   1609:                        while(*p && *p<=' ') p++;
                   1610:                        writecstr(arg);                 /* Write string */
                   1611:                        l=ftell(out);
                   1612:                        fputc(0,out);                   /* Write total number of args */
                   1613:                        i=0;
                   1614:                        while(p && *p) {
                   1615:                                arg=p;
                   1616:                                p=strchr(arg,' ');
                   1617:                                if(p) {
                   1618:                                        *p=0;
                   1619:                                        p++; }
                   1620:                                writecrc(src,arg);
                   1621:                                i++; }
                   1622:                        fseek(out,l,SEEK_SET);
                   1623:                        fputc((char)i,out);
                   1624:                        fseek(out,i*4,SEEK_CUR);
                   1625:                        continue; }
                   1626: 
                   1627:                if(!stricmp(p,"FOPEN")) {
                   1628:                        if(!(*arg) || !(*arg2) || !(*arg3)) break;
                   1629:                        if((l=isvar(arg2))!=0) {
                   1630:                                fputc(CS_USE_INT_VAR,out);
                   1631:                                fwrite(&l,4,1,out); /* variable */
                   1632:                                fputc(6,out);           /* int offset */
                   1633:                                fputc(2,out);           /* int length */
                   1634:                                i=0; }                          /* place holder */
                   1635:                        else
                   1636:                                i=val(src,arg2);
                   1637: 
                   1638:                        fputc(CS_FIO_FUNCTION,out);
                   1639:                        if(*arg3=='"')
                   1640:                                fputc(FIO_OPEN,out);
                   1641:                        else
                   1642:                                fputc(FIO_OPEN_VAR,out);
                   1643:                        p=strchr(arg,' ');
                   1644:                        if(!p)
                   1645:                                break;
                   1646:                        *p=0;
                   1647:                        writecrc(src,arg);
                   1648:                        p=strchr(arg2,' ');
                   1649:                        if(!p)
                   1650:                                break;
                   1651:                        *p=0;
                   1652:                        p++;
                   1653:                        fwrite(&i,2,1,out);
                   1654:                        while(*p && *p<=' ') p++;
                   1655:                        if(*p=='"')
                   1656:                                writestr(p);
                   1657:                        else
                   1658:                                writecrc(src,p);
                   1659:                        continue; }
                   1660:                if(!stricmp(p,"FCLOSE")) {
                   1661:                        if(!(*arg)) break;
                   1662:                        fputc(CS_FIO_FUNCTION,out);
                   1663:                        fputc(FIO_CLOSE,out);
                   1664:                        writecrc(src,arg);
                   1665:                        continue; }
                   1666:                if(!stricmp(p,"FFLUSH")) {
                   1667:                        if(!(*arg)) break;
                   1668:                        fputc(CS_FIO_FUNCTION,out);
                   1669:                        fputc(FIO_FLUSH,out);
                   1670:                        writecrc(src,arg);
                   1671:                        continue; }
                   1672:                if(!stricmp(p,"FREAD")) {
                   1673:                        if(!(*arg)) break;
                   1674: 
                   1675:                        fputc(CS_FIO_FUNCTION,out);
                   1676:                        if(!(*arg3) || isdigit(*arg3) || atoi(arg3))
                   1677:                                fputc(FIO_READ,out);
                   1678:                        else
                   1679:                                fputc(FIO_READ_VAR,out);
                   1680:                        p=strchr(arg,' ');
                   1681:                        if(!p)
                   1682:                                break;
                   1683:                        *p=0;
                   1684:                        writecrc(src,arg);                      /* File handle */
                   1685:                        p=strchr(arg2,' ');
                   1686:                        if(p)
                   1687:                                *p=0;
                   1688:                        writecrc(src,arg2);             /* Variable */
                   1689:                        if(isdigit(*arg3))
                   1690:                                i=val(src,arg3);         /* Length */
                   1691:                        else
                   1692:                                i=0;
                   1693:                        if(i || !(*arg3))
                   1694:                                fwrite(&i,2,1,out);
                   1695:                        else
                   1696:                                writecrc(src,arg3);
                   1697:                        continue; }
                   1698:                if(!stricmp(p,"FWRITE")) {
                   1699:                        if(!(*arg)) break;
                   1700:                        fputc(CS_FIO_FUNCTION,out);
                   1701:                        if(!(*arg3) || isdigit(*arg3) || atoi(arg3))
                   1702:                                fputc(FIO_WRITE,out);
                   1703:                        else
                   1704:                                fputc(FIO_WRITE_VAR,out);
                   1705:                        p=strchr(arg,' ');
                   1706:                        if(!p)
                   1707:                                break;
                   1708:                        *p=0;
                   1709:                        writecrc(src,arg);                      /* File handle */
                   1710:                        p=strchr(arg2,' ');
                   1711:                        if(p)
                   1712:                                *p=0;
                   1713:                        writecrc(src,arg2);             /* Variable */
                   1714:                        if(isdigit(*arg3))
                   1715:                                i=val(src,arg3);         /* Length */
                   1716:                        else
                   1717:                                i=0;
                   1718:                        if(i || !(*arg3))
                   1719:                                fwrite(&i,2,1,out);
                   1720:                        else
                   1721:                                writecrc(src,arg3);
                   1722:                        continue; }
                   1723:                if(!stricmp(p,"FGET_LENGTH")
                   1724:                        || !stricmp(p,"FGETLENGTH")
                   1725:                        || !stricmp(p,"GETFLENGTH")) {
                   1726:                        if(!(*arg) || !(*arg2)) break;
                   1727:                        fputc(CS_FIO_FUNCTION,out);
                   1728:                        fputc(FIO_GET_LENGTH,out);
                   1729:                        p=strchr(arg,' ');
                   1730:                        if(!p)
                   1731:                                break;
                   1732:                        *p=0;
                   1733:                        writecrc(src,arg);                      /* File handle */
                   1734:                        writecrc(src,arg2);             /* Variable */
                   1735:                        continue; }
                   1736:                if(!stricmp(p,"FREAD_LINE")) {
                   1737:                        if(!(*arg) || !(*arg2)) break;
                   1738:                        fputc(CS_FIO_FUNCTION,out);
                   1739:                        fputc(FIO_READ_LINE,out);
                   1740:                        p=strchr(arg,' ');
                   1741:                        if(!p)
                   1742:                                break;
                   1743:                        *p=0;
                   1744:                        writecrc(src,arg);                      /* File handle */
                   1745:                        writecrc(src,arg2);             /* Variable */
                   1746:                        continue; }
                   1747:                if(!stricmp(p,"FEOF")) {
                   1748:                        if(!(*arg)) break;
                   1749:                        fputc(CS_FIO_FUNCTION,out);
                   1750:                        fputc(FIO_EOF,out);
                   1751:                        writecrc(src,arg);
                   1752:                        continue; }
                   1753:                if(!stricmp(p,"FGET_POS")) {
                   1754:                        if(!(*arg) || !(*arg2)) break;
                   1755:                        fputc(CS_FIO_FUNCTION,out);
                   1756:                        fputc(FIO_GET_POS,out);
                   1757:                        p=strchr(arg,' ');
                   1758:                        if(!p)
                   1759:                                break;
                   1760:                        *p=0;
                   1761:                        writecrc(src,arg);                      /* File handle */
                   1762:                        writecrc(src,arg2);             /* Variable */
                   1763:                        continue; }
                   1764:                if(!stricmp(p,"FSET_POS") || !stricmp(p,"FSEEK")) {
                   1765:                        if(!(*arg)) break;
                   1766:                        fputc(CS_FIO_FUNCTION,out);
                   1767:                        if(isdigit(*arg2) || atol(arg2))
                   1768:                                fputc(FIO_SEEK,out);
                   1769:                        else
                   1770:                                fputc(FIO_SEEK_VAR,out);
                   1771:                        p=strchr(arg,' ');
                   1772:                        if(!p)
                   1773:                                break;
                   1774:                        *p=0;
                   1775:                        writecrc(src,arg);                      /* File handle */
                   1776:                        p=strchr(arg2,' ');
                   1777:                        if(p)
                   1778:                                *p=0;
                   1779:                        if(atol(arg2) || isdigit(*arg2)) {
                   1780:                                l=val(src,arg2);
                   1781:                                fwrite(&l,4,1,out); }
                   1782:                        else
                   1783:                                writecrc(src,arg2);             /* Offset variable */
                   1784:                        i=0;
                   1785:                        if(p) {
                   1786:                                p++;
                   1787:                                while(*p && *p<=' ') p++;
                   1788:                                i=atoi(p);
                   1789:                                if(!stricmp(p,"CUR"))
                   1790:                                        i=SEEK_CUR;
                   1791:                                else if(!stricmp(p,"END"))
                   1792:                                        i=SEEK_END; }
                   1793:                        fwrite(&i,2,1,out);
                   1794:                        continue; }
                   1795:                if(!stricmp(p,"FLOCK")) {
                   1796:                        if(!(*arg)) break;
                   1797:                        fputc(CS_FIO_FUNCTION,out);
                   1798:                        if(isdigit(*arg2) || atol(arg2))
                   1799:                                fputc(FIO_LOCK,out);
                   1800:                        else
                   1801:                                fputc(FIO_LOCK_VAR,out);
                   1802:                        p=strchr(arg,' ');
                   1803:                        if(!p)
                   1804:                                break;
                   1805:                        *p=0;
                   1806:                        writecrc(src,arg);                      /* File handle */
                   1807:                        if(atol(arg2) || isdigit(*arg2)) {
                   1808:                                l=val(src,arg2);
                   1809:                                if(!l)
                   1810:                                        break;
                   1811:                                fwrite(&l,4,1,out); }
                   1812:                        else
                   1813:                                writecrc(src,arg2);     /* Length variable */
                   1814:                        continue; }
                   1815:                if(!stricmp(p,"FUNLOCK")) {
                   1816:                        if(!(*arg)) break;
                   1817:                        fputc(CS_FIO_FUNCTION,out);
                   1818:                        if(isdigit(*arg2) || atol(arg2))
                   1819:                                fputc(FIO_UNLOCK,out);
                   1820:                        else
                   1821:                                fputc(FIO_UNLOCK_VAR,out);
                   1822:                        p=strchr(arg,' ');
                   1823:                        if(!p)
                   1824:                                break;
                   1825:                        *p=0;
                   1826:                        writecrc(src,arg);                      /* File handle */
                   1827:                        if(atol(arg2) || isdigit(*arg2)) {
                   1828:                                l=val(src,arg2);
                   1829:                                if(!l)
                   1830:                                        break;
                   1831:                                fwrite(&l,4,1,out); }
                   1832:                        else
                   1833:                                writecrc(src,arg2);             /* Length variable */
                   1834:                        continue; }
                   1835:                if(!stricmp(p,"FSET_LENGTH")) {
                   1836:                        if(!(*arg)) break;
                   1837:                        fputc(CS_FIO_FUNCTION,out);
                   1838:                        if(isdigit(*arg2) || atol(arg2))
                   1839:                                fputc(FIO_SET_LENGTH,out);
                   1840:                        else
                   1841:                                fputc(FIO_SET_LENGTH_VAR,out);
                   1842:                        p=strchr(arg,' ');
                   1843:                        if(!p)
                   1844:                                break;
                   1845:                        *p=0;
                   1846:                        writecrc(src,arg);                      /* File handle */
                   1847:                        if(atol(arg2) || isdigit(*arg2)) {
                   1848:                                l=val(src,arg2);
                   1849:                                fwrite(&l,4,1,out); }
                   1850:                        else
                   1851:                                writecrc(src,arg2);             /* Length variable */
                   1852:                        continue; }
                   1853:                if(!stricmp(p,"FPRINTF")) {
                   1854:                        if(!(*arg)) break;
                   1855:                        fputc(CS_FIO_FUNCTION,out);
                   1856:                        fputc(FIO_PRINTF,out);
                   1857:                        p=strchr(arg,' ');
                   1858:                        if(!p)
                   1859:                                break;
                   1860:                        *p=0;
                   1861:                        writecrc(src,arg);                                      /* Write destination variable */
                   1862:                        p++;
                   1863:                        while(*p && *p<=' ') p++;
                   1864:                        arg=p;
                   1865:                        p=strrchr(arg,'"');
                   1866:                        if(!p)
                   1867:                                break;
                   1868:                        *p=0;
                   1869:                        p++;
                   1870:                        while(*p && *p<=' ') p++;
                   1871:                        writecstr(arg);                 /* Write string */
                   1872:                        l=ftell(out);
                   1873:                        fputc(0,out);                   /* Write total number of args */
                   1874:                        i=0;
                   1875:                        while(p && *p) {
                   1876:                                arg=p;
                   1877:                                p=strchr(arg,' ');
                   1878:                                if(p) {
                   1879:                                        *p=0;
                   1880:                                        p++; }
                   1881:                                writecrc(src,arg);
                   1882:                                i++; }
                   1883:                        fseek(out,l,SEEK_SET);
                   1884:                        fputc((char)i,out);
                   1885:                        fseek(out,i*4,SEEK_CUR);
                   1886:                        continue; }
                   1887:                if(!stricmp(p,"FSET_ETX")) {
                   1888:                        if(!(*arg)) break;
                   1889:                        if((l=isvar(arg))!=0) {
                   1890:                                fputc(CS_USE_INT_VAR,out);
                   1891:                                fwrite(&l,4,1,out); /* variable */
                   1892:                                fputc(2,out);       /* int offset */
                   1893:                                fputc(1,out);       /* int length */
                   1894:                                ch=0; }                         /* place holder */
                   1895:                        else
                   1896:                                ch=val(src,arg);
                   1897: 
                   1898:                        fputc(CS_FIO_FUNCTION,out);
                   1899:                        fputc(FIO_SET_ETX,out);
                   1900:                        fwrite(&ch,1,1,out);
                   1901:                        continue; }
                   1902:                if(!stricmp(p,"FGET_TIME")) {
                   1903:                        if(!(*arg) || !(*arg2)) break;
                   1904:                        fputc(CS_FIO_FUNCTION,out);
                   1905:                        fputc(FIO_GET_TIME,out);
                   1906:                        p=strchr(arg,' ');
                   1907:                        if(!p)
                   1908:                                break;
                   1909:                        *p=0;
                   1910:                        writecrc(src,arg);                      /* File handle */
                   1911:                        writecrc(src,arg2);             /* Variable */
                   1912:                        continue; }
                   1913:                if(!stricmp(p,"FSET_TIME")) {
                   1914:                        if(!(*arg) || !(*arg2)) break;
                   1915:                        fputc(CS_FIO_FUNCTION,out);
                   1916:                        fputc(FIO_SET_TIME,out);
                   1917:                        p=strchr(arg,' ');
                   1918:                        if(!p)
                   1919:                                break;
                   1920:                        *p=0;
                   1921:                        writecrc(src,arg);                      /* File handle */
                   1922:                        writecrc(src,arg2);             /* Variable */
                   1923:                        continue; }
                   1924:                if(!stricmp(p,"REMOVE_FILE")) {
                   1925:                        if(!(*arg)) break;
                   1926:                        fputc(CS_FIO_FUNCTION,out);
                   1927:                        fputc(REMOVE_FILE,out);
                   1928:                        writecrc(src,arg);                      /* Str var */
                   1929:                        continue; }
                   1930:                if(!stricmp(p,"RENAME_FILE")) {
                   1931:                        if(!(*arg) || !(*arg2)) break;
                   1932:                        fputc(CS_FIO_FUNCTION,out);
                   1933:                        fputc(RENAME_FILE,out);
                   1934:                        p=strchr(arg,' ');
                   1935:                        if(!p)
                   1936:                                break;
                   1937:                        *p=0;
                   1938:                        writecrc(src,arg);                      /* str var */
                   1939:                        writecrc(src,arg2);             /* str var */
                   1940:                        continue; }
                   1941:                if(!stricmp(p,"COPY_FILE")) {
                   1942:                        if(!(*arg) || !(*arg2)) break;
                   1943:                        fputc(CS_FIO_FUNCTION,out);
                   1944:                        fputc(COPY_FILE,out);
                   1945:                        p=strchr(arg,' ');
                   1946:                        if(!p)
                   1947:                                break;
                   1948:                        *p=0;
                   1949:                        writecrc(src,arg);                      /* str var */
                   1950:                        writecrc(src,arg2);             /* str var */
                   1951:                        continue; }
                   1952:                if(!stricmp(p,"MOVE_FILE")) {
                   1953:                        if(!(*arg) || !(*arg2)) break;
                   1954:                        fputc(CS_FIO_FUNCTION,out);
                   1955:                        fputc(MOVE_FILE,out);
                   1956:                        p=strchr(arg,' ');
                   1957:                        if(!p)
                   1958:                                break;
                   1959:                        *p=0;
                   1960:                        writecrc(src,arg);                      /* str var */
                   1961:                        writecrc(src,arg2);             /* str var */
                   1962:                        continue; }
                   1963:                if(!stricmp(p,"GET_FILE_ATTRIB")) {
                   1964:                        if(!(*arg) || !(*arg2)) break;
                   1965:                        fputc(CS_FIO_FUNCTION,out);
                   1966:                        fputc(GET_FILE_ATTRIB,out);
                   1967:                        p=strchr(arg,' ');
                   1968:                        if(!p)
                   1969:                                break;
                   1970:                        *p=0;
                   1971:                        writecrc(src,arg);                      /* str var */
                   1972:                        writecrc(src,arg2);             /* int var */
                   1973:                        continue; }
                   1974:                if(!stricmp(p,"SET_FILE_ATTRIB")) {
                   1975:                        if(!(*arg) || !(*arg2)) break;
                   1976:                        fputc(CS_FIO_FUNCTION,out);
                   1977:                        fputc(SET_FILE_ATTRIB,out);
                   1978:                        p=strchr(arg,' ');
                   1979:                        if(!p)
                   1980:                                break;
                   1981:                        *p=0;
                   1982:                        writecrc(src,arg);                      /* str var */
                   1983:                        writecrc(src,arg2);             /* int var */
                   1984:                        continue; }
                   1985:                if(!stricmp(p,"RMDIR") || !stricmp(p,"REMOVE_DIR")) {
                   1986:                        if(!(*arg)) break;
                   1987:                        fputc(CS_FIO_FUNCTION,out);
                   1988:                        fputc(REMOVE_DIR,out);
                   1989:                        writecrc(src,arg);                      /* Str var */
                   1990:                        continue; }
                   1991:                if(!stricmp(p,"MKDIR") || !stricmp(p,"MAKE_DIR")) {
                   1992:                        if(!(*arg)) break;
                   1993:                        fputc(CS_FIO_FUNCTION,out);
                   1994:                        fputc(MAKE_DIR,out);
                   1995:                        writecrc(src,arg);                      /* Str var */
                   1996:                        continue; }
                   1997:                if(!stricmp(p,"CHDIR") || !stricmp(p,"CHANGE_DIR")) {
                   1998:                        if(!(*arg)) break;
                   1999:                        printf("!WARNING: CHANGE_DIR deprecated in Synchronet v3+\n");
                   2000:                        printf(linestr,src,line,save);
                   2001:                        fputc(CS_FIO_FUNCTION,out);
                   2002:                        fputc(CHANGE_DIR,out);
                   2003:                        writecrc(src,arg);                      /* Str var */
                   2004:                        continue; }
                   2005:                if(!stricmp(p,"OPEN_DIR")) {
                   2006:                        if(!(*arg) || !(*arg2)) break;
                   2007:                        fputc(CS_FIO_FUNCTION,out);
                   2008:                        fputc(OPEN_DIR,out);
                   2009:                        p=strchr(arg,' ');
                   2010:                        if(!p)
                   2011:                                break;
                   2012:                        *p=0;
                   2013:                        writecrc(src,arg);                      /* int var */
                   2014:                        writecrc(src,arg2);             /* str var */
                   2015:                        continue; }
                   2016:                if(!stricmp(p,"READ_DIR")) {
                   2017:                        if(!(*arg) || !(*arg2)) break;
                   2018:                        fputc(CS_FIO_FUNCTION,out);
                   2019:                        fputc(READ_DIR,out);
                   2020:                        p=strchr(arg,' ');
                   2021:                        if(!p)
                   2022:                                break;
                   2023:                        *p=0;
                   2024:                        writecrc(src,arg);                      /* int var */
                   2025:                        writecrc(src,arg2);             /* str var */
                   2026:                        continue; }
                   2027:                if(!stricmp(p,"REWIND_DIR")) {
                   2028:                        if(!(*arg)) break;
                   2029:                        fputc(CS_FIO_FUNCTION,out);
                   2030:                        fputc(REWIND_DIR,out);
                   2031:                        writecrc(src,arg);                      /* int var */
                   2032:                        continue; }
                   2033:                if(!stricmp(p,"CLOSE_DIR")) {
                   2034:                        if(!(*arg)) break;
                   2035:                        fputc(CS_FIO_FUNCTION,out);
                   2036:                        fputc(CLOSE_DIR,out);
                   2037:                        writecrc(src,arg);                      /* int var */
                   2038:                        continue; }
                   2039: 
                   2040:                /* NET_FUNCTIONS */
                   2041: 
                   2042:                if(!stricmp(p,"SOCKET_OPEN")) {
                   2043:                        if(!(*arg)) break;
                   2044:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_SOCKET_OPEN);
                   2045:                        writecrc(src,arg);                      /* int var (socket) */
                   2046:                        continue;
                   2047:                }
                   2048:                if(!stricmp(p,"SOCKET_CLOSE")) {
                   2049:                        if(!(*arg)) break;
                   2050:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_SOCKET_CLOSE);
                   2051:                        writecrc(src,arg);                      /* int var (socket) */
                   2052:                        continue;
                   2053:                }
                   2054:                if(!stricmp(p,"SOCKET_CHECK")) {
                   2055:                        if(!(*arg)) break;
                   2056:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_SOCKET_CHECK);
                   2057:                        writecrc(src,arg);                      /* int var (socket) */
                   2058:                        continue;
                   2059:                }
                   2060:                if(!stricmp(p,"SOCKET_CONNECT")) {
                   2061:                        if(!(*arg) || !(*arg2) || !(*arg3)) break;
                   2062: 
                   2063:                        /* TCP port */
                   2064:                        if((l=isvar(arg3))!=0) {
                   2065:                                fputc(CS_USE_INT_VAR,out);
                   2066:                                fwrite(&l,4,1,out); /* variable */
                   2067:                                fputc(10,out);          /* int offset */
                   2068:                                fputc(2,out);           /* int length */
                   2069:                                i=0; }                          /* place holder */
                   2070:                        else
                   2071:                                i=val(src,arg3);
                   2072: 
                   2073:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_SOCKET_CONNECT);
                   2074:                        writecrc(src,arg);                      /* int var (socket) */
                   2075:                        writecrc(src,arg2);                     /* str var (address) */
                   2076:                        fwrite(&i,2,1,out);
                   2077:                        continue;
                   2078:                }
                   2079:                if(!stricmp(p,"SOCKET_ACCEPT")) {
                   2080:                        if(!(*arg)) break;
                   2081:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_SOCKET_ACCEPT);
                   2082:                        writecrc(src,arg);                      /* int var (socket) */
                   2083:                        continue;
                   2084:                }
                   2085:                if(!stricmp(p,"SOCKET_NREAD")) {
                   2086:                        if(!(*arg) || !(*arg2)) break;
                   2087:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_SOCKET_NREAD);
                   2088:                        writecrc(src,arg);                      /* int var (socket) */
                   2089:                        writecrc(src,arg2);                     /* int var (nbytes) */
                   2090:                        continue;
                   2091:                }
                   2092:                if(!stricmp(p,"SOCKET_READ") 
                   2093:                        || !stricmp(p,"SOCKET_READLINE") 
                   2094:                        || !stricmp(p,"SOCKET_PEEK")) {
                   2095:                        if(!(*arg) || !(*arg2)) break;
                   2096: 
                   2097:                        /* length */
                   2098:                        if(!(*arg3))
                   2099:                                i=0;
                   2100:                        else if((l=isvar(arg3))!=0) {
                   2101:                                fputc(CS_USE_INT_VAR,out);
                   2102:                                fwrite(&l,4,1,out); /* variable */
                   2103:                                fputc(10,out);          /* int offset */
                   2104:                                fputc(2,out);           /* int length */
                   2105:                                i=0; }                          /* place holder */
                   2106:                        else 
                   2107:                                i=val(src,arg3);
                   2108: 
                   2109:                        if(!stricmp(p,"SOCKET_READ"))
                   2110:                                ch=CS_SOCKET_READ;
                   2111:                        else if(!stricmp(p,"SOCKET_READLINE"))
                   2112:                                ch=CS_SOCKET_READLINE;
                   2113:                        else
                   2114:                                ch=CS_SOCKET_PEEK;
                   2115:                        fprintf(out,"%c%c",CS_NET_FUNCTION,ch);
                   2116:                        writecrc(src,arg);                      /* int var (socket) */
                   2117:                        writecrc(src,arg2);                     /* str var (buffer) */
                   2118:                        fwrite(&i,sizeof(i),1,out);     /* word (length) */
                   2119:                        continue;
                   2120:                }
                   2121:                if(!stricmp(p,"SOCKET_WRITE")) {
                   2122:                        if(!(*arg) || !(*arg2)) break;
                   2123:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_SOCKET_WRITE);
                   2124:                        writecrc(src,arg);                      /* int var (socket) */
                   2125:                        writecrc(src,arg2);                     /* str var (buffer) */
                   2126:                        continue;
                   2127:                }
                   2128: 
                   2129:                /* FTP functions */
                   2130:                if(!stricmp(p,"FTP_LOGIN")) {
                   2131:                        if(!(*arg) || !(*arg2) || !(*arg3)) break;
                   2132:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_FTP_LOGIN);
                   2133:                        writecrc(src,arg);                      /* int var (socket) */
                   2134:                        writecrc(src,arg2);                     /* int var (user) */
                   2135:                        writecrc(src,arg3);                     /* int var (password) */
                   2136:                        continue;
                   2137:                }
                   2138:                if(!stricmp(p,"FTP_LOGOUT")) {
                   2139:                        if(!(*arg)) break;
                   2140:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_FTP_LOGOUT);
                   2141:                        writecrc(src,arg);                      /* int var (socket) */
                   2142:                        continue;
                   2143:                }
                   2144:                if(!stricmp(p,"FTP_PWD")) {
                   2145:                        if(!(*arg)) break;
                   2146:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_FTP_PWD);
                   2147:                        writecrc(src,arg);                      /* int var (socket) */
                   2148:                        continue;
                   2149:                }
                   2150:                if(!stricmp(p,"FTP_CWD")) {
                   2151:                        if(!(*arg) || !(*arg2)) break;
                   2152:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_FTP_CWD);
                   2153:                        writecrc(src,arg);                      /* int var (socket) */
                   2154:                        writecrc(src,arg2);                     /* str var (path)       */
                   2155:                        continue;
                   2156:                }
                   2157:                if(!stricmp(p,"FTP_DIR")) {
                   2158:                        if(!(*arg) || !(*arg2)) break;
                   2159:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_FTP_DIR);
                   2160:                        writecrc(src,arg);                      /* int var (socket) */
                   2161:                        writecrc(src,arg2);                     /* str var (path)       */
                   2162:                        continue;
                   2163:                }
                   2164:                if(!stricmp(p,"FTP_GET")) {
                   2165:                        if(!(*arg) || !(*arg2) || !(*arg3)) break;
                   2166:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_FTP_GET);
                   2167:                        writecrc(src,arg);                      /* int var (socket) */
                   2168:                        writecrc(src,arg2);                     /* str var (src path) */
                   2169:                        writecrc(src,arg3);                     /* str var (dest path) */
                   2170:                        continue;
                   2171:                }
                   2172:                if(!stricmp(p,"FTP_PUT")) {
                   2173:                        if(!(*arg) || !(*arg2) || !(*arg3)) break;
                   2174:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_FTP_PUT);
                   2175:                        writecrc(src,arg);                      /* int var (socket) */
                   2176:                        writecrc(src,arg2);                     /* str var (src path) */
                   2177:                        writecrc(src,arg3);                     /* str var (dest path) */
                   2178:                        continue;
                   2179:                }
                   2180:                if(!stricmp(p,"FTP_DELETE")) {
                   2181:                        if(!(*arg) || !(*arg2)) break;
                   2182:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_FTP_DELETE);
                   2183:                        writecrc(src,arg);                      /* int var (socket) */
                   2184:                        writecrc(src,arg2);                     /* str var (path)       */
                   2185:                        continue;
                   2186:                }
                   2187:                if(!stricmp(p,"FTP_RENAME")) {
                   2188:                        if(!(*arg) || !(*arg2) || !(*arg3)) break;
                   2189:                        fprintf(out,"%c%c",CS_NET_FUNCTION,CS_FTP_RENAME);
                   2190:                        writecrc(src,arg);                      /* int var (socket) */
                   2191:                        writecrc(src,arg2);                     /* str var (org name) */
                   2192:                        writecrc(src,arg3);                     /* str var (new name) */
                   2193:                        continue;
                   2194:                }
                   2195: 
                   2196:                if(!stricmp(p,"NODE_ACTION")) {
                   2197:                        if(!(*arg)) break;
                   2198:                        if((l=isvar(arg))!=0) {
                   2199:                                fputc(CS_USE_INT_VAR,out);
                   2200:                                fwrite(&l,4,1,out); /* variable */
                   2201:                                fputc(1,out);           /* int offset */
                   2202:                                fputc(1,out);       /* int length */
                   2203:                                ch=0; }                         /* place holder */
                   2204:                        else
                   2205:                                ch=val(src,arg);
                   2206: 
                   2207:                        fprintf(out,"%c%c",CS_NODE_ACTION,ch);
                   2208:                        continue; }
                   2209:                if(!stricmp(p,"NODE_STATUS")) {
                   2210:                        if(!(*arg)) break;
                   2211:                        if((l=isvar(arg))!=0) {
                   2212:                                fputc(CS_USE_INT_VAR,out);
                   2213:                                fwrite(&l,4,1,out); /* variable */
                   2214:                                fputc(1,out);           /* int offset */
                   2215:                                fputc(1,out);       /* int length */
                   2216:                                ch=0; }                         /* place holder */
                   2217:                        else
                   2218:                                ch=val(src,arg);
                   2219: 
                   2220:                        fprintf(out,"%c%c",CS_NODE_STATUS,ch);
                   2221:                        continue; }
                   2222:                if(!stricmp(p,"END_CMD") || !stricmp(p,"ENDCMD")) {
                   2223:                        fprintf(out,"%c",CS_END_CMD);
                   2224:                        continue; }
                   2225:                if(!stricmp(p,"CMD_POP") || !stricmp(p,"CMDPOP")) {
                   2226:                        fprintf(out,"%c",CS_CMD_POP);
                   2227:                        continue; }
                   2228:                if(!stricmp(p,"CLS")) {
                   2229:                        fprintf(out,"%c",CS_CLS);
                   2230:                        continue; }
                   2231:                if(!stricmp(p,"CRLF")) {
                   2232:                        fprintf(out,"%c",CS_CRLF);
                   2233:                        continue; }
                   2234:                if(!stricmp(p,"PAUSE")) {
                   2235:                        fprintf(out,"%c",CS_PAUSE);
                   2236:                        continue; }
                   2237:                if(!stricmp(p,"PAUSE_RESET")) {
                   2238:                        fprintf(out,"%c",CS_PAUSE_RESET);
                   2239:                        continue; }
                   2240:                if(!stricmp(p,"CLEAR_ABORT")) {
                   2241:                        fprintf(out,"%c",CS_CLEAR_ABORT);
                   2242:                        continue; }
                   2243:                if(!stricmp(p,"GETLINES")) {
                   2244:                        fprintf(out,"%c",CS_GETLINES);
                   2245:                        continue; }
                   2246:                if(!stricmp(p,"GETFILESPEC")) {
                   2247:                        fprintf(out,"%c",CS_GETFILESPEC);
                   2248:                        continue; }
                   2249:                if(!stricmp(p,"FINDUSER")) {
                   2250:                        fprintf(out,"%c",CS_FINDUSER);
                   2251:                        continue; }
                   2252:                if(!stricmp(p,"MATCHUSER")) {
                   2253:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,MATCHUSER);
                   2254:                        writecrc(src,arg);
                   2255:                        writecrc(src,arg2);
                   2256:                        continue; }
                   2257: 
                   2258:                if(!stricmp(p,"LOG")) {
                   2259:                        if(!(*arg)) break;
                   2260:                        fprintf(out,"%c",CS_LOG);
                   2261:                        writecstr(arg);
                   2262:                        continue; }
                   2263:                if(!stricmp(p,"MNEMONICS")) {
                   2264:                        if(!(*arg)) break;
                   2265:                        fprintf(out,"%c",CS_MNEMONICS);
                   2266:                        writecstr(arg);
                   2267:                        continue; }
                   2268:                if(!stricmp(p,"PRINT")) {
                   2269:                        if(!(*arg)) break;
                   2270:                        fprintf(out,"%c",CS_PRINT);
                   2271:                        if(strstr(arg,"%s")!=NULL) {
                   2272:                                printf("!WARNING: PRINT \"%%s\" is a security hole if STR contains unvalidated input\n");
                   2273:                                printf(linestr,src,line,save);
                   2274:                        }
                   2275:                        writecstr(arg);
                   2276:                        continue; }
                   2277:                if(!stricmp(p,"PRINT_LOCAL")) {
                   2278:                        if(!(*arg)) break;
                   2279:                        fprintf(out,"%c",CS_PRINT_LOCAL);
                   2280:                        writecstr(arg);
                   2281:                        continue; }
                   2282:                if(!stricmp(p,"PRINT_REMOTE")) {
                   2283:                        if(!(*arg)) break;
                   2284:                        fprintf(out,"%c",CS_PRINT_REMOTE);
                   2285:                        writecstr(arg);
                   2286:                        continue; }
                   2287:                if(!stricmp(p,"PRINTFILE")) {
                   2288:                        if(!(*arg)) break;
                   2289:                        if(*arg=='"') { /* NEED TO SUPPORT MODE HERE */
                   2290:                                fprintf(out,"%c",CS_PRINTFILE);
                   2291:                                writestr(arg); }
                   2292:                        else {
                   2293:                                if((l=isvar(arg2))!=0) {
                   2294:                                        fputc(CS_USE_INT_VAR,out);
                   2295:                                        fwrite(&l,4,1,out); /* variable */
                   2296:                                        fputc(6,out);           /* int offset */
                   2297:                                        fputc(2,out);           /* int length */
                   2298:                                        i=0; }                          /* place holder */
                   2299:                                else
                   2300:                                        i=val(src,arg2);
                   2301: 
                   2302:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,PRINTFILE_VAR_MODE);
                   2303:                                p=strchr(arg,' ');
                   2304:                                if(p) *p=0;
                   2305:                                writecrc(src,arg);
                   2306:                                fwrite(&i,2,1,out); }
                   2307:                        continue; }
                   2308:                if(!stricmp(p,"PRINTTAIL")) {
                   2309:                        if(!(*arg) || !(*arg2))
                   2310:                                break;
                   2311:                        if((l=isvar(arg3))!=0) {
                   2312:                                fputc(CS_USE_INT_VAR,out);
                   2313:                                fwrite(&l,4,1,out); /* variable */
                   2314:                                fputc(8,out);           /* int offset */
                   2315:                                fputc(1,out);       /* int length */
                   2316:                                j=0; }                          /* place holder */
                   2317:                        else
                   2318:                                j=val(src,arg3);
                   2319: 
                   2320:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,PRINTTAIL_VAR_MODE);
                   2321:                        p=strchr(arg,' ');
                   2322:                        if(p) *p=0;
                   2323:                        writecrc(src,arg);
                   2324:                        i=val(src,arg2);
                   2325:                        fwrite(&i,2,1,out);
                   2326:                        fwrite(&j,1,1,out);
                   2327:                        continue; }
                   2328: 
                   2329:                if(!stricmp(p,"PRINTFILE_STR")) {
                   2330:                        fprintf(out,"%c",CS_PRINTFILE_STR);
                   2331:                        continue; }
                   2332:                if(!stricmp(p,"PRINTFILE_LOCAL")) {
                   2333:                        if(!(*arg)) break;
                   2334:                        fprintf(out,"%c",CS_PRINTFILE_LOCAL);
                   2335:                        writestr(arg);
                   2336:                        continue; }
                   2337:                if(!stricmp(p,"PRINTFILE_REMOTE")) {
                   2338:                        if(!(*arg)) break;
                   2339:                        fprintf(out,"%c",CS_PRINTFILE_REMOTE);
                   2340:                        writestr(arg);
                   2341:                        continue; }
                   2342: 
                   2343:                if(!stricmp(p,"TELNET_GATE")) {
                   2344:                        if(!(*arg)) break;
                   2345:                        if((l=isvar(arg2))!=0) {
                   2346:                                fputc(CS_USE_INT_VAR,out);
                   2347:                                fwrite(&l,4,1,out); /* variable */
                   2348:                                fputc(2,out);           /* int offset */
                   2349:                                fputc(4,out);           /* int length */
                   2350:                                l=0; }                          /* place holder */
                   2351:                        else if(*arg2)
                   2352:                                l=val(src,arg2);
                   2353:                        else
                   2354:                                l=0;
                   2355: 
                   2356:                        if(*arg=='"') {
                   2357:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,TELNET_GATE_STR);
                   2358:                                fwrite(&l,4,1,out);
                   2359:                                writestr(arg); 
                   2360:                        } else {
                   2361:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,TELNET_GATE_VAR);
                   2362:                                fwrite(&l,4,1,out);
                   2363:                                p=strchr(arg,' ');
                   2364:                                if(p) *p=0;
                   2365:                                writecrc(src,arg);
                   2366:                        }
                   2367:                        continue; 
                   2368:                }
                   2369: 
                   2370:                if(!stricmp(p,"EXEC")) {
                   2371:                        if(!(*arg)) break;
                   2372:                        fprintf(out,"%c",CS_EXEC);
                   2373:                        writestr(arg);
                   2374:                        continue; }
                   2375:                if(!stricmp(p,"EXEC_INT")) {
                   2376:                        if(!(*arg)) break;
                   2377:                        fprintf(out,"%c",CS_EXEC_INT);
                   2378:                        writestr(arg);
                   2379:                        continue; }
                   2380:                if(!stricmp(p,"EXEC_BIN")) {
                   2381:                        if(!(*arg)) break;
                   2382:                        fprintf(out,"%c",CS_EXEC_BIN);
                   2383:                        writestr(arg);
                   2384:                        continue; }
                   2385:                if(!stricmp(p,"EXEC_XTRN")) {
                   2386:                        if(!(*arg)) break;
                   2387:                        fprintf(out,"%c",CS_EXEC_XTRN);
                   2388:                        writestr(arg);
                   2389:                        continue; }
                   2390: 
                   2391:                if(!stricmp(p,"SELECT_SHELL")) {
                   2392:                        fprintf(out,"%c",CS_SELECT_SHELL);
                   2393:                        continue; }
                   2394:                if(!stricmp(p,"SET_SHELL")) {
                   2395:                        fprintf(out,"%c",CS_SET_SHELL);
                   2396:                        continue; }
                   2397:                if(!stricmp(p,"SELECT_EDITOR")) {
                   2398:                        fprintf(out,"%c",CS_SELECT_EDITOR);
                   2399:                        continue; }
                   2400:                if(!stricmp(p,"SET_EDITOR")) {
                   2401:                        fprintf(out,"%c",CS_SET_EDITOR);
                   2402:                        continue; }
                   2403: 
                   2404:                if(!stricmp(p,"YES_NO")) {
                   2405:                        if(!(*arg)) break;
                   2406:                        fprintf(out,"%c",CS_YES_NO);
                   2407:                        writecstr(arg);
                   2408:                        continue; }
                   2409:                if(!stricmp(p,"NO_YES")) {
                   2410:                        if(!(*arg)) break;
                   2411:                        fprintf(out,"%c",CS_NO_YES);
                   2412:                        writecstr(arg);
                   2413:                        continue; }
                   2414:                if(!stricmp(p,"MENU")) {
                   2415:                        if(!(*arg)) break;
                   2416:                        fprintf(out,"%c",CS_MENU);
                   2417:                        writestr(arg);
                   2418:                        continue; }
                   2419:                if(!stricmp(p,"SET_MENU_DIR")) {
                   2420:                        if(!(*arg)) break;
                   2421:                        fprintf(out,"%c",CS_SET_MENU_DIR);
                   2422:                        writestr(arg);
                   2423:                        continue; }
                   2424:                if(!stricmp(p,"SET_MENU_FILE")) {
                   2425:                        if(!(*arg)) break;
                   2426:                        fprintf(out,"%c",CS_SET_MENU_FILE);
                   2427:                        writestr(arg);
                   2428:                        continue; }
                   2429:                if(!stricmp(p,"SEND_FILE_VIA")) {
                   2430:                        if(!(*arg) || !(*arg2)) break;
                   2431:                        if(*arg2=='"') {
                   2432:                                fprintf(out,"%c%c%c",CS_VAR_INSTRUCTION,SEND_FILE_VIA,*arg);
                   2433:                                writestr(arg2); }
                   2434:                        else {
                   2435:                                fprintf(out,"%c%c%c",CS_VAR_INSTRUCTION,SEND_FILE_VIA_VAR,*arg);
                   2436:                                writecrc(src,arg2); }
                   2437:                        continue; }
                   2438:                if(!stricmp(p,"RECEIVE_FILE_VIA")) {
                   2439:                        if(!(*arg) || !(*arg2)) break;
                   2440:                        if(*arg2=='"') {
                   2441:                                fprintf(out,"%c%c%c",CS_VAR_INSTRUCTION,RECEIVE_FILE_VIA,*arg);
                   2442:                                writestr(arg2); }
                   2443:                        else {
                   2444:                                fprintf(out,"%c%c%c",CS_VAR_INSTRUCTION,RECEIVE_FILE_VIA_VAR,*arg);
                   2445:                                writecrc(src,arg2); }
                   2446:                        continue; }
                   2447:                if(!stricmp(p,"CHKFILE")) {
                   2448:                        if(!(*arg)) break;
                   2449:                        if(*arg=='"') {
                   2450:                                fprintf(out,"%c",CS_CHKFILE);
                   2451:                                writestr(arg); }
                   2452:                        else {
                   2453:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,CHKFILE_VAR);
                   2454:                                writecrc(src,arg); }
                   2455:                        continue; }
                   2456:                if(!stricmp(p,"GET_FILE_LENGTH")) {
                   2457:                        if(!(*arg) || !(*arg2))
                   2458:                                break;
                   2459:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,FLENGTH_TO_INT);
                   2460:                        p=strchr(arg,' ');
                   2461:                        if(p) *p=0;
                   2462:                        writecrc(src,arg);
                   2463:                        writecrc(src,arg2);
                   2464:                        continue; }
                   2465:                if(!stricmp(p,"GET_FILE_TIME")) {
                   2466:                        if(!(*arg) || !(*arg2))
                   2467:                                break;
                   2468:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,FTIME_TO_INT);
                   2469:                        p=strchr(arg,' ');
                   2470:                        if(p) *p=0;
                   2471:                        writecrc(src,arg);
                   2472:                        writecrc(src,arg2);
                   2473:                        continue; }
                   2474:                if(!stricmp(p,"CHARVAL")) {
                   2475:                        if(!(*arg) || !(*arg2))
                   2476:                                break;
                   2477:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,CHARVAL_TO_INT);
                   2478:                        p=strchr(arg,' ');
                   2479:                        if(p) *p=0;
                   2480:                        writecrc(src,arg);
                   2481:                        writecrc(src,arg2);
                   2482:                        continue; }
                   2483:                if(!stricmp(p,"SETSTR")) {
                   2484:                        if(!(*arg)) break;
                   2485:                        fprintf(out,"%c",CS_SETSTR);
                   2486:                        writecstr(arg);
                   2487:                        continue; }
                   2488:                if(!stricmp(p,"COMPARE_STR")) {
                   2489:                        if(!(*arg)) break;
                   2490:                        fprintf(out,"%c",CS_COMPARE_STR);
                   2491:                        writecstr(arg);
                   2492:                        continue; }
                   2493:                if(!stricmp(p,"GET_TEMPLATE")) {
                   2494:                        if(!(*arg)) break;
                   2495:                        fprintf(out,"%c",CS_GET_TEMPLATE);
                   2496:                        writestr(arg);
                   2497:                        continue; }
                   2498:                if(!stricmp(p,"READ_SIF")) {
                   2499:                        if(!(*arg)) break;
                   2500:                        fprintf(out,"%c",CS_READ_SIF);
                   2501:                        writestr(arg);
                   2502:                        continue; }
                   2503:                if(!stricmp(p,"CREATE_SIF")) {
                   2504:                        if(!(*arg)) break;
                   2505:                        fprintf(out,"%c",CS_CREATE_SIF);
                   2506:                        writestr(arg);
                   2507:                        continue; }
                   2508:                if(!stricmp(p,"TRASHCAN")) {
                   2509:                        if(!(*arg)) break;
                   2510:                        fprintf(out,"%c",CS_TRASHCAN);
                   2511:                        writestr(arg);
                   2512:                        continue; }
                   2513:                if(!stricmp(p,"CMDSTR")) {
                   2514:                        if(!(*arg)) break;
                   2515:                        fprintf(out,"%c",CS_CMDSTR);
                   2516:                        writecstr(arg);
                   2517:                        continue; }
                   2518:                if(!stricmp(p,"CMDKEYS")) {
                   2519:                        if(!(*arg)) break;
                   2520:                        fprintf(out,"%c",CS_CMDKEYS);
                   2521:                        for(p=arg;*p && *p!='#';p++) {
                   2522:                                ch=*p;
                   2523:                                if(ch=='"')
                   2524:                                        continue;
                   2525:                                if(ch=='/') {
                   2526:                                        p++;
                   2527:                                        ch=*p|0x80; }  /* high bit indicates slash required */
                   2528:                                else if(ch=='^' && *(p+1)>=0x40) {
                   2529:                                        p++;
                   2530:                                        ch=*p;
                   2531:                                        ch-=0x40; }
                   2532:                                else if(ch=='\\') {
                   2533:                                        p++;
                   2534:                                        ch=cesc(*p); }
                   2535:                                fputc(ch,out); }
                   2536:                        fputc(0,out);
                   2537:                        continue; }
                   2538:                if(!stricmp(p,"COMPARE_WORD")) {
                   2539:                        if(!(*arg)) break;
                   2540:                        fprintf(out,"%c",CS_COMPARE_WORD);
                   2541:                        writecstr(arg);
                   2542:                        continue; }
                   2543:                if(!stricmp(p,"GETSTR")) {
                   2544:                        p=strchr(arg,' ');
                   2545:                        if(p) *p=0;
                   2546:                        if((!(*arg) || isdigit(*arg) || !stricmp(arg,"STR")) && !(*arg3))
                   2547:                                fprintf(out,"%c%c",CS_GETSTR,atoi(arg) ? atoi(arg)
                   2548:                                        : *arg2 ? atoi(arg2) : 128);
                   2549:                        else {
                   2550:                                if((l=isvar(arg2))!=0) {
                   2551:                                        fputc(CS_USE_INT_VAR,out);
                   2552:                                        fwrite(&l,4,1,out); /* variable */
                   2553:                                        fputc(6,out);           /* int offset */
                   2554:                                        fputc(1,out);           /* int length */
                   2555:                                        i=0; }                          /* place holder */
                   2556:                                else if(*arg2)
                   2557:                                        i=val(src,arg2);
                   2558:                                else
                   2559:                                        i=0;
                   2560: 
                   2561:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION
                   2562:                                        ,*arg3 ? GETSTR_MODE : GETSTR_VAR);
                   2563:                                writecrc(src,arg);
                   2564:                
                   2565:                                if(!i) i=128;
                   2566:                                fwrite(&i,1,1,out);
                   2567:                                if(*arg3) {
                   2568:                                        l=val(src,arg3);
                   2569:                                        fwrite(&l,4,1,out); } }
                   2570:                        continue; }
                   2571:                if(!stricmp(p,"GETNUM")) {
                   2572:                        if(!(*arg)) break;
                   2573:                        p=strchr(arg,' ');
                   2574:                        if(p) *p=0;
                   2575:                        if(isdigit(*arg)) {
                   2576:                                i=val(src,arg);
                   2577:                                fprintf(out,"%c",CS_GETNUM);
                   2578:                                fwrite(&i,2,1,out); }
                   2579:                        else {
                   2580:                                if((l=isvar(arg2))!=0) {
                   2581:                                        fputc(CS_USE_INT_VAR,out);
                   2582:                                        fwrite(&l,4,1,out); /* variable */
                   2583:                                        fputc(6,out);           /* int offset */
                   2584:                                        fputc(2,out);           /* int length */
                   2585:                                        i=0; }                          /* place holder */
                   2586:                                else
                   2587:                                        i=val(src,arg2);
                   2588: 
                   2589:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,GETNUM_VAR);
                   2590:                                writecrc(src,arg);
                   2591:                                fwrite(&i,2,1,out); }
                   2592:                        continue; }
                   2593:                if(!stricmp(p,"MSWAIT")) {
                   2594:                        if(!(*arg)) break;
                   2595:                        if((l=isvar(arg))!=0) {
                   2596:                                fputc(CS_USE_INT_VAR,out);
                   2597:                                fwrite(&l,4,1,out); /* variable */
                   2598:                                fputc(1,out);           /* int offset */
                   2599:                                fputc(2,out);           /* int length */
                   2600:                                i=0; }                          /* place holder */
                   2601:                        else
                   2602:                                i=val(src,arg);
                   2603: 
                   2604:                        fprintf(out,"%c",CS_MSWAIT);
                   2605:                        fwrite(&i,2,1,out);
                   2606:                        continue; }
                   2607:                if(!stricmp(p,"GETLINE")) {
                   2608:                        p=strchr(arg,' ');
                   2609:                        if(p) *p=0;
                   2610:                        if(!(*arg) || isdigit(*arg))
                   2611:                                fprintf(out,"%c%c",CS_GETLINE,*arg ? atoi(arg) :128);
                   2612:                        else {
                   2613:                                if((l=isvar(arg2))!=0) {
                   2614:                                        fputc(CS_USE_INT_VAR,out);
                   2615:                                        fwrite(&l,4,1,out); /* variable */
                   2616:                                        fputc(6,out);           /* int offset */
                   2617:                                        fputc(1,out);           /* int length */
                   2618:                                        i=0; }                          /* place holder */
                   2619:                                else
                   2620:                                        i=val(src,arg2);
                   2621: 
                   2622:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,GETLINE_VAR);
                   2623:                                writecrc(src,arg);
                   2624:                                if(!i) i=128;
                   2625:                                fwrite(&i,1,1,out); }
                   2626:                        continue; }
                   2627:                if(!stricmp(p,"GETSTRUPR")) {
                   2628:                        p=strchr(arg,' ');
                   2629:                        if(p) *p=0;
                   2630:                        if(!(*arg) || isdigit(*arg))
                   2631:                                fprintf(out,"%c%c",CS_GETSTRUPR,*arg ? atoi(arg) :128);
                   2632:                        else {
                   2633:                                if((l=isvar(arg2))!=0) {
                   2634:                                        fputc(CS_USE_INT_VAR,out);
                   2635:                                        fwrite(&l,4,1,out); /* variable */
                   2636:                                        fputc(6,out);           /* int offset */
                   2637:                                        fputc(1,out);           /* int length */
                   2638:                                        i=0; }                          /* place holder */
                   2639:                                else
                   2640:                                        i=val(src,arg2);
                   2641: 
                   2642:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,GETSTRUPR_VAR);
                   2643:                                writecrc(src,arg);
                   2644:                                if(!i) i=128;
                   2645:                                fwrite(&i,1,1,out); }
                   2646:                        continue; }
                   2647:                if(!stricmp(p,"GETNAME")) {
                   2648:                        p=strchr(arg,' ');
                   2649:                        if(p) *p=0;
                   2650:                        if(!(*arg) || isdigit(*arg))
                   2651:                                fprintf(out,"%c%c",CS_GETNAME,*arg ? atoi(arg) :25);
                   2652:                        else {
                   2653:                                if((l=isvar(arg2))!=0) {
                   2654:                                        fputc(CS_USE_INT_VAR,out);
                   2655:                                        fwrite(&l,4,1,out); /* variable */
                   2656:                                        fputc(6,out);           /* int offset */
                   2657:                                        fputc(1,out);           /* int length */
                   2658:                                        i=0; }                          /* place holder */
                   2659:                                else
                   2660:                                        i=atoi(arg2);
                   2661: 
                   2662:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,GETNAME_VAR);
                   2663:                                writecrc(src,arg);
                   2664:                                if(!i) i=128;
                   2665:                                fwrite(&i,1,1,out); }
                   2666:                        continue; }
                   2667:                if(!stricmp(p,"SHIFT_STR")) {
                   2668:                        if(!(*arg)) break;
                   2669:                        p=strchr(arg,' ');
                   2670:                        if(p) *p=0;
                   2671:                        if(isdigit(*arg))
                   2672:                                fprintf(out,"%c%c",CS_SHIFT_STR,atoi(arg));
                   2673:                        else {
                   2674:                                if((l=isvar(arg2))!=0) {
                   2675:                                        fputc(CS_USE_INT_VAR,out);
                   2676:                                        fwrite(&l,4,1,out); /* variable */
                   2677:                                        fputc(6,out);           /* int offset */
                   2678:                                        fputc(1,out);           /* int length */
                   2679:                                        i=0; }                          /* place holder */
                   2680:                                else
                   2681:                                        i=atoi(arg2);
                   2682: 
                   2683:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,SHIFT_STR_VAR);
                   2684:                                writecrc(src,arg);
                   2685:                                if(!i) i=128;
                   2686:                                fwrite(&i,1,1,out); }
                   2687:                        continue; }
                   2688:                if(!stricmp(p,"SHIFT_TO_FIRST_CHAR") || !stricmp(p,"SHIFT_TO_LAST_CHAR")) {
                   2689:                        if(!(*arg) || !(*arg2)) break;
                   2690:                        if((l=isvar(arg2))!=0) {
                   2691:                                fputc(CS_USE_INT_VAR,out);
                   2692:                                fwrite(&l,4,1,out); /* variable */
                   2693:                                fputc(6,out);           /* int offset */
                   2694:                                fputc(1,out);           /* int length */
                   2695:                                ch=0; }                         /* place holder */
                   2696:                        else
                   2697:                                ch=val(src,arg2);
                   2698: 
                   2699:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION
                   2700:                                ,!stricmp(p,"SHIFT_TO_FIRST_CHAR") ? SHIFT_TO_FIRST_CHAR : SHIFT_TO_LAST_CHAR);
                   2701:                        writecrc(src,arg);
                   2702:                        fwrite(&ch,sizeof(ch),1,out);
                   2703:                        continue;
                   2704:                }
                   2705:                if(!stricmp(p,"TRUNCSP")) {
                   2706:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,TRUNCSP_STR_VAR);
                   2707:                        writecrc(src,arg);
                   2708:                        continue; }
                   2709:                if(!stricmp(p,"STRIP_CTRL")) {
                   2710:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,STRIP_CTRL_STR_VAR);
                   2711:                        writecrc(src,arg);
                   2712:                        continue; }
                   2713:                if(!stricmp(p,"STRUPR")) {
                   2714:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,STRUPR_VAR);
                   2715:                        writecrc(src,arg);
                   2716:                        continue; }
                   2717:                if(!stricmp(p,"STRLWR")) {
                   2718:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,STRLWR_VAR);
                   2719:                        writecrc(src,arg);
                   2720:                        continue; }
                   2721:                if(!stricmp(p,"STRLEN")) {
                   2722:                        if(!(*arg)) break;
                   2723:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,STRLEN_INT_VAR);
                   2724:                        p=strchr(arg,' ');
                   2725:                        if(!p)
                   2726:                                break;
                   2727:                        *p=0;
                   2728:                        writecrc(src,arg);
                   2729:                        writecrc(src,arg2);
                   2730:                        continue; }
                   2731:                if(!stricmp(p,"REPLACE_TEXT")) {
                   2732:                        if(!(*arg) || !(*arg2)) break;
                   2733:                        if((l=isvar(arg))!=0) {
                   2734:                                fputc(CS_USE_INT_VAR,out);
                   2735:                                fwrite(&l,4,1,out); /* variable */
                   2736:                                fputc(1,out);           /* int offset */
                   2737:                                fputc(2,out);           /* int length */
                   2738:                                i=0; }                          /* place holder */
                   2739:                        else
                   2740:                                i=val(src,arg);
                   2741: 
                   2742:                        fprintf(out,"%c",CS_REPLACE_TEXT);
                   2743:                        fwrite(&i,2,1,out);
                   2744:                        writecstr(arg2);
                   2745:                        continue; }
                   2746:                if(!stricmp(p,"REVERT_TEXT")) {
                   2747:                        if(!(*arg)) break;
                   2748:                        if(!stricmp(arg,"ALL"))
                   2749:                                i=0xffff;
                   2750:                        else {
                   2751:                                if((l=isvar(arg))!=0) {
                   2752:                                        fputc(CS_USE_INT_VAR,out);
                   2753:                                        fwrite(&l,4,1,out); /* variable */
                   2754:                                        fputc(1,out);           /* int offset */
                   2755:                                        fputc(2,out);           /* int length */
                   2756:                                        i=0; }                          /* place holder */
                   2757:                                else
                   2758:                                        i=val(src,arg); }
                   2759: 
                   2760:                        fprintf(out,"%c",CS_REVERT_TEXT);
                   2761:                        fwrite(&i,2,1,out);
                   2762:                        continue; }
                   2763:                if(!stricmp(p,"TOGGLE_USER_MISC")
                   2764:                        || !stricmp(p,"COMPARE_USER_MISC")) {
                   2765:                        if(!(*arg)) break;
                   2766: 
                   2767:                        if((l=isvar(arg))!=0) {
                   2768:                                fputc(CS_USE_INT_VAR,out);
                   2769:                                fwrite(&l,4,1,out); /* variable */
                   2770:                                fputc(1,out);           /* int offset */
                   2771:                                fputc(4,out);           /* int length */
                   2772:                                l=0; }                          /* place holder */
                   2773:                        else
                   2774:                                l=val(src,arg);
                   2775: 
                   2776:                        if(!stricmp(p,"TOGGLE_USER_MISC"))
                   2777:                                fprintf(out,"%c",CS_TOGGLE_USER_MISC);
                   2778:                        else
                   2779:                                fprintf(out,"%c",CS_COMPARE_USER_MISC);
                   2780:                        fwrite(&l,4,1,out);
                   2781:                        continue; }
                   2782: 
                   2783:                if(!stricmp(p,"TOGGLE_USER_CHAT")
                   2784:                        || !stricmp(p,"COMPARE_USER_CHAT")) {
                   2785:                        if(!(*arg)) break;
                   2786: 
                   2787:                        if((l=isvar(arg))!=0) {
                   2788:                                fputc(CS_USE_INT_VAR,out);
                   2789:                                fwrite(&l,4,1,out); /* variable */
                   2790:                                fputc(1,out);           /* int offset */
                   2791:                                fputc(4,out);           /* int length */
                   2792:                                l=0; }                          /* place holder */
                   2793:                        else
                   2794:                                l=val(src,arg);
                   2795: 
                   2796:                        if(!stricmp(p,"TOGGLE_USER_CHAT"))
                   2797:                                fprintf(out,"%c",CS_TOGGLE_USER_CHAT);
                   2798:                        else
                   2799:                                fprintf(out,"%c",CS_COMPARE_USER_CHAT);
                   2800:                        fwrite(&l,4,1,out);
                   2801:                        continue; }
                   2802: 
                   2803:                if(!stricmp(p,"TOGGLE_USER_QWK")
                   2804:                        || !stricmp(p,"COMPARE_USER_QWK")) {
                   2805:                        if(!(*arg)) break;
                   2806: 
                   2807:                        if((l=isvar(arg))!=0) {
                   2808:                                fputc(CS_USE_INT_VAR,out);
                   2809:                                fwrite(&l,4,1,out); /* variable */
                   2810:                                fputc(1,out);           /* int offset */
                   2811:                                fputc(4,out);           /* int length */
                   2812:                                l=0; }                          /* place holder */
                   2813:                        else
                   2814:                                l=val(src,arg);
                   2815: 
                   2816:                        if(!stricmp(p,"TOGGLE_USER_QWK"))
                   2817:                                fprintf(out,"%c",CS_TOGGLE_USER_QWK);
                   2818:                        else
                   2819:                                fprintf(out,"%c",CS_COMPARE_USER_QWK);
                   2820:                        fwrite(&l,4,1,out);
                   2821:                        continue; }
                   2822: 
                   2823:                if(!stricmp(p,"TOGGLE_NODE_MISC")
                   2824:                        || !stricmp(p,"COMPARE_NODE_MISC")) {
                   2825:                        if(!(*arg)) break;
                   2826: 
                   2827:                        if((l=isvar(arg))!=0) {
                   2828:                                fputc(CS_USE_INT_VAR,out);
                   2829:                                fwrite(&l,4,1,out); /* variable */
                   2830:                                fputc(1,out);           /* int offset */
                   2831:                                fputc(2,out);           /* int length */
                   2832:                                i=0; }                          /* place holder */
                   2833:                        else
                   2834:                                i=val(src,arg);
                   2835: 
                   2836:                        if(!stricmp(p,"TOGGLE_NODE_MISC"))
                   2837:                                fprintf(out,"%c",CS_TOGGLE_NODE_MISC);
                   2838:                        else
                   2839:                                fprintf(out,"%c",CS_COMPARE_NODE_MISC);
                   2840:                        fwrite(&i,2,1,out);
                   2841:                        continue; }
                   2842: 
                   2843:                if(!stricmp(p,"TOGGLE_USER_FLAG")) {
                   2844:                        if(!(*arg)) break;
                   2845:                        p=arg;
                   2846:                        fprintf(out,"%c%c",CS_TOGGLE_USER_FLAG,toupper(*p++));
                   2847:                        while(*p && *p<=' ') p++;
                   2848:                        fprintf(out,"%c",toupper(*p));
                   2849:                        continue; }
                   2850: 
                   2851:                if(!stricmp(p,"SET_USER_LEVEL")) {
                   2852:                        if(!(*arg)) break;
                   2853: 
                   2854:                        if((l=isvar(arg))!=0) {
                   2855:                                fputc(CS_USE_INT_VAR,out);
                   2856:                                fwrite(&l,4,1,out); /* variable */
                   2857:                                fputc(1,out);           /* int offset */
                   2858:                                fputc(1,out);           /* int length */
                   2859:                                ch=0; }                         /* place holder */
                   2860:                        else
                   2861:                                ch=val(src,arg);
                   2862: 
                   2863:                        fprintf(out,"%c%c",CS_SET_USER_LEVEL,ch);
                   2864:                        continue; }
                   2865: 
                   2866:                if(!stricmp(p,"SET_USER_STRING")) {
                   2867:                        if(!(*arg)) break;
                   2868: 
                   2869:                        if((l=isvar(arg))!=0) {
                   2870:                                fputc(CS_USE_INT_VAR,out);
                   2871:                                fwrite(&l,4,1,out); /* variable */
                   2872:                                fputc(1,out);           /* int offset */
                   2873:                                fputc(1,out);           /* int length */
                   2874:                                ch=0; }                         /* place holder */
                   2875:                        else
                   2876:                                ch=val(src,arg);
                   2877: 
                   2878:                        fprintf(out,"%c%c",CS_SET_USER_STRING,ch);
                   2879:                        continue; }
                   2880: 
                   2881: 
                   2882:                if(!stricmp(p,"ADJUST_USER_CREDITS")) {
                   2883:                        if(!(*arg)) break;
                   2884: 
                   2885:                        if((l=isvar(arg))!=0) {
                   2886:                                fputc(CS_USE_INT_VAR,out);
                   2887:                                fwrite(&l,4,1,out); /* variable */
                   2888:                                fputc(1,out);           /* int offset */
                   2889:                                fputc(2,out);           /* int length */
                   2890:                                i=0; }                      /* place holder */
                   2891:                        else
                   2892:                                i=val(src,arg);
                   2893: 
                   2894:                        fprintf(out,"%c",CS_ADJUST_USER_CREDITS);
                   2895:                        fwrite(&i,2,1,out);
                   2896:                        continue; }
                   2897: 
                   2898:                if(!stricmp(p,"ADJUST_USER_MINUTES")) {
                   2899:                        if(!(*arg)) break;
                   2900: 
                   2901:                        if((l=isvar(arg))!=0) {
                   2902:                                fputc(CS_USE_INT_VAR,out);
                   2903:                                fwrite(&l,4,1,out); /* variable */
                   2904:                                fputc(1,out);           /* int offset */
                   2905:                                fputc(2,out);           /* int length */
                   2906:                                i=0; }                          /* place holder */
                   2907:                        else
                   2908:                                i=val(src,arg);
                   2909: 
                   2910:                        fprintf(out,"%c",CS_ADJUST_USER_MINUTES);
                   2911:                        fwrite(&i,2,1,out);
                   2912:                        continue; }
                   2913: 
                   2914:                if(!stricmp(p,"SHOW_MEM")) {
                   2915:                        fprintf(out,"%c",CS_SHOW_MEM);
                   2916:                        continue; }
                   2917:                if(!stricmp(p,"GURU_LOG")) {
                   2918:                        fprintf(out,"%c",CS_GURU_LOG);
                   2919:                        continue; }
                   2920:                if(!stricmp(p,"ERROR_LOG")) {
                   2921:                        fprintf(out,"%c",CS_ERROR_LOG);
                   2922:                        continue; }
                   2923:                if(!stricmp(p,"SYSTEM_LOG")) {
                   2924:                        fprintf(out,"%c",CS_SYSTEM_LOG);
                   2925:                        continue; }
                   2926:                if(!stricmp(p,"SYSTEM_YLOG")) {
                   2927:                        fprintf(out,"%c",CS_SYSTEM_YLOG);
                   2928:                        continue; }
                   2929:                if(!stricmp(p,"SYSTEM_STATS")) {
                   2930:                        fprintf(out,"%c",CS_SYSTEM_STATS);
                   2931:                        continue; }
                   2932:                if(!stricmp(p,"NODE_STATS")) {
                   2933:                        fprintf(out,"%c",CS_NODE_STATS);
                   2934:                        continue; }
                   2935:                if(!stricmp(p,"CHANGE_USER")) {
                   2936:                        fprintf(out,"%c",CS_CHANGE_USER);
                   2937:                        continue; }
                   2938:                if(!stricmp(p,"ANSI_CAPTURE")) {
                   2939:                        fprintf(out,"%c",CS_ANSI_CAPTURE);
                   2940:                        continue; }
                   2941:                if(!stricmp(p,"LIST_TEXT_FILE")) {
                   2942:                        fprintf(out,"%c",CS_LIST_TEXT_FILE);
                   2943:                        continue; }
                   2944:                if(!stricmp(p,"EDIT_TEXT_FILE")) {
                   2945:                        fprintf(out,"%c",CS_EDIT_TEXT_FILE);
                   2946:                        continue; }
                   2947: 
                   2948: 
                   2949:                if(!stricmp(p,"COMPARE_KEY")) {
                   2950:                        if(!stricmp(arg,"DIGIT"))
                   2951:                                ch=CS_DIGIT;
                   2952:                        else if(!stricmp(arg,"EDIGIT"))
                   2953:                                ch=CS_EDIGIT;
                   2954:                        else
                   2955:                                ch=toupper(*arg);
                   2956:                        if(ch=='/')
                   2957:                                ch=(*arg)|0x80;   /* high bit indicates slash required */
                   2958:                        else if(ch=='^' && (*(arg+1))>=0x40)
                   2959:                                ch=(*(arg+1))-0x40;   /* ctrl char */
                   2960:                        else if(ch=='\\')
                   2961:                                ch=cesc(*(arg+1));
                   2962:                        else if(ch=='\'')
                   2963:                                ch=*(arg+1);
                   2964:                        fprintf(out,"%c%c",CS_COMPARE_KEY,ch);
                   2965:                        continue; }
                   2966:                if(!stricmp(p,"COMPARE_CHAR")) {
                   2967:                        ch=*arg;
                   2968:                        fprintf(out,"%c%c",CS_COMPARE_CHAR,ch);
                   2969:                        continue; }
                   2970:                if(!stricmp(p,"COMPARE_KEYS")) {
                   2971:                        fputc(CS_COMPARE_KEYS,out);
                   2972:                        for(p=arg;*p && *p!='#';p++) {
                   2973:                                ch=*p;
                   2974:                                if(ch=='"')
                   2975:                                        continue;
                   2976:                                if(ch=='/') {
                   2977:                                        p++;
                   2978:                                        ch=*p|0x80; }  /* high bit indicates slash required */
                   2979:                                else if(ch=='^' && *(p+1)>=0x40) {
                   2980:                                        p++;
                   2981:                                        ch=*p;
                   2982:                                        ch-=0x40; }
                   2983:                                else if(ch=='\\') {
                   2984:                                        p++;
                   2985:                                        ch=cesc(*p); }
                   2986:                                fputc(ch,out); }
                   2987:                        fputc(0,out);
                   2988:                        continue; }
                   2989:                if(!stricmp(p,"GETCMD")) {
                   2990:                        fprintf(out,"%c",CS_GETCMD);
                   2991:                        writecstr(arg);
                   2992:                        continue; }
                   2993:                if(!stricmp(p,"INKEY")) {
                   2994:                        fprintf(out,"%c",CS_INKEY);
                   2995:                        continue; }
                   2996:                if(!stricmp(p,"INCHAR")) {
                   2997:                        fprintf(out,"%c",CS_INCHAR);
                   2998:                        continue; }
                   2999:                if(!stricmp(p,"GETKEY")) {
                   3000:                        fprintf(out,"%c",CS_GETKEY);
                   3001:                        continue; }
                   3002:                if(!stricmp(p,"GETCHAR")) {
                   3003:                        fprintf(out,"%c",CS_GETCHAR);
                   3004:                        continue; }
                   3005:                if(!stricmp(p,"GETKEYE")) {
                   3006:                        fprintf(out,"%c",CS_GETKEYE);
                   3007:                        continue; }
                   3008:                if(!stricmp(p,"UNGETKEY")) {
                   3009:                        fprintf(out,"%c",CS_UNGETKEY);
                   3010:                        continue; }
                   3011:                if(!stricmp(p,"UNGETSTR")) {
                   3012:                        fprintf(out,"%c",CS_UNGETSTR);
                   3013:                        continue; }
                   3014:                if(!stricmp(p,"PRINTKEY")) {
                   3015:                        fprintf(out,"%c",CS_PRINTKEY);
                   3016:                        continue; }
                   3017:                if(!stricmp(p,"PRINTSTR")) {
                   3018:                        fprintf(out,"%c",CS_PRINTSTR);
                   3019:                        continue; }
                   3020: 
                   3021:                /* FUNCTIONS */
                   3022: 
                   3023:                if(!stricmp(p,"NODELIST_ALL")) {
                   3024:                        fprintf(out,"%c",CS_NODELIST_ALL);
                   3025:                        continue; }
                   3026:                if(!stricmp(p,"NODELIST_USERS")) {
                   3027:                        fprintf(out,"%c",CS_NODELIST_USERS);
                   3028:                        continue; }
                   3029: 
                   3030:                if(!stricmp(p,"USERLIST_ALL")) {
                   3031:                        fprintf(out,"%c",CS_USERLIST_ALL);
                   3032:                        continue; }
                   3033:                if(!stricmp(p,"USERLIST_SUB")) {
                   3034:                        fprintf(out,"%c",CS_USERLIST_SUB);
                   3035:                        continue; }
                   3036:                if(!stricmp(p,"USERLIST_DIR")) {
                   3037:                        fprintf(out,"%c",CS_USERLIST_DIR);
                   3038:                        continue; }
                   3039:                if(!stricmp(p,"USERLIST_LOGONS")) {
                   3040:                        fprintf(out,"%c",CS_USERLIST_LOGONS);
                   3041:                        continue; }
                   3042: 
                   3043:                if(!stricmp(p,"HANGUP")) {
                   3044:                        fprintf(out,"%c",CS_HANGUP);
                   3045:                        continue; }
                   3046: 
                   3047:                if(!stricmp(p,"LOGOFF")) {
                   3048:                        fprintf(out,"%c",CS_LOGOFF);
                   3049:                        continue; }
                   3050: 
                   3051:                if(!stricmp(p,"LOGOFF_FAST")) {
                   3052:                        fprintf(out,"%c",CS_LOGOFF_FAST);
                   3053:                        continue; }
                   3054: 
                   3055:                if(!stricmp(p,"AUTO_MESSAGE")) {
                   3056:                        fprintf(out,"%c",CS_AUTO_MESSAGE);
                   3057:                        continue; }
                   3058: 
                   3059:                if(!stricmp(p,"MINUTE_BANK")) {
                   3060:                        fprintf(out,"%c",CS_MINUTE_BANK);
                   3061:                        continue; }
                   3062: 
                   3063:                if(!stricmp(p,"USER_EDIT")) {
                   3064:                        fprintf(out,"%c",CS_USER_EDIT);
                   3065:                        continue; }
                   3066: 
                   3067:                if(!stricmp(p,"USER_DEFAULTS")) {
                   3068:                        fprintf(out,"%c",CS_USER_DEFAULTS);
                   3069:                        continue; }
                   3070: 
                   3071:                if(!stricmp(p,"PAGE_SYSOP")) {
                   3072:                        fprintf(out,"%c",CS_PAGE_SYSOP);
                   3073:                        continue; }
                   3074:                if(!stricmp(p,"PAGE_GURU")) {
                   3075:                        fprintf(out,"%c",CS_PAGE_GURU);
                   3076:                        continue; }
                   3077:                if(!stricmp(p,"SPY")) {
                   3078:                        fprintf(out,"%c",CS_SPY);
                   3079:                        continue; }
                   3080: 
                   3081: 
                   3082:                if(!stricmp(p,"PRIVATE_CHAT")) {
                   3083:                        fprintf(out,"%c",CS_PRIVATE_CHAT);
                   3084:                        continue; }
                   3085: 
                   3086:                if(!stricmp(p,"PRIVATE_MESSAGE")) {
                   3087:                        fprintf(out,"%c",CS_PRIVATE_MESSAGE);
                   3088:                        continue; }
                   3089: 
                   3090:                if(!stricmp(p,"MULTINODE_CHAT")) {
                   3091:                        if(!(*arg)) 
                   3092:                                ch=1;
                   3093:                        else {
                   3094:                                if((l=isvar(arg))!=0) {
                   3095:                                        fputc(CS_USE_INT_VAR,out);
                   3096:                                        fwrite(&l,4,1,out); /* variable */
                   3097:                                        fputc(1,out);           /* int offset */
                   3098:                                        fputc(1,out);       /* int length */
                   3099:                                        ch=0; }                         /* place holder */
                   3100:                                else
                   3101:                                        ch=val(src,arg);
                   3102:                        }
                   3103: 
                   3104:                        fprintf(out,"%c%c",CS_MULTINODE_CHAT,ch);
                   3105:                        continue; }
                   3106: 
                   3107:                if(!stricmp(p,"MAIL_READ")) {
                   3108:                        fprintf(out,"%c",CS_MAIL_READ);
                   3109:                        continue; }
                   3110:                if(!stricmp(p,"MAIL_READ_SENT")) {       /* Kill/read sent mail */
                   3111:                        fprintf(out,"%c",CS_MAIL_READ_SENT);
                   3112:                        continue; }
                   3113:                if(!stricmp(p,"MAIL_READ_ALL")) {
                   3114:                        fprintf(out,"%c",CS_MAIL_READ_ALL);
                   3115:                        continue; }
                   3116:                if(!stricmp(p,"MAIL_SEND")) {       /* Send E-mail */
                   3117:                        fprintf(out,"%c",CS_MAIL_SEND);
                   3118:                        continue; }
                   3119:                if(!stricmp(p,"MAIL_SEND_FEEDBACK")) {       /* Feedback */
                   3120:                        fprintf(out,"%c",CS_MAIL_SEND_FEEDBACK);
                   3121:                        continue; }
                   3122:                if(!stricmp(p,"MAIL_SEND_NETMAIL")) {
                   3123:                        fprintf(out,"%c",CS_MAIL_SEND_NETMAIL);
                   3124:                        continue; }
                   3125:                if(!stricmp(p,"MAIL_SEND_NETFILE")) {
                   3126:                        fprintf(out,"%c",CS_MAIL_SEND_NETFILE);
                   3127:                        continue; }
                   3128:                if(!stricmp(p,"MAIL_SEND_FILE")) {   /* Upload Attached File to E-mail */
                   3129:                        fprintf(out,"%c",CS_MAIL_SEND_FILE);
                   3130:                        continue; }
                   3131:                if(!stricmp(p,"MAIL_SEND_BULK")) {
                   3132:                        fprintf(out,"%c",CS_MAIL_SEND_BULK);
                   3133:                        continue; }
                   3134: 
                   3135: 
                   3136:                if(!stricmp(p,"MSG_SET_AREA")) {
                   3137:                        fprintf(out,"%c",CS_MSG_SET_AREA);
                   3138:                        continue; }
                   3139:                if(!stricmp(p,"MSG_SET_GROUP")) {
                   3140:                        fprintf(out,"%c",CS_MSG_SET_GROUP);
                   3141:                        continue; }
                   3142:                if(!stricmp(p,"MSG_SELECT_AREA")) {
                   3143:                        fprintf(out,"%c",CS_MSG_SELECT_AREA);
                   3144:                        continue; }
                   3145:                if(!stricmp(p,"MSG_SHOW_GROUPS")) {
                   3146:                        fprintf(out,"%c",CS_MSG_SHOW_GROUPS);
                   3147:                        continue; }
                   3148:                if(!stricmp(p,"MSG_SHOW_SUBBOARDS")) {
                   3149:                        fprintf(out,"%c",CS_MSG_SHOW_SUBBOARDS);
                   3150:                        continue; }
                   3151:                if(!stricmp(p,"MSG_GROUP_UP")) {
                   3152:                        fprintf(out,"%c",CS_MSG_GROUP_UP);
                   3153:                        continue; }
                   3154:                if(!stricmp(p,"MSG_GROUP_DOWN")) {
                   3155:                        fprintf(out,"%c",CS_MSG_GROUP_DOWN);
                   3156:                        continue; }
                   3157:                if(!stricmp(p,"MSG_SUBBOARD_UP")) {
                   3158:                        fprintf(out,"%c",CS_MSG_SUBBOARD_UP);
                   3159:                        continue; }
                   3160:                if(!stricmp(p,"MSG_SUBBOARD_DOWN")) {
                   3161:                        fprintf(out,"%c",CS_MSG_SUBBOARD_DOWN);
                   3162:                        continue; }
                   3163:                if(!stricmp(p,"MSG_GET_SUB_NUM")) {
                   3164:                        fprintf(out,"%c",CS_MSG_GET_SUB_NUM);
                   3165:                        continue; }
                   3166:                if(!stricmp(p,"MSG_GET_GRP_NUM")) {
                   3167:                        fprintf(out,"%c",CS_MSG_GET_GRP_NUM);
                   3168:                        continue; }
                   3169:                if(!stricmp(p,"MSG_READ")) {
                   3170:                        fprintf(out,"%c",CS_MSG_READ);
                   3171:                        continue; }
                   3172:                if(!stricmp(p,"MSG_POST")) {
                   3173:                        fprintf(out,"%c",CS_MSG_POST);
                   3174:                        continue; }
                   3175:                if(!stricmp(p,"MSG_QWK")) {
                   3176:                        fprintf(out,"%c",CS_MSG_QWK);
                   3177:                        continue; }
                   3178:                if(!stricmp(p,"MSG_PTRS_CFG")) {
                   3179:                        fprintf(out,"%c",CS_MSG_PTRS_CFG);
                   3180:                        continue; }
                   3181:                if(!stricmp(p,"MSG_PTRS_REINIT")) {
                   3182:                        fprintf(out,"%c",CS_MSG_PTRS_REINIT);
                   3183:                        continue; }
                   3184:                if(!stricmp(p,"MSG_NEW_SCAN_CFG")) {
                   3185:                        fprintf(out,"%c",CS_MSG_NEW_SCAN_CFG);
                   3186:                        continue; }
                   3187:                if(!stricmp(p,"MSG_NEW_SCAN")) {
                   3188:                        fprintf(out,"%c",CS_MSG_NEW_SCAN);
                   3189:                        continue; }
                   3190:                if(!stricmp(p,"MSG_NEW_SCAN_SUB")) {
                   3191:                        fprintf(out,"%c",CS_MSG_NEW_SCAN_SUB);
                   3192:                        continue; }
                   3193:                if(!stricmp(p,"MSG_NEW_SCAN_ALL")) {
                   3194:                        fprintf(out,"%c",CS_MSG_NEW_SCAN_ALL);
                   3195:                        continue; }
                   3196:                if(!stricmp(p,"MSG_CONT_SCAN")) {
                   3197:                        fprintf(out,"%c",CS_MSG_CONT_SCAN);
                   3198:                        continue; }
                   3199:                if(!stricmp(p,"MSG_CONT_SCAN_ALL")) {
                   3200:                        fprintf(out,"%c",CS_MSG_CONT_SCAN_ALL);
                   3201:                        continue; }
                   3202:                if(!stricmp(p,"MSG_BROWSE_SCAN")) {
                   3203:                        fprintf(out,"%c",CS_MSG_BROWSE_SCAN);
                   3204:                        continue; }
                   3205:                if(!stricmp(p,"MSG_BROWSE_SCAN_ALL")) {
                   3206:                        fprintf(out,"%c",CS_MSG_BROWSE_SCAN_ALL);
                   3207:                        continue; }
                   3208:                if(!stricmp(p,"MSG_FIND_TEXT")) {
                   3209:                        fprintf(out,"%c",CS_MSG_FIND_TEXT);
                   3210:                        continue; }
                   3211:                if(!stricmp(p,"MSG_FIND_TEXT_ALL")) {
                   3212:                        fprintf(out,"%c",CS_MSG_FIND_TEXT_ALL);
                   3213:                        continue; }
                   3214:                if(!stricmp(p,"MSG_YOUR_SCAN_CFG")) {
                   3215:                        fprintf(out,"%c",CS_MSG_YOUR_SCAN_CFG);
                   3216:                        continue; }
                   3217:                if(!stricmp(p,"MSG_YOUR_SCAN")) {
                   3218:                        fprintf(out,"%c",CS_MSG_YOUR_SCAN);
                   3219:                        continue; }
                   3220:                if(!stricmp(p,"MSG_YOUR_SCAN_ALL")) {
                   3221:                        fprintf(out,"%c",CS_MSG_YOUR_SCAN_ALL);
                   3222:                        continue; }
                   3223:                if(!stricmp(p,"CHAT_SECTION")) {
                   3224:                        fprintf(out,"%c",CS_CHAT_SECTION);
                   3225:                        continue; }
                   3226:                if(!stricmp(p,"TEXT_FILE_SECTION")) {
                   3227:                        fprintf(out,"%c",CS_TEXT_FILE_SECTION);
                   3228:                        continue; }
                   3229:                if(!stricmp(p,"XTRN_EXEC")) {
                   3230:                        fprintf(out,"%c",CS_XTRN_EXEC);
                   3231:                        continue; }
                   3232:                if(!stricmp(p,"XTRN_SECTION")) {
                   3233:                        fprintf(out,"%c",CS_XTRN_SECTION);
                   3234:                        continue; }
                   3235: 
                   3236:                if(!stricmp(p,"FILE_SET_AREA")) {
                   3237:                        fprintf(out,"%c",CS_FILE_SET_AREA);
                   3238:                        continue; }
                   3239:                if(!stricmp(p,"FILE_SET_LIBRARY")) {
                   3240:                        fprintf(out,"%c",CS_FILE_SET_LIBRARY);
                   3241:                        continue; }
                   3242:                if(!stricmp(p,"FILE_SELECT_AREA")) {
                   3243:                        fprintf(out,"%c",CS_FILE_SELECT_AREA);
                   3244:                        continue; }
                   3245:                if(!stricmp(p,"FILE_SHOW_LIBRARIES")) {
                   3246:                        fprintf(out,"%c",CS_FILE_SHOW_LIBRARIES);
                   3247:                        continue; }
                   3248:                if(!stricmp(p,"FILE_SHOW_DIRECTORIES")) {
                   3249:                        fprintf(out,"%c",CS_FILE_SHOW_DIRECTORIES);
                   3250:                        continue; }
                   3251:                if(!stricmp(p,"FILE_LIBRARY_UP")) {
                   3252:                        fprintf(out,"%c",CS_FILE_LIBRARY_UP);
                   3253:                        continue; }
                   3254:                if(!stricmp(p,"FILE_LIBRARY_DOWN")) {
                   3255:                        fprintf(out,"%c",CS_FILE_LIBRARY_DOWN);
                   3256:                        continue; }
                   3257:                if(!stricmp(p,"FILE_DIRECTORY_UP")) {
                   3258:                        fprintf(out,"%c",CS_FILE_DIRECTORY_UP);
                   3259:                        continue; }
                   3260:                if(!stricmp(p,"FILE_DIRECTORY_DOWN")) {
                   3261:                        fprintf(out,"%c",CS_FILE_DIRECTORY_DOWN);
                   3262:                        continue; }
                   3263:                if(!stricmp(p,"FILE_GET_DIR_NUM")) {
                   3264:                        fprintf(out,"%c",CS_FILE_GET_DIR_NUM);
                   3265:                        continue; }
                   3266:                if(!stricmp(p,"FILE_GET_LIB_NUM")) {
                   3267:                        fprintf(out,"%c",CS_FILE_GET_LIB_NUM);
                   3268:                        continue; }
                   3269:                if(!stricmp(p,"FILE_UPLOAD")) {
                   3270:                        fprintf(out,"%c",CS_FILE_UPLOAD);
                   3271:                        continue; }
                   3272:                if(!stricmp(p,"FILE_UPLOAD_USER")) {
                   3273:                        fprintf(out,"%c",CS_FILE_UPLOAD_USER);
                   3274:                        continue; }
                   3275:                if(!stricmp(p,"FILE_UPLOAD_BULK")) {
                   3276:                        fprintf(out,"%c",CS_FILE_UPLOAD_BULK);
                   3277:                        continue; }
                   3278:                if(!stricmp(p,"FILE_UPLOAD_SYSOP")) {
                   3279:                        fprintf(out,"%c",CS_FILE_UPLOAD_SYSOP);
                   3280:                        continue; }
                   3281:                if(!stricmp(p,"FILE_RESORT_DIRECTORY")) {
                   3282:                        fprintf(out,"%c",CS_FILE_RESORT_DIRECTORY);
                   3283:                        continue; }
                   3284:                if(!stricmp(p,"FILE_SET_ALT_PATH")) {
                   3285:                        fprintf(out,"%c",CS_FILE_SET_ALT_PATH);
                   3286:                        continue; }
                   3287:                if(!stricmp(p,"FILE_GET")) {
                   3288:                        fprintf(out,"%c",CS_FILE_GET);
                   3289:                        continue; }
                   3290:                if(!stricmp(p,"FILE_SEND")) {
                   3291:                        fprintf(out,"%c",CS_FILE_SEND);
                   3292:                        continue; }
                   3293:                if(!stricmp(p,"FILE_PUT")) {
                   3294:                        fprintf(out,"%c",CS_FILE_PUT);
                   3295:                        continue; }
                   3296:                if(!stricmp(p,"FILE_RECEIVE")) {
                   3297:                        fprintf(out,"%c",CS_FILE_RECEIVE);
                   3298:                        continue; }
                   3299:                if(!stricmp(p,"FILE_FIND_OLD")) {
                   3300:                        fprintf(out,"%c",CS_FILE_FIND_OLD);
                   3301:                        continue; }
                   3302:                if(!stricmp(p,"FILE_FIND_OPEN")) {
                   3303:                        fprintf(out,"%c",CS_FILE_FIND_OPEN);
                   3304:                        continue; }
                   3305:                if(!stricmp(p,"FILE_FIND_OFFLINE")) {
                   3306:                        fprintf(out,"%c",CS_FILE_FIND_OFFLINE);
                   3307:                        continue; }
                   3308:                if(!stricmp(p,"FILE_FIND_OLD_UPLOADS")) {
                   3309:                        fprintf(out,"%c",CS_FILE_FIND_OLD_UPLOADS);
                   3310:                        continue; }
                   3311:                if(!stricmp(p,"FILE_DOWNLOAD")) {
                   3312:                        fprintf(out,"%c",CS_FILE_DOWNLOAD);
                   3313:                        continue; }
                   3314:                if(!stricmp(p,"FILE_DOWNLOAD_USER")) {
                   3315:                        fprintf(out,"%c",CS_FILE_DOWNLOAD_USER);
                   3316:                        continue; }
                   3317:                if(!stricmp(p,"FILE_DOWNLOAD_BATCH")) {
                   3318:                        fprintf(out,"%c",CS_FILE_DOWNLOAD_BATCH);
                   3319:                        continue; }
                   3320:                if(!stricmp(p,"FILE_REMOVE")) {
                   3321:                        fprintf(out,"%c",CS_FILE_REMOVE);
                   3322:                        continue; }
                   3323:                if(!stricmp(p,"FILE_LIST")) {
                   3324:                        fprintf(out,"%c",CS_FILE_LIST);
                   3325:                        continue; }
                   3326:                if(!stricmp(p,"FILE_LIST_EXTENDED")) {
                   3327:                        fprintf(out,"%c",CS_FILE_LIST_EXTENDED);
                   3328:                        continue; }
                   3329:                if(!stricmp(p,"FILE_VIEW")) {
                   3330:                        fprintf(out,"%c",CS_FILE_VIEW);
                   3331:                        continue; }
                   3332:                if(!stricmp(p,"FILE_FIND_TEXT")) {
                   3333:                        fprintf(out,"%c",CS_FILE_FIND_TEXT);
                   3334:                        continue; }
                   3335:                if(!stricmp(p,"FILE_FIND_TEXT_ALL")) {
                   3336:                        fprintf(out,"%c",CS_FILE_FIND_TEXT_ALL);
                   3337:                        continue; }
                   3338:                if(!stricmp(p,"FILE_FIND_NAME")) {
                   3339:                        fprintf(out,"%c",CS_FILE_FIND_NAME);
                   3340:                        continue; }
                   3341:                if(!stricmp(p,"FILE_FIND_NAME_ALL")) {
                   3342:                        fprintf(out,"%c",CS_FILE_FIND_NAME_ALL);
                   3343:                        continue; }
                   3344:                if(!stricmp(p,"FILE_BATCH_SECTION")) {
                   3345:                        fprintf(out,"%c",CS_FILE_BATCH_SECTION);
                   3346:                        continue; }
                   3347:                if(!stricmp(p,"FILE_TEMP_SECTION")) {
                   3348:                        fprintf(out,"%c",CS_FILE_TEMP_SECTION);
                   3349:                        continue; }
                   3350:                if(!stricmp(p,"FILE_NEW_SCAN")) {
                   3351:                        fprintf(out,"%c",CS_FILE_NEW_SCAN);
                   3352:                        continue; }
                   3353:                if(!stricmp(p,"FILE_NEW_SCAN_ALL")) {
                   3354:                        fprintf(out,"%c",CS_FILE_NEW_SCAN_ALL);
                   3355:                        continue; }
                   3356:                if(!stricmp(p,"FILE_NEW_SCAN_CFG")) {
                   3357:                        fprintf(out,"%c",CS_FILE_NEW_SCAN_CFG);
                   3358:                        continue; }
                   3359:                if(!stricmp(p,"FILE_PTRS_CFG")) {
                   3360:                        fprintf(out,"%c",CS_FILE_PTRS_CFG);
                   3361:                        continue; }
                   3362:                if(!stricmp(p,"FILE_BATCH_ADD")) {
                   3363:                        fprintf(out,"%c",CS_FILE_BATCH_ADD);
                   3364:                        continue; }
                   3365:                if(!stricmp(p,"FILE_BATCH_ADD_LIST")) {
                   3366:                        fprintf(out,"%c",CS_FILE_BATCH_ADD_LIST);
                   3367:                        continue; }
                   3368:                if(!stricmp(p,"FILE_BATCH_CLEAR")) {
                   3369:                        fprintf(out,"%c",CS_FILE_BATCH_CLEAR);
                   3370:                        continue; }
                   3371: 
                   3372:                if(!stricmp(p,"INC_MAIN_CMDS")) {
                   3373:                        fprintf(out,"%c",CS_INC_MAIN_CMDS);
                   3374:                        continue; }
                   3375:                if(!stricmp(p,"INC_FILE_CMDS")) {
                   3376:                        fprintf(out,"%c",CS_INC_FILE_CMDS);
                   3377:                        continue; }
                   3378: 
                   3379:                break; }
                   3380: 
                   3381: 
                   3382:        if(!feof(in)) {
                   3383:                printf("!SYNTAX ERROR:\n");
                   3384:                printf(linestr,src,line,save);
                   3385:                bail(1); }
                   3386:        fclose(in);
                   3387:        free(str);
                   3388:        free(save);
                   3389: }
                   3390: 
                   3391: char *banner=  "\n"
                   3392:                                "BAJA v2.34-%s (rev %s) - Synchronet Shell/Module Compiler\n";
                   3393: 
                   3394: char *usage=   "\n"
                   3395:                                "usage: baja [-opts] file[.src]\n"
                   3396:                                "\n"
                   3397:                                " opts: -d display debug during compile\n"
                   3398:                                "       -c case sensitive variables, labels, and macros\n"
                   3399:                                "       -o set output directory (e.g. -o/sbbs/exec)\n"
                   3400:                                "       -i set include directory (e.g. -i/sbbs/exec)\n"
                   3401:                                "       -q quiet mode (no banner)\n"
                   3402:                                "       -p pause on error\n"
                   3403:                                ;
                   3404: 
                   3405: int main(int argc, char **argv)
                   3406: {
                   3407:        char    src[MAX_PATH+1]="",*p;
                   3408:        char    path[MAX_PATH+1];
                   3409:        int             i,j;
                   3410:        int             show_banner=TRUE;
                   3411:        char    revision[16];
                   3412: 
1.1.1.2 ! root     3413:        sscanf("$Revision: 1.44 $", "%*s %s", revision);
1.1       root     3414: 
                   3415:        for(i=1;i<argc;i++)
                   3416:                if(argv[i][0]=='-'
                   3417: #ifdef _WIN32
                   3418:                        || argv[i][0]=='/'
                   3419: #endif
                   3420:                        )
                   3421:                        switch(toupper(argv[i][1])) {
                   3422:                                case 'D':
                   3423:                                        display=1;
                   3424:                                        break;
                   3425:                                case 'C':
                   3426:                                        case_sens=1;
                   3427:                                        break;
                   3428:                                case 'O':
                   3429:                                        SAFECOPY(output_dir,argv[i]+2);
                   3430:                                        backslash(output_dir);
                   3431:                                        break;
                   3432:                                case 'I':
                   3433:                                        SAFECOPY(include_dir,argv[i]+2);
                   3434:                                        backslash(include_dir);
                   3435:                                        break;
                   3436:                                case 'P':
                   3437:                                        pause_on_error=TRUE;
                   3438:                                        break;
                   3439:                                case 'Q':
                   3440:                                        show_banner=0;
                   3441:                                        break;
                   3442:                                default:
                   3443:                                        printf(banner,PLATFORM_DESC,revision);
                   3444:                                        printf(usage);
                   3445:                                        bail(1); }
                   3446:                else
                   3447:                        sprintf(src,"%.*s",sizeof(src)-5,argv[i]);      /* leave room for '.src' to be appended */
                   3448: 
                   3449:        if(show_banner)
                   3450:                printf(banner,PLATFORM_DESC,revision);
                   3451: 
                   3452:        if(!src[0]) {
                   3453:                printf(usage);
                   3454:                bail(1); 
                   3455:        }
                   3456: 
                   3457:        if(include_dir[0]==0) {                         /* Include directory not specified */
                   3458:                SAFECOPY(include_dir,src);              /* Default to same dir as src file */
                   3459:                if((p=getfname(include_dir))!=NULL)
                   3460:                        *p=0;                                           /* Truncate off the src filename */
                   3461:        }
                   3462:        if(getfext(src)==NULL)
                   3463:                strcat(src,".src");
                   3464: 
                   3465:        SAFECOPY(bin_file,src);
                   3466:        if((p=getfext(bin_file))!=NULL)
                   3467:                *p=0;
                   3468:        strcat(bin_file,".bin");
                   3469: 
                   3470:        if(output_dir[0]) {
                   3471:                p=getfname(bin_file);
                   3472:                SAFEPRINTF2(path,"%s%s",output_dir,p);
                   3473:                SAFECOPY(bin_file,path); 
                   3474:        }
                   3475: 
                   3476:        if((out=fopen(bin_file,"w+b"))==NULL) {
                   3477:                printf("error %d opening %s for write\n",errno,bin_file);
                   3478:                bail(1); 
                   3479:        }
                   3480: 
                   3481:        printf("\nCompiling %s...\n",src);
                   3482: 
                   3483:        compile(src);
                   3484: 
                   3485:        /****************************/
                   3486:        /* Resolve GOTOS and CALLS */
                   3487:        /****************************/
                   3488: 
                   3489:        printf("Resolving labels...\n");
                   3490: 
                   3491:        for(i=0;i<gotos;i++) {
                   3492:                for(j=0;j<labels;j++)
                   3493:                        if(!stricmp(goto_label[i],label_name[j]))
                   3494:                                break;
                   3495:                if(j>=labels) {
                   3496:                        printf("%s line %d: label (%s) not found.\n"
                   3497:                                ,goto_file[i],goto_line[i],goto_label[i]);
                   3498:                        bail(1); }
1.1.1.2 ! root     3499:                fseek(out,(int32_t)(goto_indx[i]+1),SEEK_SET);
1.1       root     3500:                fwrite(&label_indx[j],2,1,out); }
                   3501: 
                   3502:        for(i=0;i<calls;i++) {
                   3503:                for(j=0;j<labels;j++)
                   3504:                        if((!case_sens
                   3505:                                && !strnicmp(call_label[i],label_name[j],strlen(call_label[i])))
                   3506:                        || (case_sens
                   3507:                                && !strncmp(call_label[i],label_name[j],strlen(call_label[i]))))
                   3508:                                break;
                   3509:                if(j>=labels) {
                   3510:                        printf("%s line %d: label (%s) not found.\n"
                   3511:                                ,call_file[i],call_line[i],call_label[i]);
                   3512:                        bail(1); }
1.1.1.2 ! root     3513:                fseek(out,(int32_t)(call_indx[i]+1),SEEK_SET);
1.1       root     3514:                fwrite(&label_indx[j],2,1,out); }
                   3515: 
                   3516:        printf("\nDone.\n");
                   3517:        return(0);
                   3518: }
                   3519: 
                   3520: 
                   3521: 

unix.superglobalmegacorp.com

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