Example #1
0
File: file.c Project: jalkanen/ppt
void SaveConvFilter( struct PPTBase *PPTBase, char *name, struct convargs *cargs )
{
    APTR DOSBase = PPTBase->lb_DOS;
    BPTR fh;
    char buf[128];
    int i,j;

#ifdef DEBUG_MODE
    PDebug("SaveConvFilter()\n\tOpening file '%s'", name);
#endif

    fh = Open( name, MODE_NEWFILE );
    if(fh) {
#ifndef __PPC__
        sprintf(buf,"; PPT Convolution file\n; Generated by "MYNAME"\n" );
#endif
        FPuts(fh,buf);
        sprintf(buf,"%d\n%d\n%d\n",cargs->size,cargs->bias,cargs->div);
        FPuts(fh,buf);
        for(i = 0; i < 7; i++) {
            for(j = 0; j < 7; j++) {
                sprintf(buf,"%d ",cargs->weights[i][j]);
                FPuts(fh,buf);
            }
            FPutC(fh,'\n');
        }
        Close(fh);
    }
    /* BUG: Should warn! */
}
Example #2
0
void PrintUserFault(LONG code, const UBYTE *banner)
{
    struct Process *p = (struct Process *)SysBase->ThisTask;
    BPTR Stderr = p->pr_CES ? p->pr_CES : p->pr_COS;

    if (banner != NULL) {
        FPuts(Stderr, (STRPTR)banner);
        FPuts(Stderr, ": ");
    }
    FPuts(Stderr, (STRPTR)ug_StrError(code));
    FPuts(Stderr, "\n");
    Flush(Stderr);
}
Example #3
0
int InitLegacyConversionData(void) {
  BPTR file;
  char line[100];
  int putsRes = 0;

  Servermem->legacyConversionData.lowTextWhenBitmap0ConversionStarted = -1;

  if(!(file = Open("NiKom:DatoCfg/LegacyConversion.dat", MODE_READWRITE))) {
    return 0;
  }
  while(FGets(file, line, 100)) {
    if(strncmp(line, "LowTextWhenBitmap0ConversionStarted", 35) == 0) {
      Servermem->legacyConversionData.lowTextWhenBitmap0ConversionStarted =
        atoi(&line[36]);
    }
  }

  if(Servermem->legacyConversionData.lowTextWhenBitmap0ConversionStarted == -1) {
    Servermem->legacyConversionData.lowTextWhenBitmap0ConversionStarted =
      Servermem->info.lowtext;
    sprintf(line, "LowTextWhenBitmap0ConversionStarted=%d\n",
            Servermem->info.lowtext);
    putsRes = FPuts(file, line);
  }
  Close(file);

  printf("Read LegacyConversion.dat\n");

  return putsRes == 0;
}
Example #4
0
int main (int argc, char ** argv)
{
    struct Library *base1, *base2;
    BPTR seglist;
    
    FPuts(Output(), (STRPTR)"Testing peropener.library\n");
    
    base1=OpenLibrary((STRPTR)"peropener.library",0);
    base2=OpenLibrary((STRPTR)"peropener.library",0);

    FPrintf(Output(), (STRPTR)"base1=%lx, base2=%lx\n", base1, base2);
    
    if (base1 != NULL)
        CloseLibrary(base1);
    if (base2 != NULL)
        CloseLibrary(base2);

    FPuts(Output(), (STRPTR)"\nTesting perid.library\n");

    base1=OpenLibrary((STRPTR)"perid.library",0);
    base2=OpenLibrary((STRPTR)"perid.library",0);
    
    FPrintf(Output(), (STRPTR)"base1=%lx, base2=%lx\n", base1, base2);

    seglist = LoadSeg((CONST_STRPTR)"peropenertest_child");
    if (seglist != (BPTR)NULL)
    {
        RunCommand(seglist, 10*1024, "\n", -1);
        UnLoadSeg(seglist);
    }
    else
    {
        FPrintf(Output(), (STRPTR)"Failed to load peropenertest_child\n");
    }
    
    if (base1 != NULL)
        CloseLibrary(base1);
    if (base2 != NULL)
        CloseLibrary(base2);

    Flush (Output ());
    
    return 0;
}
Example #5
0
__saveds void ErrorProcess(void)
{
	char constring[200];
	BPTR file=NULL;
	ULONG sig;
	ULONG lock;
	ErrorSig=AllocSignal(ErrorSig);
	hassent=1;
	errorprocessalive=1;
	ErrorTask=FindTask(NULL);

	sprintf(constring,"CON:%d/%d/%d/%d/%s/SCREEN%s",20,20,500,300,"radium.nfo",screenname);

	for(;;){
		sig=Wait(1L<<ErrorSig|SIGBREAKF_CTRL_C);
		if(sig&1L<<ErrorSig){
			if(file==NULL){
				file=Open(constring,0x3ee);
			}
			if(file!=NULL && errorwindow==NULL){
				if(mainscreen!=NULL){
					struct Window *tempwindow;
					lock=LockIBase(0);
						tempwindow=mainscreen->FirstWindow;
						for(;;){
							if(tempwindow==NULL) break;
							if(!strcmp(tempwindow->Title,"radium.nfo")){
								errorwindow=tempwindow;
								break;
							}
							tempwindow=tempwindow->NextWindow;
						}
					UnlockIBase(lock);
 				}
			}

			if(file==NULL){
				fprintf(stderr,errorstring);
			}else{
				FPuts(file,errorstring);
			}
			hassent=1;

			if(errorwindow!=NULL){
				WindowToFront(errorwindow);
			}
		}
		if(sig&SIGBREAKF_CTRL_C) break;
	}

	if(file!=NULL){
		Close(file);
	}
	FreeSignal(ErrorSig);
}
Example #6
0
static void DisplayStateDiff(const struct ResourceDiff *rd, int pagelines)
{
    /* FIXME */
    IPTR mem[2];
    IPTR modified[5];
    struct ModifiedResource *mr;
    int currentlines;

    FPuts(Output(), "LeakWatch report:\n");
    mem[0] = rd->memLost;
    mem[1] = (IPTR)((rd->memLost > 1) ? "s" : "");
    VFPrintf(Output(), " Memory lost : %ld byte%s\n", mem);

    FPuts(Output(), " Open count:\n");
    currentlines = 3;
    for(mr=(struct ModifiedResource *)rd->modifiedOpened.lh_Head;
	mr->node.ln_Succ!=NULL;
	mr=(struct ModifiedResource *)mr->node.ln_Succ)
    {
	modified[0] = (IPTR)mr->type;
	modified[1] = (IPTR)mr->name;
	modified[2] = (IPTR)mr->addr;
	modified[3] = mr->before_count;
	modified[4] = mr->after_count;
	
	if (currentlines >= (pagelines - 2))
	{
	    ULONG buf;
	    currentlines = 0;
	    FPuts(Output(), "--- Press a key to continue ---\n");
	    Flush(Input());
	    Read(Input(), &buf, 1);
	    Flush(Input());
	}
	VFPrintf(Output(), " %s: %s (0x%lx) : %lu -> %lu\n", modified);
	currentlines++;
    }

    FPuts(Output(), "-- end of diff\n");
    
}
Example #7
0
void DisplayResourcesState(const struct TrackedResources *rs, int pagelines)
{
    /* FIXME */
    struct OpenedResourceNode *orn;
    IPTR tmp[4];
    IPTR mem[1];
    int currentlines;

    if (!rs)
	return;

    FPuts(Output(), "LeakWatch snapshot:\n");

    mem[0] = rs->freeMem;
    VFPrintf(Output(), " Free memory : %ld bytes\n", mem);

    FPuts(Output(), " Opened resources:\n");
    currentlines = 3;
    for(orn=(struct OpenedResourceNode *)rs->opened.lh_Head;
        orn->node.ln_Succ!=NULL;
        orn=(struct OpenedResourceNode *)orn->node.ln_Succ)
    {
	tmp[0] = (IPTR)orn->type;
	tmp[1] = (IPTR)orn->name;
	tmp[2] = (IPTR)orn->addr;
	tmp[3] = (IPTR)orn->count;
	
	if (currentlines >= (pagelines - 2))
	{
	    ULONG buf;
	    currentlines = 0;
	    FPuts(Output(), "--- Press a key to continue ---\n");
	    Flush(Input());
	    Read(Input(), &buf, 1);
	    Flush(Input());
	}
	VFPrintf(Output(), " %s: %s (0x%lx) : %lu\n", tmp);
	currentlines++;
    }
    FPuts(Output(), "-- end of state\n");
}
Example #8
0
void savefidocopy(struct FidoText *ft,int anv) {
        struct FidoLine *fl;
        BPTR fh;
        int nummer;
        char *foo,buffer[100];
        nummer=updatenextletter(anv);
        if(nummer==-1) {
                return;
        }
        sprintf(buffer,"NiKom:Users/%d/%d/%d.letter",anv/100,anv,nummer);
        if(!(fh=Open(buffer,MODE_NEWFILE))) {
                return;
        }
        FPuts(fh,"System-ID: Fido\n");
        sprintf(buffer,"From: %s (%d:%d/%d.%d)\n",ft->fromuser,ft->fromzone,ft->fromnet,ft->fromnode,ft->frompoint);
        FPuts(fh,buffer);
        sprintf(buffer,"To: %s (%d:%d/%d.%d)\n",ft->touser,ft->tozone,ft->tonet,ft->tonode,ft->topoint);
        FPuts(fh,buffer);
        sprintf(buffer,"Date: %s\n",ft->date);
        FPuts(fh,buffer);
        foo = hittaefter(ft->subject);
        if(ft->subject[0] == 0 || (ft->subject[0] == ' ' && foo[0] == 0)) strcpy(buffer,"Subject: -\n");
        else sprintf(buffer,"Subject: %s\n",ft->subject);
        FPuts(fh,buffer);
        for(fl=(struct FidoLine *)ft->text.mlh_Head;fl->line_node.mln_Succ;fl=(struct FidoLine *)fl->line_node.mln_Succ) {
                FPuts(fh,fl->text);
                FPutC(fh,'\n');
        }
        Close(fh);
        sprintf(outbuffer,"\n\n\rBrevet fick nummer %d i din brevlåda\r\n\n",nummer);
        puttekn(outbuffer,-1);
}
Example #9
0
int SaveAll(int usernumber, struct ProgramCategory *start)
{
	BPTR fh;
	char buffer[257], filnamn[257];
	struct ProgramData *pek;

	sprintf(filnamn, "NiKom:Users/%d/%d/ProgramData", usernumber/100, usernumber);

	if(start != NULL)
	{
		if(fh = Open(filnamn, MODE_NEWFILE))
		{
			while(start != NULL)
			{
				sprintf(buffer,"[%s]\n",start->namn);
				FPuts(fh, buffer);
				if(start->datastart != NULL)
				{
					pek = start->datastart;
					while(pek != NULL)
					{
						sprintf(buffer,"%s=%s\n",pek->typ,pek->data);
						FPuts(fh, buffer);
						pek = pek->next;
					}
				}
				start = start->next;
			}
		
			Close(fh);
			return(1);
		}
	}
	
	return(0);
}
Example #10
0
	int fputs (

/*  SYNOPSIS */
	const char * str,
	FILE	   * stream)

