#include "screen.h"
#define MAXWORDBUF SIZ
-#define MAXMSGS 512
struct cittext {
struct cittext *next;
int file_checksum(char *filename);
void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd);
-long msg_arr[MAXMSGS];
+long *msg_arr = NULL;
+int msg_arr_size = 0;
int num_msgs;
char rc_alt_semantics;
extern char room_name[];
void ka_sigcatch(int signum)
{
- char buf[SIZ];
-
alarm(S_KEEPALIVE);
signal(SIGALRM, ka_sigcatch);
CtdlIPCNoop();
sprintf(buf, "rfca=%s\n", message->email);
/* FIXME: output buf */
}
- sprintf(buf, "hnod=%s\nroom=%s\nnode=%s\ntime=%ld\n",
+ sprintf(buf, "hnod=%s\nroom=%s\nnode=%s\ntime=%s",
message->hnod, message->room,
- message->node, message->time);
+ message->node,
+ asctime(localtime(&message->time)));
if (strlen(message->recipient)) {
sprintf(buf, "rcpt=%s\n", message->recipient);
/* FIXME: output buf */
scr_printf("%s\n", &cmd[5]);
} else {
while (serv_gets(cmd), strcmp(cmd, "000")) {
+
+ if ((num_msgs + 1) > msg_arr_size) {
+ msg_arr_size += 512;
+ msg_arr = realloc(msg_arr,
+ ((sizeof(long)) * msg_arr_size) );
+ }
+
msg_arr[num_msgs++] = atol(cmd);
}
}
int r; /* IPC response code */
if (c < 0)
- b = (MAXMSGS - 1);
+ b = (num_msgs - 1);
else
b = 0;
scr_printf("%s\n", &cmd[5]);
} else {
while (serv_gets(cmd), strcmp(cmd, "000")) {
- if (num_msgs == MAXMSGS) {
- memcpy(&msg_arr[0], &msg_arr[1],
- (sizeof(long) * (MAXMSGS - 1)));
- --num_msgs;
+
+ if ((num_msgs + 1) > msg_arr_size) {
+ msg_arr_size += 512;
+ msg_arr = realloc(msg_arr,
+ ((sizeof(long)) * msg_arr_size) );
}
+
msg_arr[num_msgs++] = atol(cmd);
}
}
for (a = start; ((a < num_msgs) && (a >= 0)); a = a + rdir) {
while (msg_arr[a] == 0L) {
a = a + rdir;
- if ((a == MAXMSGS) || (a == (-1)))
+ if ((a == num_msgs) || (a == (-1)))
return;
}