|
|
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 <string.h>
9: #include <fcntl.h>
10: #include <sys/stat.h>
1.1.1.2 ! root 11:
! 12: /* XPDEV */
! 13: #include <filewrap.h>
1.1 root 14:
15: int main(int argc, char **argv)
16: {
17: char *dir=".";
18: char *files[]={
19: "scfg.c"
20: ,"scfgsys.c"
21: ,"scfgmsg.c"
22: ,"scfgsub.c"
23: ,"scfgnode.c"
24: ,"scfgchat.c"
25: ,"scfgxfr1.c"
26: ,"scfgxfr2.c"
27: ,"scfgnet.c"
28: ,"scfgxtrn.c"
29: ,NULL };
30: char str[256],tmp[256];
31: int i,j,k,ixb;
32: unsigned short line;
33: long l;
34: FILE *stream,*out;
35:
36: if(argc>1)
37: dir=argv[1];
38:
39: sprintf(str,"%s/scfghelp.dat",dir);
40: if((out=fopen(str,"wb"))==NULL) {
41: fprintf(stderr,"!error opening %s\n",str);
42: return(-1); }
43:
44: sprintf(str,"%s/scfghelp.ixb",dir);
1.1.1.2 ! root 45: if((ixb=open(str,O_WRONLY|O_CREAT|O_BINARY,DEFFILEMODE))==-1) {
1.1 root 46: fprintf(stderr,"!error opening %s\n",str);
47: return(-1); }
48:
49: for(i=0;files[i];i++) {
50: if((stream=fopen(files[i],"rb"))==NULL) {
51: fprintf(stderr,"!error opening %s\r\n",files[i]);
52: return(-3); }
53: printf("\r\nIndexing %s ...",files[i]);
54: line=0;
55: while(!feof(stream)) {
56: if(!fgets(str,128,stream))
57: break;
58: line++;
59: if(strstr(str,"SETHELP(WHERE);")) {
60: /* printf("%s:%u\n",files[i],line); */
61: l=ftell(out);
62: write(ixb,files[i],12);
63: write(ixb,&line,2);
64: write(ixb,&l,4);
65: fgets(str,128,stream); /* skip start comment */
66: line++;
67: while(!feof(stream)) {
68: if(!fgets(str,128,stream))
69: break;
70: if(strchr(str,9)) { /* Tab expansion */
71: strcpy(tmp,str);
72: k=strlen(tmp);
73: for(j=l=0;j<k;j++) {
74: if(tmp[j]==9) {
75: str[l++]=32;
76: while(l%4)
77: str[l++]=32; }
78: else
79: str[l++]=tmp[j]; }
80: str[l]=0; }
81: line++;
82: if(strstr(str,"*/")) /* end comment */
83: break;
84: fputs(str,out); }
85: fputc(0,out); } }
86: fclose(stream); }
87: fclose(out);
88: printf("\n");
89: return(0);
90: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.