home *** CD-ROM | disk | FTP | other *** search
- /* FidoUser.Lst Indexer for XBBS */
-
- #include "stdio.h"
- #include "stdlib.h"
- #include "dir.h"
-
- static void getline (char *);
-
- char alpha='B';
- #define MAXPROMPTS 1500
-
- FILE *fp;
-
- void main (void) {
-
- FILE *idxfp;
- struct ffblk f;
- char lineh[256]=" ";
- char s[18];
- long pos;
-
- if (findfirst ("FIDOUSER.LST",&f,0)) {
- fputs("\nCan't find FIDOUSER.LST\n",stdout);
- exit(1);
- }
-
- if (f.ff_fsize<1) {
- fputs("\nFIDOUSER.LST is null length\n",stdout);
- exit(1);
- }
-
- if ((fp = fopen("FIDOUSER.LST","r")) == NULL) {
- fputs("\nCan't open FIDOUSER.LST\n",stdout);
- exit(1);
- }
-
- remove("FIDOUSER.IDX");
-
- if ((idxfp = fopen("FIDOUSER.IDX","wb")) == NULL) {
- fputs("\nCan't open FIDOUSER.IDX\n",stdout);
- exit(1);
- }
-
- fputs("\nIndexing FIDOUSER.LST...\n",stdout);
-
- pos=0;
- fwrite(&pos,sizeof(long),1,idxfp);
- fputs("A \r",stdout);
-
- while (*lineh) {
- pos=ftell(fp);
- getline(lineh);
- if (toupper(*lineh)!=alpha) continue;
- fwrite(&pos,sizeof(long),1,idxfp);
- *s=alpha;
- s[1]=0;
- fputs(s,stdout);
- fputs(" \r",stdout);
- alpha++;
- }
- fclose(fp);
- fclose(idxfp);
- }
-
-
- static void getline (char *lineh) {
-
- if (fgets(lineh,256,fp)==NULL) *lineh=0;
-
- }
-
-