Annotation of sbbs/sbbs2/scfg/makehelp.c, revision 1.1.1.1

1.1       root        1: /* MAKEHELP.C */
                      2: 
                      3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
                      4: 
                      5: /* Makes SCFG.HLP for Synchronet configuration program */
                      6: 
                      7: #include <stdio.h>
                      8: #include <alloc.h>
                      9: #include <string.h>
                     10: #include <io.h>
                     11: #include <fcntl.h>
                     12: #include <sys/stat.h>
                     13: 
                     14: void main(void)
                     15: {
                     16:        char *files[]={ "SCFG.C"
                     17:                                ,"SCFGSYS.C"
                     18:                                ,"SCFGMSG.C"
                     19:                                ,"SCFGSUB.C"
                     20:                                ,"SCFGNODE.C"
                     21:                                ,"SCFGCHAT.C"
                     22:                                ,"SCFGXFR1.C"
                     23:                                ,"SCFGXFR2.C"
                     24:                                ,"SCFGNET.C"
                     25:                                ,"SCFGXTRN.C"
                     26:                                ,NULL };
                     27:        char str[256],tmp[256];
                     28:        int i,j,k,line,ixb;
                     29:        long l;
                     30:        FILE *stream,*out;
                     31: 
                     32: if((out=fopen("SCFGHELP.DAT","wb"))==NULL) {
                     33:        printf("error opening SCFGHELP.DAT\r\n");
                     34:        return; }
                     35: 
                     36: if((ixb=open("SCFGHELP.IXB",O_WRONLY|O_CREAT|O_BINARY,S_IWRITE|S_IREAD))==-1) {
                     37:        printf("error opening SCFGHELP.IXB\r\n");
                     38:        return; }
                     39: 
                     40: for(i=0;files[i];i++) {
                     41:        if((stream=fopen(files[i],"rb"))==NULL) {
                     42:                printf("error opening %s\r\n",files[i]);
                     43:                return; }
                     44:        printf("\r\n%s ",files[i]);
                     45:        line=0;
                     46:        while(!feof(stream)) {
                     47:                if(!fgets(str,128,stream))
                     48:                        break;
                     49:                line++;
                     50:                if(strstr(str,"SETHELP(WHERE);")) {
                     51:                        l=ftell(out);
                     52:                        write(ixb,files[i],12);
                     53:                        write(ixb,&line,2);
                     54:                        write(ixb,&l,4);
                     55:                        fgets(str,128,stream);   /* skip start comment */
                     56:                        line++;
                     57:                        while(!feof(stream)) {
                     58:                                if(!fgets(str,128,stream))
                     59:                                        break;
                     60:                                if(strchr(str,9)) { /* Tab expansion */
                     61:                                        strcpy(tmp,str);
                     62:                                        k=strlen(tmp);
                     63:                                        for(j=l=0;j<k;j++) {
                     64:                                                if(tmp[j]==9) {
                     65:                                                        str[l++]=32;
                     66:                                                        while(l%4)
                     67:                                                                str[l++]=32; }
                     68:                                                else
                     69:                                                        str[l++]=tmp[j]; }
                     70:                                        str[l]=0; }
                     71:                                line++;
                     72:                                if(strstr(str,"*/"))    /* end comment */
                     73:                                        break;
                     74:                                fputs(str,out); }
                     75:                        fputc(0,out); } }
                     76:        fclose(stream); }
                     77: fclose(out);
                     78: printf("\n");
                     79: }

unix.superglobalmegacorp.com

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