DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T t

⟦01552f320⟧ TextFile

    Length: 1462 (0x5b6)
    Types: TextFile
    Names: »teleg_send.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Gb/teleg_send.c« 

TextFile

/*
 * Galactic Bloodshed (Robert Chansky, smq@b)
 *	teleg_send.c -- does the work of sending a telegram
 */


#include "tweakables.h"
#include "files.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);
 }
}