home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
XGRP_000.SZH
/
MAKEMSG.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-08
|
2KB
|
67 lines
#include "xgroup.h"
struct __fidomsg__ {
char from[36];
char to[36];
char subj[63];
char nodelist[9]; /* OPUS: Name of the nodelist used */
char date[20];
word times; /* FIDO<tm>: Number of times read */
word dest; /* Destination node */
word orig; /* Origination node number */
word cost; /* Unit cost charged to send the message */
word orig_net; /* Origination network number */
word dest_net; /* Destination network number */
int msg_filler[4];
word reply; /* Current msg is a reply to this msg number */
word attr; /* Attribute (behavior) of the message */
word up; /* Next message in the thread */
};
typedef struct __fidomsg__ FIDOMSG;
extern char *putmsgs;
extern char buffer[1024];
word _fastcall make_message (char *text,XMSG *xmsg) {
int fp;
word x = 1;
FIDOMSG msg;
struct stat st;
do {
if(putmsgs) sprintf(buffer,"%s/%u.MSG",putmsgs,x);
else sprintf(buffer,"%u.MSG",x);
if(stat(buffer,&st)) break;
} while(++x);
if(!x) return 0;
fp = sopen(buffer,O_RDWR | O_BINARY | O_CREAT,SH_DENYWR,S_IREAD | S_IWRITE);
if(fp != -1) {
memset(&msg,0,sizeof(FIDOMSG));
strcpy(msg.from,xmsg->from);
strcpy(msg.to,xmsg->to);
strcpy(msg.date,xmsg->date);
strcpy(msg.subj,xmsg->subj);
msg.attr = xmsg->attr;
msg.cost = xmsg->cost;
msg.orig = xmsg->orig;
msg.dest = xmsg->dest;
msg.dest_net = xmsg->dest_net;
msg.orig_net = xmsg->orig_net;
write(fp,&msg,sizeof(FIDOMSG));
write(fp,text,strlen(text));
write(fp,"\0",1);
close(fp);
return x;
}
return 0;
}