home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Otherware
/
Otherware_1_SB_Development.iso
/
amiga
/
comms
/
comprgs
/
aplst160.zoo
/
NLV.zoo
/
NLV.c
< prev
Wrap
C/C++ Source or Header
|
1989-08-08
|
3KB
|
133 lines
/* Used to view the Version6 and Paragon nodelists */
/* Written by Todd Kover of Insufficient Memory Software */
/* FidoNet 1:261/5016.0@FidoNet */
#include <stdio.h>
struct _node /* Version6 Nodelist */
{
int net;
int node;
int cost;
char name[34];
char phone[40];
char city[30];
char password[8];
int realcost;
int hubnode;
char rate;
char modem;
unsigned int flags1;
int reserved;
};
#define B_hub 0x0001
#define B_host 0x0002
#define B_region 0x0004
#define B_hold 0x0008
#define B_unlisted 0x0010
#define B_down 0x0020
#define B_CM 0x0040
#define B_NA 0x0080
#define B_Europe 0x0100
#define B_Pacific 0x0200
#define M_HST 0x0001
#define M_PEP 0x0002
struct _pnode /* Paragon Nodelist */
{
int type;
int zone;
int net;
int node;
int rnet;
int rnode;
int baud;
int cost;
int route;
char bbsname[50];
char bbsloc[30];
char bbsnumber[20];
char password[10];
int flags;
char res1;
char res2;
char res3;
char res4;
};
extern void *malloc();
main(argc,argv)
int argc;
char *argv[];
{
struct _node *node;
struct _pnode *pnode;
FILE *nlfile;
char listtype;
if(((argc!=2)&&(argc!=3)))
{ puts("\nNodeList Viewer by Todd Kover of 1:261/5016.0");
puts("Usage: NLV <nodelist.dat filename> [p|b]\n");
puts(" (b = Version6 nodelist; p = Paragon nodelist)\n");
exit(1); }
listtype='b';
if(argc==3)
{ if(tolower(argv[2][0])=='p')
listtype='p'; printf("%c",argv[2][0]); }
if(listtype=='b')
{
if(!(node=malloc(sizeof(struct _node))))
{ puts("Malloc() error!"); exit(2); }
if(!(nlfile=fopen(argv[1],"r")))
{ printf("Problem opening \"%s\"",argv[1]); free(node); exit(3); }
while(!(feof(nlfile))||!(ferror(nlfile)))
{
setmem(node,sizeof(struct _node),0);
fread(node,sizeof(struct _node),1,nlfile);
printf("-------------------------------------------------\n");
printf("%d/%d $%d @%d\n",node->net,node->node,node->cost,node->rate);
printf("BBS: %s\nPhone: %s\n",node->name,node->phone);
printf("City: %s\nPassword: %s\n",node->city,node->password);
printf("\nRealCost: %d Hub: %d/%d ",node->realcost,node->net,node->hubnode);
printf("flags1: %d; modem: %d\n",node->flags1,node->modem);
}
fclose(nlfile);
free(node);
}
if(listtype=='p')
{
if(!(pnode=malloc(sizeof(struct _pnode))))
{ puts("Malloc() error!"); exit(2); }
if(!(nlfile=fopen(argv[1],"r")))
{ printf("Problem opening \"%s\"",argv[1]); free(pnode); exit(3); }
while(!(feof(nlfile))||!(ferror(nlfile)))
{
fread(pnode,sizeof(struct _pnode),1,nlfile);
printf("-------------------------------------------------\n");
printf("Type: %d @%d:%d/%d\n",pnode->type,pnode->zone,
pnode->net,pnode->node);
printf("RN: %d/%d $%d @%d\n",pnode->rnet,pnode->rnode,pnode->cost,
pnode->baud);
printf("Route: %d\n",pnode->route);
printf("BBSName: %s\nBBSLoc: %s\n",pnode->bbsname,pnode->bbsloc);
printf("BBSNum: %s\nPassW: %s\n",pnode->bbsnumber,pnode->password);
printf("Flags %d\nRes1: %c Res2: %c Res3: %c Res4: %c\n",pnode->flags,
pnode->res1,pnode->res2,pnode->res3,pnode->res4);
}
fclose(nlfile);
free(pnode);
}
}