struct msglist {
struct msglist *next;
long m_num;
- char m_rmname[20];
+ char m_rmname[ROOMNAMELEN];
};
struct rmlist {
struct rmlist *next;
- char rm_name[20];
+ char rm_name[ROOMNAMELEN];
long rm_lastsent;
};
void get_config(void);
struct filterlist *filter = NULL;
-char roomnames[MAXROOMS][20];
-char roomdirs[MAXROOMS][15];
struct syslist *slist = NULL;
struct config config;
}
-/*
- * for performance optimization, netproc loads the list of room names (and
- * their corresponding directory names, if applicable) into a table in memory.
- */
-int load_roomnames(void) {
- FILE *fp;
- struct quickroom qbuf;
- int i;
-
- fp=fopen("./quickroom","rb");
- if (fp==NULL) return(1);
- for (i=0; i<MAXROOMS; ++i) {
- if (fread((char *)&qbuf,sizeof(struct quickroom),1,fp)!=1)
- return(1);
- strcpy(roomnames[i],qbuf.QRname);
- if (qbuf.QRflags & QR_DIRECTORY)
- strcpy(roomdirs[i],qbuf.QRdirname);
- else
- strcpy(roomdirs[i],config.c_bucket_dir);
- }
- fclose(fp);
- return(0);
- }
-
/*
* we also load the network/mail.sysinfo table into memory, make changes
* as we learn more about the network from incoming messages, and write
/*
* proc_file_transfer() - handle a simple file transfer packet
+ *
+ * FIX This shouldn't be like this. What it needs to do is begin an upload
+ * and transmit the file to the server.
*/
void proc_file_transfer(char *tname)
{ /* name of temp file containing the whole message */
char buf[128];
- char dest_dir[32];
+ char dest_room[32];
FILE *tfp,*uud;
- int a,b;
+ int a;
printf("netproc: processing network file transfer...\n");
- strcpy(dest_dir,config.c_bucket_dir);
tfp=fopen(tname,"rb");
if (tfp==NULL) printf("netproc: cannot open %s\n",tname);
a=getc(tfp);
if (a!='M') {
fpgetfield(tfp,buf);
- if (a=='O') for (b=0; b<MAXROOMS; ++b) {
- if (!strcasecmp(buf,roomnames[b]))
- strcpy(dest_dir,roomdirs[b]);
+ if (a=='O') {
+ strcpy(dest_room, buf);
}
}
} while ((a!='M')&&(a>=0));
return;
}
- sprintf(buf,"cd %s/files/%s; exec %s",bbs_home_directory,dest_dir,UUDECODE);
+ sprintf(buf,"cd %s/files/%s; exec %s",bbs_home_directory,config.c_bucket_dir,UUDECODE);
uud=(FILE *)popen(buf,"w");
if (uud==NULL) {
printf("netproc: cannot open uudecode pipe\n");
/*
* main
*/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
char allst[32];
FILE *allfp;
np_attach_to_server();
fflush(stdout);
- if (load_roomnames()!=0) fprintf(stdout,"netproc: cannot load rooms\n");
if (load_syslist()!=0) fprintf(stdout,"netproc: cannot load sysinfo\n");
setup_special_nodes();
rewrite_syslist();
printf("netproc: processing ended.\n");
cleanup(0);
+ return 0;
}