/*  FUNCTION
	Write a string to the specified stream.

    INPUTS
	str - Output this string...
	fh - ...to this stream

    RESULT
	> 0 on success and EOF on error.

    NOTES

    EXAMPLE

    BUGS

    SEE ALSO
	puts(), fputc(), putc()

    INTERNALS

******************************************************************************/
{
    fdesc *fdesc = __getfdesc(stream->fd);

    if (!fdesc)
    {
    	errno = EBADF;
	return EOF;
    }

    if (!str) str = "(null)";

    if (FPuts(fdesc->fcb->handle, str) == -1)
    {
	errno = __stdc_ioerr2errno(IoErr());
	return EOF;
    }

    return 0;
} /* fputs */
Example #11
0
void writelog(char *file, char *text) {
	BPTR fh;
	struct DateTime dt;
	char datebuf[14],timebuf[10],utbuf[100];
	DateStamp(&dt.dat_Stamp);
	dt.dat_Format = FORMAT_INT;
	dt.dat_Flags = 0;
	dt.dat_StrDay = NULL;
	dt.dat_StrDate = datebuf;
	dt.dat_StrTime = timebuf;
	DateToStr(&dt);
	sprintf(utbuf,"%s %s - %s\n",datebuf,timebuf,text);
	if(!(fh=Open(file,MODE_OLDFILE)))
		if(!(fh=Open(file,MODE_NEWFILE))) return;
	Seek(fh,0,OFFSET_END);
	FPuts(fh,utbuf);
	Close(fh);
}
Example #12
0
int main(void)
{
    IPTR           args[NOOFARGS] = { (IPTR)FALSE,
                                      (IPTR)FALSE,
                                      (IPTR)FALSE,
                                      (IPTR)FALSE,
                                      (IPTR)FALSE
                                    };
    struct RDArgs *rda;
    LONG           error = 0;
    BOOL bPrintErr = TRUE;
    rda = ReadArgs(ARG_TEMPLATE, args, NULL);

    if (rda != NULL)
    {
        UWORD typeCount = 0;
        BOOL  aChip  = (BOOL)args[ARG_CHIP];
        BOOL  aFast  = (BOOL)args[ARG_FAST];
        BOOL  aTotal = (BOOL)args[ARG_TOTAL];
        BOOL  aFlush = (BOOL)args[ARG_FLUSH];
        aHuman = (BOOL)args[ARG_HUMAN];

        if (aChip)
        {
            typeCount++;
        }
        if (aFast)
        {
            typeCount++;
        }
        if (aTotal)
        {
            typeCount++;
        }

        ULONG chip[4], fast[4], total[4];

        if (typeCount > 1)
        {
            FPuts(Output(), "Only one of CHIP, FAST or TOTAL allowed\n");
            bPrintErr = FALSE;
            FreeArgs(rda);

            return RETURN_FAIL;
        }
        else
        {
            if (aFlush)
            {
                APTR Mem;

                Mem = AllocMem(0x7ffffff0, MEMF_PUBLIC);
                if (Mem)
                    FreeMem(Mem, 0x7ffffff0);
            }

            if(aChip)
            {

                chip[0] = AvailMem(MEMF_CHIP);

                if (printm(NULL, chip, 1) < 0)
                {
                    error = RETURN_ERROR;
                }
            }
            else if(aFast)
            {
                fast[0] = AvailMem(MEMF_FAST);

                if (printm(NULL, fast, 1) < 0)
                {
                    error = RETURN_ERROR;
                }
            }
            else if (aTotal)
            {
                total[0] = AvailMem(MEMF_ANY);

                if (printm(NULL, total, 1) < 0)
                {
                    error = RETURN_ERROR;
                }
            }
            else
            {
                Forbid();

                chip[0] = AvailMem(MEMF_CHIP);
                chip[2] = AvailMem(MEMF_CHIP | MEMF_TOTAL);
                chip[3] = AvailMem(MEMF_CHIP | MEMF_LARGEST);
                chip[1] = chip[2] - chip[0];
                fast[0] = AvailMem(MEMF_FAST);
                fast[2] = AvailMem(MEMF_FAST | MEMF_TOTAL);
                fast[3] = AvailMem(MEMF_FAST | MEMF_LARGEST);
                fast[1] = fast[2] - fast[0];
                total[0] = AvailMem(MEMF_ANY);
                total[2] = AvailMem(MEMF_ANY | MEMF_TOTAL);
                total[3] = AvailMem(MEMF_ANY | MEMF_LARGEST);
                total[1] = total[2] - total[0];

                Permit();

                if (PutStr("Type   Available    In-Use   Maximum   Largest\n") < 0 ||
                        printm("chip", chip, 4) < 0 ||
                        printm("fast", fast, 4) < 0 ||
                        printm("total", total, 4) < 0)
                {
                    error = RETURN_ERROR;
                }
            }
        }

        FreeArgs(rda);
    }
    else
    {
        error = RETURN_FAIL;
    }

    if(error != RETURN_OK && bPrintErr)
    {
        PrintFault(IoErr(), "Avail");
    }

    return error;
}
Example #13
0
static void setup_write_parameter(BPTR fh, int argindex, int value)
{
    static char buffer[50];
    sprintf(buffer, "%s %d\n", opts[argindex], value);
    FPuts(fh, (STRPTR)buffer);
}
Example #14
0
void sparabrev(void) {
        BPTR fh,lock=NULL;
        struct EditLine *elpek;
        char bugbuf[100],orgfilename[50],*motstr;
        int till,nr,mot;
        Servermem->inne[nodnr].skrivit++;
        Servermem->info.skrivna++;
        Statstr.write++;
        till=atoi(brevspar.to);
        if((nr=updatenextletter(till))==-1) {
                freeeditlist();
                return;
        }
        sprintf(orgfilename,"NiKom:Users/%d/%d/%d.letter",till/100,till,nr);
        if(!(fh=Open(orgfilename,MODE_NEWFILE))) {
                puttekn("\n\n\rKunde inte öppna brevet\n\r",-1);
                freeeditlist();
                return;
        }
        strcpy(bugbuf,"System-ID: NiKom\n");
        FPuts(fh,bugbuf);
        sprintf(bugbuf,"From: %d\n",inloggad);
        FPuts(fh,bugbuf);
        sprintf(bugbuf,"To: %s\n",brevspar.to);
        FPuts(fh,bugbuf);
        if(brevspar.reply[0]) {
                sprintf(bugbuf,"Reply: %s\n",brevspar.reply);
                FPuts(fh,bugbuf);
        }
        sprintf(bugbuf,"Date: %s\n",brevspar.date);
        FPuts(fh,bugbuf);
        sprintf(bugbuf,"Subject: %s\n",brevspar.subject);
        FPuts(fh,bugbuf);
        for(elpek=(struct EditLine *)edit_list.mlh_Head;elpek->line_node.mln_Succ;elpek=(struct EditLine *)elpek->line_node.mln_Succ) {
                if(FPuts(fh,elpek->text)==-1) {
                        puttekn("\n\n\rFel vid skrivandet av brevet\n\r",-1);
                        break;
                }
                FPutC(fh,'\n');
        }
        Close(fh);
        freeeditlist();
        sprintf(outbuffer,"\r\nBrevet fick nummer %d hos %s\r\n",nr,getusername(till));
        puttekn(outbuffer,-1);
        if(Servermem->cfg.logmask & LOG_BREV) {
                strcpy(bugbuf,getusername(inloggad));
                sprintf(outbuffer,"%s skickar brev %d till %s",bugbuf,nr,getusername(till));
                logevent(outbuffer);
        }
        motstr=hittaefter(brevspar.to);
        if(motstr[0]) {
                if(!(lock=Lock(orgfilename,ACCESS_READ))) {
                        puttekn("\n\n\rKunde inte få ett lock för brevet\n\r",-1);
                        return;
                }
        }
        while(motstr[0]) {
                mot=atoi(motstr);
                if((nr=updatenextletter(mot))==-1) {
                        UnLock(lock);
                        return;
                }
                sprintf(bugbuf,"NiKom:Users/%d/%d/%d.letter",mot/100,mot,nr);
                if(!MakeLink(bugbuf,lock,FALSE)) {
                        puttekn("\n\n\rKunde inte skapa länk till brevet\n\r",-1);
                        UnLock(lock);
                        return;
                }
                sprintf(outbuffer,"\r\nBrevet fick nummer %d hos %s\r\n",nr,getusername(mot));
                puttekn(outbuffer,-1);
                if(Servermem->cfg.logmask & LOG_BREV) {
                        strcpy(bugbuf,getusername(inloggad));
                        sprintf(outbuffer,"%s skickar brev %d till %s",bugbuf,nr,getusername(mot));
                        logevent(outbuffer);
                }
                motstr=hittaefter(motstr);
        }
        if(lock) UnLock(lock);
}
Example #15
0
int main(void)
{
    struct TrackedResources *crs = NULL;
    struct TrackedResources *start_rs = NULL;
    BOOL quitme = FALSE;
    int numlines = 30;
    struct Task *this;
    ULONG  portsig;
    struct MsgPort *port;

    this = FindTask(NULL);

    port = CreateMsgPort();
    if (!port)
	return 2;
    port->mp_Node.ln_Name = "LeakWatch";
    port->mp_Node.ln_Pri  = 0;
    AddPort(port);

    portsig = 1L << port->mp_SigBit;

    open_libs();

    FPuts(Output(), "LeakWatch running, CTRL-C to exit, CTRL-E to watch for leaks since beginning, CTRL-F to watch for leaks since last CTRL-F, CTRL-D for an usage snapshot\n");

    crs = NewResourcesState();
    if (NULL == crs)
	quitme = TRUE;
    else
	start_rs = CopyResourcesState(crs);

    while(!quitme)
    {
	ULONG signals;

	signals = Wait(portsig | SIGBREAKF_CTRL_F | SIGBREAKF_CTRL_E | SIGBREAKF_CTRL_D | SIGBREAKF_CTRL_C);

	if (signals & SIGBREAKF_CTRL_D)
	{
	    struct TrackedResources *tr;

	    tr = NewResourcesState();
	    if (NULL == tr)
	    {
		quitme = TRUE;
		break;
	    }
	    DisplayResourcesState(tr, numlines);
	    DeleteResourcesState(tr);
	}
	if (signals & SIGBREAKF_CTRL_E)
	{
	    struct ResourceDiff *rd = NULL;

	    DeleteResourcesState(crs);
	    crs = NewResourcesState();
	    if (NULL == crs)
	    {
		quitme = TRUE;
		break;
	    }
	    /*  DisplayResourcesState(crs); */ /* only for debug */
	    rd = NewStateDiff(start_rs, crs);
	    DisplayStateDiff(rd, numlines);
	    DeleteStateDiff(rd);
	}
	if (signals & SIGBREAKF_CTRL_F)
	{
	    struct TrackedResources *ors = crs;
	    struct ResourceDiff *rd = NULL;

	    crs = NewResourcesState();
	    if (NULL == crs)
	    {
		quitme = TRUE;
		break;
	    }
	    rd = NewStateDiff(ors, crs);
	    DisplayStateDiff(rd, numlines);
	    DeleteStateDiff(rd);
	    DeleteResourcesState(ors);
	}
	if (signals & SIGBREAKF_CTRL_C)
	{
	    quitme = TRUE;
	}
	if (signals & portsig)
	{
	    struct Message *msg;

	    while((msg = (struct Message *)GetMsg(port)))
	    {
		D(bug("Received watch message.\n"));

		ReplyMsg(msg);
	    }

	}
    } /* while(!quitme) */

    DeleteResourcesState(crs);
    DeleteResourcesState(start_rs);

    close_libs();

    if (port)
    {
	RemPort(port);
    	DeleteMsgPort(port);
    }
    return 0;
}
Example #16
0
void __saveds __asm LIBMatrix2NiKom(register __a6 struct NiKomBase *NiKomBase) {
	struct FidoText *fidotext;
	struct FidoLine *fl;
	int going=TRUE,anv,brev;
	BPTR fh;
	char buffer[100],*foo,filnamn[20];
	struct TagItem ti = { TAG_DONE };

	if(!NiKomBase->Servermem) return;

	LIBLockNiKomBase(NiKomBase);
	while(going) {
		strcpy(buffer,NiKomBase->Servermem->fidodata.matrixdir);
		sprintf(filnamn,"%d.msg",NiKomBase->lastmatrix);
		AddPart(buffer,filnamn,99);
		if(!(fidotext = LIBReadFidoText(buffer,&ti,NiKomBase))) break;
		NiKomBase->lastmatrix++;
		if(fidotext->attribut & FIDOT_LOCAL) {
			continue;
		}
		sprintf(buffer,"Brev %d till %s (%d:%d/%d.%d)",NiKomBase->lastmatrix-1,fidotext->touser,fidotext->tozone,fidotext->tonet,
			fidotext->tonode,fidotext->topoint);
		writelog(NiKomBase->Servermem->fidodata.fidologfile,buffer);
		anv=fidoparsenamn(fidotext->touser,NiKomBase->Servermem);
		if(anv==-1) {
			sprintf(buffer,"Hittar inte %s",fidotext->touser);
			writelog(NiKomBase->Servermem->fidodata.fidologfile,buffer);
			continue;
		}
		brev=updatenextletter(anv);
		if(brev==-1) {
			continue;
		}
		sprintf(buffer,"NiKom:Users/%d/%d/%d.letter",anv/100,anv,brev);
		if(!(fh=Open(buffer,MODE_NEWFILE))) {
			continue;
		}
		FPuts(fh,"System-ID: Fido\n");
		sprintf(buffer,"From: %s (%d:%d/%d.%d)\n",fidotext->fromuser,fidotext->fromzone,fidotext->fromnet,
			fidotext->fromnode,fidotext->frompoint);
		FPuts(fh,buffer);
		sprintf(buffer,"To: %s (%d:%d/%d.%d)\n",fidotext->touser,fidotext->tozone,fidotext->tonet,
			fidotext->tonode,fidotext->topoint);
		FPuts(fh,buffer);
		sprintf(buffer,"Message-ID: %s\n",fidotext->msgid);
		FPuts(fh,buffer);
		sprintf(buffer,"Date: %s\n",fidotext->date);
		FPuts(fh,buffer);
		foo = hittaefter(fidotext->subject);
		if(fidotext->subject[0] == 0 || (fidotext->subject[0] == ' ' && foo[0] == 0)) strcpy(buffer,"Subject: -\n");
		else sprintf(buffer,"Subject: %s\n",fidotext->subject);
		FPuts(fh,buffer);
		for(fl=(struct FidoLine *)fidotext->text.mlh_Head;fl->line_node.mln_Succ;fl=(struct FidoLine *)fl->line_node.mln_Succ) {
			FPuts(fh,fl->text);
			FPutC(fh,'\n');
		}
		Close(fh);
		FreeFidoText(fidotext);
	}
	sprintf(buffer,"%d",NiKomBase->lastmatrix);
	SetVar("NiKom:DatoCfg/LastMatrix",buffer,-1,GVF_GLOBAL_ONLY);
	LIBUnLockNiKomBase(NiKomBase);
}