/* $Id: resfile.c,v 1.1 2001/04/12 00:33:53 skaus Exp $

	Return the name of the resource file

*/

#include "../config.h"

#include <assert.h>
#include <stdlib.h>
#include <string.h>

#include <dfn.h>

#include "../include/command.h"
#include "../include/misc.h"

char *comResFile(void)
{  if(isSwapFile) {
       static char *p = 0;

       free(p);
       if((p = strdup(comFile())) != 0) {
           assert(strlen(p) == isSwapFile + 3);
           memcpy(p + isSwapFile, "SWP", 3);
           if(exist(p))
			   return p;
       }
   }

   return comFile();
}
