🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.games.emp
Article #266

Therapy for Shizophrenia

#266
From: John Nelson
Date: Mon, 27 Aug 1984 02:31
73 lines
2596 bytes
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);
    }
Technical Details
Message-ID: <335@genrad.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!linus!decvax!genrad!john
References: <2332@dartvax.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site genrad.UUCP
Path: arc1-ca.pugleaf.net!utzoo!linus!decvax!genrad!john
From: john@genrad.UUCP (John Nelson)
Newsgroups: net.games.emp
Subject: Therapy for Shizophrenia
Message-ID: <335@genrad.UUCP>
Date: Sun, 26-Aug-84 22:31:23 EDT
Article-I.D.: genrad.335
Posted: Sun Aug 26 22:31:23 1984
Date-Received: Thu, 30-Aug-84 19:27:31 EDT
References: <2332@dartvax.UUCP>
Organization: GenRad, Bolton, Mass.
Lines: 73