home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
WWIVMODS
/
MODSUNKN.ZIP
/
FINDNET.MOD
< prev
next >
Wrap
Text File
|
1990-08-14
|
10KB
|
177 lines
Goose #1 @7312
Tue Jul 31 17:55:46 1990
Find Network Board in Listing (FINDNET.MOD)
by Goose, 1@7312 (WWIVnet)
This is another mod requested by Killer - he's the idea man, I'm the one that
turns it into reality. What this mod does is allows the user to search for
WWIVnet boards by A) Area Code, B) Board Name (or partial name), or C) by
Node Number. This is a nice benefit for those users that are looking for
the number for a particular board (for example, one they see in the message
header of net messages), or looking for boards that are local to a given area.
The only file affected by this mod is SYSOPF1.C. First, add the following
variable declaration for helpl at the top of the file (+ indicates new or
modified code, - indicates existing code):
- extern gfiledirrec *gfilesec;
- extern int num_sec,hangup,userfile,echo,useron,userfile,usernum,using_modem;
+ extern int incom,fwaiting,userfile,helpl; /* mod - change */
- extern configrec syscfg;
Then scan down, and add the following code right before void
print_net_listing():
+ char *upper(char *instr) /* mod - add entire void */
+ {
+ static char us[41];
+ char upstr[41];
+ int i;
+
+ strcpy(upstr,instr);
+ for (i=0; i<strlen(instr); i++) {
+ upstr[i]=upcase(upstr[i]);
+ }
+ strcpy(us,upstr);
+ return(us);
+ }
Then, in void print_net_listing(), make the following changes:
- void print_net_listing()
- {
- int i,i1,i2,abort,f;
+ char s[161],s1[41],s2[81],s3[12],ch; /* mod - change */
- net_system_list_rec csne;
- abort=0;
+ helpl=43; /* mod - add */
+ nl(); /* mod - add */
+ prt(2,"Net: L)ist; Search by A)rea Code, B)BS Name, N)ode Number;
Q)uit ? "); /* mod - add */
+ ch=onek("QABNL"); /* mod - add */
+ if (ch=='Q') /* mod - add */
+ return; /* mod - add */
+ if (ch!='L') /* mod - add */
+ nl(); /* mod - add */
+ switch (ch) { /* mod - add */
+ case 'A': /* mod - add */
+ prt(2,"Enter Area Code: "); /* mod - add */
+ input(s1,3); /* mod - add */
+ nl(); /* mod - add */
+ if (strlen(s1)!=3) /* mod - add */
+ abort=1; /* mod - add */
+ for (i=0; i<3; i++) /* mod - add */
+ if ((s1[i]<'0') || (s1[i]>'9')) /* mod - add */
+ abort=1; /* mod - add */
+ if ((s1[1]!='0') && (s1[1]!='1')) /* mod - add */
+ abort=1; /* mod - add */
+ if (abort) /* mod - add */
+ pl("Area Code must be a three digit number!"); /* mod - add */
+ i2=1; /* mod - add */
+ break; /* mod - add */
+ case 'B': /* mod - add */
+ prt(2,"Enter Search String: "); /* mod - add */
+ input(s1,40); /* mod - add */
+ if (s1[0]==0) /* mod - add */
+ abort=1; /* mod - add */
+ i2=2; /* mod - add */
+ break; /* mod - add */
+ case 'N': /* mod - add */
+ prt(2,"Enter Node Number: "); /* mod - add */
+ input(s1,5); /* mod - add */
+ if (s1[0]==0) /* mod - add */
+ abort=1; /* mod - add */
+ else { /* mod - add */
+ i1=atoi(s1); /* mod - add */
+ if (i1==0) /* mod - add */
+ abort=1; /* mod - add */
+ } /* mod - add */
+ i2=3; /* mod - add */
+ break; /* mod - add */
+ case 'L': /* mod - add */
+ i2=0; /* mod - add */
+ break; /* mod - add */
+ } /* mod - add */
+ helpl=0; /* mod - add */
+ /* mod - delete nl();
+ /* mod - delete pla(" Num Phone Name */
+ /* mod - delete pla("----- ============ --------------------------- */
+ strcpy(s3,"000-000-0000"); /* mod - add */
- sprintf(s,"%sBBSDATA.NET",syscfg.datadir);
- f=open(s,O_RDONLY | O_BINARY);
- for (i=0; (i<num_sys_list) && (!abort); i++) {
- read(f,&csne,sizeof(net_system_list_rec));
+ if ((i2==0) || /* mod - add */
+ ((i2==1) && (strncmp(s1,csne.phone,3)==0)) || /* mod - add */
+ ((i2==2) && (strstr(upper(csne.name),s1)!=NULL)) || /* mod - add */
+ ((i2==3) && (i1==csne.sysnum))) { /* mod - add */
+ if (strncmp(s3,csne.phone,3)!=0) { /* mod - add */
+ strcpy(s3,csne.phone); /* mod - add */
+ if (!abort) /* mod - add */
+ nl(); /* mod - add */
+ describe_area_code(atoi(csne.phone),s2); /* mod - add */
+ sprintf(s,"Region: %s",s2); /* mod - add */
+ pla(s,&abort); /* mod - add */
+ if (!abort) /* mod - add */
+ nl(); /* mod - add */
+ pla(" Num Phone Name /* mod - add */
+ pla("----- ============ ------------------------ /* mod - add */
+ } /* mod - add */
- if (csne.forsys!=65535) {
Then right at the end of the void:
- }
+ } /* mod - add */
- close(f);
- }
That's it for the source --- almost. The difference may be if you don't have
FREE36K installed in your system. In that case, you won't have the
variable f in the first line of declaration, and you won't have the line that
defines net_system_list_rec csne. Also, the last bit of code above will
have to be changed as follows:
- pla(" Num Phone Name Hop
- pla("----- ============ ---------------------------------------- ===
- for (i=0; (i<num_sys_list) && (!abort); i++) {
+ if ((i2==0) || /* mod - add */
+ ((i2==1) && (strncmp(s1,csn[i].phone,3)==0)) || /* mod - add */
+ ((i2==2) && (strstr(upper(csn[i].name),s1)!=NULL)) || /* mod - add */
+ ((i2==3) && (i1==csn[i].sysnum))) /* mod - add */
+ if (strncmp(s3,csn[i].phone,3)!=0) { /* mod - add */
+ strcpy(s3,csn[i].phone); /* mod - add */
+ if (!abort) /* mod - add */
+ nl(); /* mod - add */
+ describe_area_code(atoi(csn[i].phone),s2); /* mod - add */
+ sprintf(s,"Region: %s",s2); /* mod - add */
+ pla(s,&abort); /* mod - add */
+ if (!abort) /* mod - add */
+ nl(); /* mod - add */
+ pla(" Num Phone Name /* mod - add */
+ pla("----- ============ ------------------------ /* mod - add */
+ } /* mod - add */
- if (csn[i].forsys!=65535) {
NOTE!!! The two pla lines with the Num/Phone/Name were truncated so they
would fit into the 80 column width for posting this mod on the net.
Just use the ones from your original source and you should be ok.
Also, the first prt statement was split across two lines to make
it fit.. you'll have to fix that also.
Also, you'll have to update the HELP.MSG menus to display the help for the
//NET command. Note if you already have a help menu 43 you can change the
number here and in the helpl command above.
`43==========================================================================
You can display the entire WWIVnet BBS database by typing 'L', or search for
specific boards by area code or name. For the area code, you will be
prompted for a three digit number which is checked before the search begins.
For the BBS name search, you can enter all or part of the name and all the
boards that compare will be displayed. For the node number, you have to
enter the WWIVnet node number for the board you are searching for.
That's the mod. Just recompile SYSOPF1.C and you'll be all set. If you have
any problems or general comments with this mod or any of my others, I can be
reached at 1@7312 (WWIVnet) or the Twilight Zone BBS at 703-369-5225.