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 m

⟦eb412cf15⟧ TextFile

    Length: 2043 (0x7fb)
    Types: TextFile
    Names: »mpssclean.c«

Derivation

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

TextFile


/********VERSION 1.4!!! (Files from different Versions are INCOMPATIBLE!*******/
/*******************************************************************************
********************************************************************************
********************************************************************************

PERMISSION TO COPY THIS SOFTWARE IS HEREBY GIVEN BY THE AUTHOR PROVIDED THAT
THIS LEADING MESSAGE IS INCLUDED IN ALL OF THE RELEVANT SOURCE FILES.

		P. SCHMITZ, UNIVERSITY OF KEELE, MAY 1988.


********************************************************************************
********************************************************************************
*******************************************************************************/
#include <stdio.h>
#include "files.h"
#include <signal.h>


main()
{
int rpid,procno;
char string[15];
char remove[80];
char arr[15];
FILE *f, *fopen();
		
fprintf(stdout,"            MPSS CLEANUP PROGRAM..\n");
fprintf(stdout," This program quits any game currently running,\n");
fprintf(stdout," and/or it cleans up files and processes  left \n");
fprintf(stdout,"on your system incase MPSS was stopped abnormally.\n");
fprintf(stdout,"     Please ignore any error messages below. \n\n");

sprintf(remove,"rm %s\n",PLAYERFILE);
system(remove);
sprintf(remove,"rm %s\n",LOCK);
system(remove);
sprintf(remove,"rm %s\n",PLAYERSCOREFILE);
system(remove);
system("stty -cbreak echo");
if ((f=fopen(MASTERPIDFILE,"r"))!=NULL) 
	{
	fgets(string,15,f); /*get pid*/
	sscanf(string,"%d\n",&rpid);
	kill(rpid,9);
	fprintf(stdout,"killed\n");
	fclose(f);
	}
sprintf(remove,"rm %s\n",MASTERPIDFILE);
system(remove);

	if ((f=fopen(PROCESSFILE,"r"))==NULL)
		{
		fprintf(stdout,"mpssclean : processnumber file not existent.\n");
		exit(0);
		} else
		{
		while ((fgets(arr,15,f))!=NULL)
			{
			sscanf(arr,"%d\n",&procno);
			kill(procno,9);
			fprintf(stdout,"mpssclean : killed process number : %d\n",procno);
			}
		fclose(f);
		}
sprintf(remove,"rm %s\n",PROCESSFILE);
system(remove);
}