|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T t
Length: 1443 (0x5a3)
Types: TextFile
Names: »teleg_send.c.orig«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Gb/teleg_send.c.orig«
/*
* Galactic Bloodshed (Robert Chansky, smq@b)
* teleg_send.c -- does the work of sending a telegram
*/
#include "tweakables.h"
#include <stdio.h>
#include <ctype.h>
#include <strings.h>
#include <errno.h>
#include <signal.h>
#include <sys/file.h>
#include <sys/time.h>
long tm;
char *ctime();
teleg_send(sender, recpient, msg)
char sender, recpient;
char *msg;
{
char telefl[80],tmbuf[50], numcodes;
int mask;
FILE *telegram_fd;
register int i,t;
mask = sigblock(SIGINT | SIGQUIT | SIGSTOP);
/* block interrupts from keyboard */
sprintf(telefl, "%s.%d",TELEGRAMFL, recpient );
if ((telegram_fd = fopen( telefl, "a" ))==NULL) {
perror("teleg_send");
} else {
/* write player number */
fputc(sender, telegram_fd);
/* write current time */
tm = time(0);
fprintf( telegram_fd, "%s", ctime(&tm) );
/* write the telegram */
do {
if (isspace(*msg)) {
fprintf(telegram_fd, "%c%c", *msg, int_rand(1,99));
} else
fputc(*msg, telegram_fd);
} while (*(msg++) != '\0');
fprintf(telegram_fd, "\n%c", TELEG_DELIM);
fclose(telegram_fd);
}
sigsetmask(mask); /* reset mask */
}
/* for autoreport; send '\0' to initialize */
teleg_add(string,buf)
char *string,*buf;
{
static int telegram_ctr = 0;
/* what character of the telegram buffer we're on */
if (*string=='\0') {
buf[0] = '\n';
telegram_ctr = 1;
} else {
strcpy(buf + telegram_ctr, string);
telegram_ctr += strlen(string);
}
}