🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by jay Thu, 08 Aug 1985 16:30
Empire Therapy
#364
Author: jay
Date: Thu, 08 Aug 1985 16:30
86 lines
2948 bytes

	Due to the number of requests I have decided to post the
	source I have for the empire 'therapy' program I picked up
	from the net some time ago.

	Enjoy,

	hp-pcd!jay

/***** hp-pcd:net.games.emp / genrad!john /  7:31 pm  Aug 26, 1984*/
/*
Being a Deity at this site, and having to deal with Shizophrenia
caused in several different ways, and not having the source
(GRUMBLE,GRUMBLE) so I can't fix the problems, I wrote a program
to fix the nation file from the shizophrenia problem.  The
player with the personality problem must run this program
himself.  Interestingly, this program does not seem to mung
the data file if that player is REALLY playing on another
terminal.  I also found that the "read" and "info" commands
did not work properly on BSD 4.2, so I rewrote them (contact
me for details on the last two.)

Anyway,  here it is, the program I call "therapy".
*/

#include <stdio.h>
#define D_NATSTR
#include "empdef.h"

extern char *natfil;
extern short privuid;
extern short maxnoc, maxcno;

struct natstr nattbl[MAX_MAXNOC];

main()
    {
    char buffer[256];
    int fd;
    int index;
    int uid;

    setbuf(stdout, NULL);
    if ((fd = open(natfil, 2)) < 0)
	{
	printf("Can't open nation file: %s\n", natfil);
	exit(1);
	}
    for (index = 0; index < maxnoc; ++index)
	if (read(fd, &nattbl[index], sizeof(struct natstr)) != sizeof (struct natstr))
	    {
	    printf("error reading nation file!\n");
	    exit (1);
	    }
    printf("Empire Schizophrenia Therapy Program!\n\n");
    printf("Country Name? ");
    gets(buffer);
    if (*buffer == 0)
	exit(0);
    for (index = 0; index < maxnoc; ++index)
	{
	if (!strcmp(nattbl[index].nat_cnam, buffer))
	    break;
	}
    if (index >= maxnoc)
	{
	printf("I can't find that name in the table.\n");
	exit (1);
	}
    if ((uid = getuid()) != nattbl[index].nat_nuid && uid != privuid && uid)
	printf("That country is not accessible by you!\n");
    printf("Representative? ");
    gets(buffer);
    if (strcmp(nattbl[index].nat_pnam, buffer))
	{
	printf("Sorry.\n");
	exit (1);
	}
    lseek(fd, (long) sizeof(struct natstr) * index, 0);
    nattbl[index].nat_tty[0] = '\0';
    nattbl[index].nat_pid = 0;
    write(fd, &nattbl[index], sizeof(struct natstr));
    close(fd);
    exit(0);
    }
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads